You are here

protected function MenuItemRoleAccessLinkTreeManipulator::getOverrideChildrenValue in Menu Item Role Access 8

Same name and namespace in other branches
  1. 8.2 src/MenuItemRoleAccessLinkTreeManipulator.php \Drupal\menu_item_role_access\MenuItemRoleAccessLinkTreeManipulator::getOverrideChildrenValue()

Get the value of the override children option of a menu item.

Parameters

\Drupal\menu_link_content\Entity\MenuLinkContent $menu_link_item: A menu link item entity.

Return value

bool True if option is checked on the parent, false otherwise.

1 call to MenuItemRoleAccessLinkTreeManipulator::getOverrideChildrenValue()
MenuItemRoleAccessLinkTreeManipulator::getOverridingParent in src/MenuItemRoleAccessLinkTreeManipulator.php
Get the first parent that overrides the childrens' settings.

File

src/MenuItemRoleAccessLinkTreeManipulator.php, line 159

Class

MenuItemRoleAccessLinkTreeManipulator
Defines the access control handler for the menu item.

Namespace

Drupal\menu_item_role_access

Code

protected function getOverrideChildrenValue(MenuLinkContent $menu_link_item) {
  $override_children = $menu_link_item
    ->get('menu_item_override_children')
    ->getValue();

  // Cardinality of the field is 1 so get item 0 from values.
  if (isset($override_children[0]['value']) && $override_children[0]['value'] == 1) {
    return TRUE;
  }
  else {
    return FALSE;
  }
}