Commit f319fb2a authored by Oleh Tarasiuk's avatar Oleh Tarasiuk
Browse files

#3294887 Fix phpcs issues

parent 823a7b38
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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".
+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) {
+1 −1
Original line number Diff line number Diff line
@@ -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'
+0 −4
Original line number Diff line number Diff line
@@ -25,8 +25,4 @@
      }
    }
  };




})(jQuery, Drupal);
+6 −8
Original line number Diff line number Diff line
@@ -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();
@@ -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 = [
@@ -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'];
@@ -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'],
@@ -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) {
@@ -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