You are here

private function MenuItemExtrasViewModeSelectorSelect::checkFromWidgetMenuHasExtraFields in Menu Item Extras 8.2

Checks that menu has extra fields.

Parameters

\Drupal\Core\Field\FieldItemListInterface $items: Array of default values for this field.

int $delta: The order of this item in the array of sub-elements (0, 1, 2, etc.).

array $element: A form element array containing basic properties for the widget.

array $form: The form structure where widgets are being attached to. This might be a full form structure, or a sub-element of a larger form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

bool If menu has extra fields return TRUE, FALSE otherwise.

1 call to MenuItemExtrasViewModeSelectorSelect::checkFromWidgetMenuHasExtraFields()
MenuItemExtrasViewModeSelectorSelect::formElement in src/Plugin/Field/FieldWidget/MenuItemExtrasViewModeSelectorSelect.php
Returns the form for a single field widget.

File

src/Plugin/Field/FieldWidget/MenuItemExtrasViewModeSelectorSelect.php, line 123

Class

MenuItemExtrasViewModeSelectorSelect
Base class for the menu item extras view mode widget.

Namespace

Drupal\menu_item_extras\Plugin\Field\FieldWidget

Code

private function checkFromWidgetMenuHasExtraFields(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
  $storage = $form_state
    ->getStorage();
  $bundle = $storage['form_display']
    ->getTargetBundle();
  $entity_type = $storage['form_display']
    ->getTargetEntityTypeId();
  return Utility::checkBundleHasExtraFieldsThanEntity($entity_type, $bundle);
}