Loading README.md +4 −2 Original line number Diff line number Diff line Loading @@ -3,11 +3,13 @@ INTRODUCTION ------------ The Content hub tree provides form that looks like the content view, but in a menu-like structure. The Content hub tree provides form that looks like the content view, but in a menu-like structure. CONFIGURATION ------------- * To enable content thee hub for some menu (/admin/structure/menu/manage/{menu}) * To enable content thee hub for some menu (/admin/structure/menu/manage/{menu}) just check the checkbox "Include in Content Tree". content_hub_tree.install +5 −0 Original line number Diff line number Diff line <?php /** * @file * Implements hook_install(). */ /** * Content hub tree install. */ function content_hub_tree_install($is_syncing) { $main_menu = \Drupal::entityTypeManager()->getStorage('menu')->load('main'); if ($main_menu) { Loading content_hub_tree.routing.yml +1 −1 Original line number Diff line number Diff line Loading @@ -4,4 +4,4 @@ content_hub_tree.content_hub_tree: _entity_form: 'menu.content_hub_tree' _title: 'Content Tree' requirements: _permission: 'access administration pages' _permission: 'administer site configuration' js/content-tree-collapse.js +0 −4 Original line number Diff line number Diff line Loading @@ -25,8 +25,4 @@ } } }; })(jQuery, Drupal); src/Form/MenuContentTreeForm.php +6 −8 Original line number Diff line number Diff line Loading @@ -168,9 +168,9 @@ class MenuContentTreeForm extends EntityForm { * Select menu. * * @param array $form * The form. * @param \Drupal\Core\Form\FormStateInterface $form_state * * @return mixed * The form state. */ public static function selectMenuCallback(array $form, FormStateInterface $form_state) { $response = new AjaxResponse(); Loading Loading @@ -260,7 +260,6 @@ class MenuContentTreeForm extends EntityForm { $tree = $this->menuTree->load($this->entity->id(), new MenuTreeParameters()); // We indicate that a menu administrator is running the menu access check. $this->getRequest()->attributes->set('_menu_admin', TRUE); $manipulators = [ Loading Loading @@ -317,14 +316,14 @@ class MenuContentTreeForm extends EntityForm { if (isset($links[$id]['#item'])) { $element = $links[$id]; $form['links'][$id]['#item'] = $element['#item']; // TableDrag: Mark the table row as draggable. $form['links'][$id]['#attributes'] = $element['#attributes']; $form['links'][$id]['#attributes']['class'][] = 'draggable'; // TableDrag: Sort the table row according to its existing/configured weight. // TableDrag: Sort the table row according // to its existing/configured weight. $form['links'][$id]['#weight'] = $element['#item']->link->getWeight(); $element['id']['#attributes']['class'] = ['menu-id']; Loading Loading @@ -370,7 +369,7 @@ class MenuContentTreeForm extends EntityForm { 'class' => [ 'collapse-button', ], 'aria-label' => $this->t('Collapse/Expand button') 'aria-label' => $this->t('Collapse/Expand button'), ], ], $row['title'], Loading Loading @@ -404,7 +403,7 @@ class MenuContentTreeForm extends EntityForm { * @return array * The overview tree form. */ protected function buildOverviewTreeForm($tree, $delta) { protected function buildOverviewTreeForm(array $tree, $delta) { $form = &$this->overviewTreeForm; $tree_access_cacheability = new CacheableMetadata(); foreach ($tree as $element) { Loading @@ -420,7 +419,6 @@ class MenuContentTreeForm extends EntityForm { if ($link) { $id = $link->getPluginId(); $form[$id]['#item'] = $element; if (!$link->isEnabled()) { $form[$id]['title']['#suffix'] = ' (' . $this->t('disabled') . ')'; Loading Loading
README.md +4 −2 Original line number Diff line number Diff line Loading @@ -3,11 +3,13 @@ INTRODUCTION ------------ The Content hub tree provides form that looks like the content view, but in a menu-like structure. The Content hub tree provides form that looks like the content view, but in a menu-like structure. CONFIGURATION ------------- * To enable content thee hub for some menu (/admin/structure/menu/manage/{menu}) * To enable content thee hub for some menu (/admin/structure/menu/manage/{menu}) just check the checkbox "Include in Content Tree".
content_hub_tree.install +5 −0 Original line number Diff line number Diff line <?php /** * @file * Implements hook_install(). */ /** * Content hub tree install. */ function content_hub_tree_install($is_syncing) { $main_menu = \Drupal::entityTypeManager()->getStorage('menu')->load('main'); if ($main_menu) { Loading
content_hub_tree.routing.yml +1 −1 Original line number Diff line number Diff line Loading @@ -4,4 +4,4 @@ content_hub_tree.content_hub_tree: _entity_form: 'menu.content_hub_tree' _title: 'Content Tree' requirements: _permission: 'access administration pages' _permission: 'administer site configuration'
js/content-tree-collapse.js +0 −4 Original line number Diff line number Diff line Loading @@ -25,8 +25,4 @@ } } }; })(jQuery, Drupal);
src/Form/MenuContentTreeForm.php +6 −8 Original line number Diff line number Diff line Loading @@ -168,9 +168,9 @@ class MenuContentTreeForm extends EntityForm { * Select menu. * * @param array $form * The form. * @param \Drupal\Core\Form\FormStateInterface $form_state * * @return mixed * The form state. */ public static function selectMenuCallback(array $form, FormStateInterface $form_state) { $response = new AjaxResponse(); Loading Loading @@ -260,7 +260,6 @@ class MenuContentTreeForm extends EntityForm { $tree = $this->menuTree->load($this->entity->id(), new MenuTreeParameters()); // We indicate that a menu administrator is running the menu access check. $this->getRequest()->attributes->set('_menu_admin', TRUE); $manipulators = [ Loading Loading @@ -317,14 +316,14 @@ class MenuContentTreeForm extends EntityForm { if (isset($links[$id]['#item'])) { $element = $links[$id]; $form['links'][$id]['#item'] = $element['#item']; // TableDrag: Mark the table row as draggable. $form['links'][$id]['#attributes'] = $element['#attributes']; $form['links'][$id]['#attributes']['class'][] = 'draggable'; // TableDrag: Sort the table row according to its existing/configured weight. // TableDrag: Sort the table row according // to its existing/configured weight. $form['links'][$id]['#weight'] = $element['#item']->link->getWeight(); $element['id']['#attributes']['class'] = ['menu-id']; Loading Loading @@ -370,7 +369,7 @@ class MenuContentTreeForm extends EntityForm { 'class' => [ 'collapse-button', ], 'aria-label' => $this->t('Collapse/Expand button') 'aria-label' => $this->t('Collapse/Expand button'), ], ], $row['title'], Loading Loading @@ -404,7 +403,7 @@ class MenuContentTreeForm extends EntityForm { * @return array * The overview tree form. */ protected function buildOverviewTreeForm($tree, $delta) { protected function buildOverviewTreeForm(array $tree, $delta) { $form = &$this->overviewTreeForm; $tree_access_cacheability = new CacheableMetadata(); foreach ($tree as $element) { Loading @@ -420,7 +419,6 @@ class MenuContentTreeForm extends EntityForm { if ($link) { $id = $link->getPluginId(); $form[$id]['#item'] = $element; if (!$link->isEnabled()) { $form[$id]['title']['#suffix'] = ' (' . $this->t('disabled') . ')'; Loading