我需要将额外的变量传递给twig,下面的代码加载了weekView
twig文件,我可以在其中访问$week_id
的节点,但我也需要访问$image_path
。
$week_id = $dynamic_week_id; //comes from different node
$image_path = $dynamic_image_path; //comes from different node
$view_week_key = [
'content',
'this_week_wrapper',
'this_week',
'value',
];
$form_state->setValue($view_week_key, "<p>[mailchimp_campaign|entity_type=node|entity_id=" . $week_id . "|view_mode=weekView]</p>");
答案 0 :(得分:1)
您正在使用哪种树枝? 如果它是节点的树枝文件,则可以使用以下命令获取图像:
{{ file_url(node.field_name.entity.fileuri)}}