Skip to content
Snippets Groups Projects
Commit 428b7aa5 authored by Eric Bremner's avatar Eric Bremner
Browse files

Merge branch 'ISTWCMS-2447-quicklinks-para' into 8.x-1.x

parents d16e4289 bd8026c1
No related branches found
No related tags found
No related merge requests found
{% include '@organisms/single-page/quicklinks-block/quicklinks-block.twig' with {
'anchor_link': anchor_link,
'display_title': display_title,
'title': content.field_uw_block_title|field_value,
'quicklinks': quicklinks
} %}
\ No newline at end of file
......@@ -193,6 +193,64 @@ function uw_fdsu_theme_resp_preprocess_paragraph(&$variables) {
$sources = _uw_fdsu_theme_resp_add_responsive_image_variables($variables, $field, 'uw_resp_is_marketing_item');
$variables['sources'] = $sources;
break;
case "uw_para_quicklinks_block":
$display_title = _uw_fdsu_theme_resp_get_field_value_from_paragraph($variables['paragraph'], 'field_uw_display_title');
// If the title is to be displayed, set variable to On.
if ($display_title) {
$variables['display_title'] = "On";
}
// If the title is not to be displayed, set variable to Off.
else {
$variables['display_title'] = "Off";
}
// Set the anchor link.
$variables['anchor_link'] = _uw_fdsu_theme_resp_get_field_value_from_paragraph($variables['paragraph'], 'field_uw_anchor_link');
$field_values = $variables['paragraph']->get('field_uw_quicklink')->getValue();
unset($quicklinks);
$counter = 0;
// Process field_uw_options field which includes multiple entities.
foreach ($field_values as $field_value) {
// Get paragraph entity of field_uw_options field from the target_id.
$paragraph = \Drupal\paragraphs\Entity\Paragraph::load($field_value['target_id']);
// Get the field entity from the paragraph.
$field = $paragraph->field_uw_icon_image->first();
// If there is a field to process, process it.
if (isset($field)) {
// Get the sources for the responsive image.
$quicklinks[$counter]['sources'] = _uw_fdsu_theme_resp_add_responsive_image_variables($variables, $field, 'uw_resp_is_marketing_item');
}
// Set the link section title.
$quicklinks[$counter]['link_section_title'] = $paragraph->get('field_uw_link_section_title')->getValue()[0]['value'];
// Get the links out of the quicklink paragraph.
$links = $paragraph->get('field_uw_quicklinks_links')->getValue();
// Step through each link and set the url and content.
foreach ($links as $link) {
$quicklinks[$counter]['links'][] = array(
'link_url' => $link['uri'],
'link_content' => $link['title']
);
}
// Increment the counter used for the quicklinks array.
$counter++;
}
// Set the quicklinks variable to be used in the template.
$variables['quicklinks'] = $quicklinks;
break;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment