diff --git a/src/Plugin/Field/FieldWidget/MetatagFirehose.php b/src/Plugin/Field/FieldWidget/MetatagFirehose.php index cb96a2e..d4b9da6 100644 --- a/src/Plugin/Field/FieldWidget/MetatagFirehose.php +++ b/src/Plugin/Field/FieldWidget/MetatagFirehose.php @@ -89,10 +89,7 @@ public function settingsForm(array $form, FormStateInterface $form_state) { * {@inheritdoc} */ public function settingsSummary() { - $summary = []; - - $sidebar = $this->getSetting('sidebar'); - if ($sidebar) { + if ($this->getSetting('sidebar')) { $summary[] = t('Use sidebar: Yes'); } else { @@ -143,11 +140,16 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen $entity_bundle = $item->getEntity()->bundle(); // See if there are requested groups for this entity type and bundle. - $groups = !empty($entity_type_groups[$entity_type]) && !empty($entity_type_groups[$entity_type][$entity_bundle]) ? $entity_type_groups[$entity_type][$entity_bundle] : []; + $groups = []; + if (!empty($entity_type_groups[$entity_type]) && !empty($entity_type_groups[$entity_type][$entity_bundle])) { + $groups = $entity_type_groups[$entity_type][$entity_bundle]; + } + // Limit the form to requested groups, if any. if (!empty($groups)) { $element = $this->metatagManager->form($values, $element, [$entity_type], $groups); } + // Otherwise, display all groups. else { $element = $this->metatagManager->form($values, $element, [$entity_type]);