Skip to content
Snippets Groups Projects
Commit 3c72ffc5 authored by Julian Pustkuchen's avatar Julian Pustkuchen
Browse files

Fixed field_layout conditions, as with layout_builder enabled they are no more...

Fixed field_layout conditions, as with layout_builder enabled they are no more required (even if field_layout is still ON
parent fc0efb2c
No related branches found
No related tags found
No related merge requests found
......@@ -111,17 +111,19 @@ function drowl_paragraphs_types_preprocess_paragraph__drowl_paragraphs_types__co
}
// Set the values in the field to make them available to later hook "drowl_paragraphs_types_preprocess_slick" where it can be set.
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler->moduleExists('field_layout')) {
// Different structure with field_layout module.
if (!empty($variables['elements']['_field_layout']['content']['field_paragraphs_paragraphs']['#build'])) {
// TODO Unsure why but on cron runs this is being executed (WHY??) and empty.
$optionset = $variables['elements']['_field_layout']['content']['field_paragraphs_paragraphs']['#build']['optionset'];
$optionset = $variables['elements']['field_paragraphs_paragraphs']['#build']['optionset'];
// Field layout (if used) may change the structure, so check that additionally, if the optionset is empty.
if (empty($optionset)) {
$moduleHandler = \Drupal::service('module_handler');
if ($moduleHandler->moduleExists('field_layout')){
// Different structure with field_layout module.
if (!empty($variables['elements']['_field_layout']['content']['field_paragraphs_paragraphs']['#build'])) {
// TODO Unsure why but on cron runs this is being executed (WHY??) and empty.
$optionset = $variables['elements']['_field_layout']['content']['field_paragraphs_paragraphs']['#build']['optionset'];
}
}
} else {
// Default structure (fallback)
$optionset = $variables['elements']['field_paragraphs_paragraphs']['#build']['optionset'];
}
if (!empty($optionset)) {
$optionset->set('drowl_paragraphs_options_override', $options_override);
$optionset->set('drowl_paragraphs_settings_responsive_override', $settings_responsive_override);
......
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