protected MenuTreeStorage::updateParentalStatus(array $link)
Sets has_children for the link's parent if it has visible children.
Parameters
array $link: The link to get a parent ID from.
File
- core/lib/Drupal/Core/Menu/MenuTreeStorage.php, line 596
Class
- MenuTreeStorage
- Provides a menu tree storage using the database.
Namespace
Drupal\Core\Menu
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | protected function updateParentalStatus( array $link ) { // If parent is empty, there is nothing to update. if (! empty ( $link [ 'parent' ])) { // Check if at least one visible child exists in the table. $query = $this ->connection->select( $this ->table, $this ->options); $query ->addExpression( '1' ); $query ->range(0, 1); $query ->condition( 'menu_name' , $link [ 'menu_name' ]) ->condition( 'parent' , $link [ 'parent' ]) ->condition( 'enabled' , 1); $parent_has_children = ((bool) $query ->execute()->fetchField()) ? 1 : 0; $this ->connection->update( $this ->table, $this ->options) ->fields( array ( 'has_children' => $parent_has_children )) ->condition( 'id' , $link [ 'parent' ]) ->execute(); } } |
Please login to continue.