You are here

class DynamicLayout in Dynamic Layouts 8

Same name in this branch
  1. 8 src/Entity/DynamicLayout.php \Drupal\dynamic_layouts\Entity\DynamicLayout
  2. 8 src/Plugin/Layout/DynamicLayout.php \Drupal\dynamic_layouts\Plugin\Layout\DynamicLayout

Defines the DynamicLayout entity.

The DynamicLayout entity stores information about a dynamic layout.

Plugin annotation


@ConfigEntityType(
  id = "dynamic_layout",
  label = @Translation("Dynamic Layout"),
  module = "dynamic_layout",
  config_prefix = "dynamic_layout",
  admin_permission = "admin dynamic layouts",
  handlers = {
    "list_builder" = "Drupal\dynamic_layouts\DynamicLayoutListBuilder",
    "form" = {
      "default" = "Drupal\dynamic_layouts\Form\DynamicLayoutForm",
      "delete" = "Drupal\dynamic_layouts\Form\DynamicLayoutDeleteForm"
    },
  },
  links = {
    "edit-form" = "/admin/config/dynamic-layouts/manage/{dynamic_layout}",
    "delete-form" =
  "/admin/config/dynamic-layouts/manage/{dynamic_layout}/delete"
  },
  entity_keys = {
    "id" = "id",
    "label" = "label",
    "weight" = "weight"
  },
  config_export = {
    "id",
    "label",
    "weight",
    "category",
    "regions",
    "default_column_class",
    "default_row_class"
  }
)

Hierarchy

Expanded class hierarchy of DynamicLayout

File

src/Entity/DynamicLayout.php, line 51

Namespace

Drupal\dynamic_layouts\Entity
View source
class DynamicLayout extends ConfigEntityBase implements DynamicLayoutInterface {

  /**
   * The layout machine name.
   *
   * @var string
   */
  public $id;

  /**
   * The human readable name of this layout.
   *
   * @var string
   */
  public $label;

  /**
   * The position weight (not physical) of this layout.
   *
   * @var int
   */
  public $weight;

  /**
   * The category of this layout.
   *
   * @var string
   */
  public $category;

  /**
   * The regions of this layout.
   *
   * @var string
   */
  public $regions;

  /**
   * The default column class.
   *
   * @var string
   */
  public $default_column_class;

  /**
   * The default row class.
   *
   * @var string
   */
  public $default_row_class;

  /**
   * {@inheritdoc}
   */
  public function getCategory() {
    return $this->category;
  }

  /**
   * {@inheritdoc}
   */
  public function getDefaultColumnClass() {
    return $this->default_column_class;
  }

  /**
   * {@inheritdoc}
   */
  public function setDefaultRowClass($default_row_class) {
    $this->default_row_class = $default_row_class;

    // Loop over the rows and find the corresponding row number.
    $rows = $this
      ->getRows();
    if ($rows) {
      foreach ($rows as $key => $row) {
        $rows[$key][Constants::DEFAULT_ROW_CLASS] = $default_row_class;
      }
    }
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  public function setDefaultColumnClass($default_column_class) {
    $this->default_column_class = $default_column_class;

    // Loop over the rows and their columns.
    $rows = $this
      ->getRows();
    if ($rows) {
      foreach ($rows as $row_key => $row) {
        $columns = $row[Constants::COLUMNS];
        foreach ($columns as $column_key => $column) {
          $rows[$row_key][Constants::COLUMNS][$column_key][Constants::DEFAULT_COLUMN_CLASS] = $default_column_class;
        }
      }
    }
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  public function getDefaultRowClass() {
    return $this->default_row_class;
  }

  /**
   * {@inheritdoc}
   */
  public function getRegions() {
    return $this->regions;
  }

  /**
   * {@inheritdoc}
   */
  public function setRowClasses($row_id, array $row_classes) {
    $updated_row = $this
      ->getRowById($row_id);
    $updated_row[Constants::CUSTOM_ROW_CLASSES] = $row_classes;

    // Loop over the rows and find the corresponding row number.
    $rows = $this
      ->getRows();
    foreach ($rows as $key => $row) {
      if ($row[Constants::ROW_ID] == $row_id) {
        $rows[$key] = $updated_row;
      }
    }
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  public function setCustomColumnClasses($row_id, $column_id, array $column_classes) {
    $updated_row = $this
      ->getRowById($row_id);
    $updated_column = $this
      ->getColumnById($updated_row, $column_id);
    $updated_column[Constants::CUSTOM_COLUMN_CLASSES] = $column_classes;
    $columns = $updated_row[Constants::COLUMNS];

    // Loop over the columns and set the updated column.
    foreach ($columns as $key => $column) {
      if ($column[Constants::COLUMN_ID] == $column_id) {
        $columns[$key] = $updated_column;
      }
    }

    // Loop over the rows and find the corresponding row number.
    $rows = $this
      ->getRows();
    foreach ($rows as $key => $row) {
      if ($row[Constants::ROW_ID] == $row_id) {
        $rows[$key][Constants::COLUMNS] = $columns;
      }
    }
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  public function setColumnName($row_id, $column_id, $column_name) {
    $updated_row = $this
      ->getRowById($row_id);
    $columns = $updated_row[Constants::COLUMNS];

    // Set the column name.
    $updated_column = $this
      ->getColumnById($updated_row, $column_id);
    $updated_column[Constants::COLUMN_NAME] = $column_name;
    if (!$column_name) {
      $column_name = 'r' . $row_id . 'c' . $column_id;
    }

    // Convert to machine name.
    $region_name = strtolower($column_name);
    $region_name = preg_replace('/[^a-z0-9_]+/', '_', $region_name);
    $region_name = preg_replace('/_+/', '_', $region_name);

    // Set the region name.
    $updated_column[Constants::REGION_NAME] = $region_name;

    // Loop over the columns and set the updated column.
    foreach ($columns as $key => $column) {
      if ($column[Constants::COLUMN_ID] == $column_id) {
        $columns[$key] = $updated_column;
      }
    }

    // Loop over the rows and find the corresponding row number.
    $rows = $this
      ->getRows();
    foreach ($rows as $key => $row) {
      if ($row[Constants::ROW_ID] == $row_id) {
        $rows[$key][Constants::COLUMNS] = $columns;
      }
    }
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  public function setCustomColumnWidthNumber($row_id, $column_id, $custom_column_width_number) {
    $updated_row = $this
      ->getRowById($row_id);
    $updated_column = $this
      ->getColumnById($updated_row, $column_id);
    $updated_column[Constants::CUSTOM_COLUMN_WIDTH_NUMBER] = $custom_column_width_number;
    $columns = $updated_row[Constants::COLUMNS];

    // Loop over the columns and set the updated column.
    foreach ($columns as $key => $column) {
      if ($column[Constants::COLUMN_ID] == $column_id) {
        $columns[$key] = $updated_column;
      }
    }

    // Loop over the rows and find the corresponding row number.
    $rows = $this
      ->getRows();
    foreach ($rows as $key => $row) {
      if ($row[Constants::ROW_ID] == $row_id) {
        $rows[$key][Constants::COLUMNS] = $columns;
      }
    }
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  public function getRowClasses($row_id) {
    $row = $this
      ->getRowById($row_id);

    // Convert to comma separated.
    $row_classes = '';
    if (is_array($row[Constants::CUSTOM_ROW_CLASSES])) {
      $row_classes = implode(', ', $row[Constants::CUSTOM_ROW_CLASSES]);
    }
    return $row_classes;
  }

  /**
   * {@inheritdoc}
   */
  public function getColumnClasses($row_id, $column_id) {
    $row = $this
      ->getRowById($row_id);
    $column_classes = '';
    $column = $this
      ->getColumnById($row, $column_id);

    // Guarding.
    if (!isset($column[Constants::CUSTOM_COLUMN_CLASSES])) {
      return $column_classes;
    }
    if (!is_array($column[Constants::CUSTOM_COLUMN_CLASSES])) {
      return $column_classes;
    }
    return implode(', ', $column[Constants::CUSTOM_COLUMN_CLASSES]);
  }

  /**
   * {@inheritdoc}
   */
  public function getColumnName($row_id, $column_id) {
    $row = $this
      ->getRowById($row_id);
    $column = $this
      ->getColumnById($row, $column_id);
    return $column[Constants::COLUMN_NAME];
  }

  /**
   * {@inheritdoc}
   */
  public function getColumnWidthNumber($row_id, $column_id) {
    $row = $this
      ->getRowById($row_id);
    $column = $this
      ->getColumnById($row, $column_id);
    $column_width_number = $column[Constants::COLUMN_WIDTH_NUMBER];
    if (isset($column[Constants::CUSTOM_COLUMN_WIDTH_NUMBER])) {
      $column_width_number = $column[Constants::CUSTOM_COLUMN_WIDTH_NUMBER];
    }
    return $column_width_number;
  }

  /**
   * {@inheritdoc}
   */
  public function deleteRow($row_id) {

    // Loop over the rows and find the corresponding row number.
    $rows = $this
      ->getRows();
    foreach ($rows as $key => $row) {
      if ($row[Constants::ROW_ID] == $row_id) {
        unset($rows[$key]);
      }
    }
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  public function addRow() {
    $rows = $this
      ->getRows();
    $column_count = 1;

    /** @var \Drupal\dynamic_layouts\DynamicLayoutSettingsInterface $settings */
    $last_column_class = '';
    $column_width_prefix = '';
    if ($settings = \Drupal::entityTypeManager()
      ->getStorage(Constants::DYNAMIC_LAYOUT_SETTINGS)
      ->load(Constants::SETTINGS)) {
      $column_classes = array_keys($settings
        ->getFrontendColumnClasses());
      $last_column_class = end($column_classes);
      $column_width_prefix = $settings
        ->getColumnPrefix();
    }
    $row_id = uniqid();
    $columns = [];
    for ($i = 1; $i <= $column_count; $i++) {
      $column_id = uniqid();
      $edit_column = $this
        ->getEditColumnLink($this
        ->id(), $row_id, $column_id);
      $delete_column = $this
        ->getDeleteColumnLink($this
        ->id(), $row_id, $column_id);
      $columns[] = [
        Constants::EDIT_COLUMN => $edit_column,
        Constants::DELETE_COLUMN => $delete_column,
        Constants::COLUMN_ID => $column_id,
        Constants::COLUMN_WIDTH_NUMBER => $last_column_class,
        Constants::COLUMN_WIDTH_PREFIX => $column_width_prefix,
        Constants::DEFAULT_COLUMN_CLASS => $this->default_column_class,
        Constants::CUSTOM_COLUMN_CLASSES => [],
        Constants::COLUMN_NAME => '',
        Constants::REGION_NAME => 'r' . $row_id . 'c' . $column_id,
        Constants::ADMIN_COLUMN_CLASSES => [
          Constants::DYNAMIC_LAYOUT_COLUMN,
        ],
      ];
    }

    // Add new row.
    $rows[] = [
      Constants::ROW_ID => $row_id,
      'admin_row_classes' => [
        'dynamic-layout-row',
      ],
      Constants::DEFAULT_ROW_CLASS => $this->default_row_class,
      Constants::CUSTOM_ROW_CLASSES => [],
      Constants::COLUMNS => $columns,
    ];
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  public function addStartingRows($general_settings) {
    $rows_count = 1;
    if (isset($general_settings['start_rows_count'])) {
      $rows_count = $general_settings['start_rows_count'];
    }

    // Set the default column class for the starting rows.
    $starting_default_column_class = '';
    if (isset($general_settings[Constants::DEFAULT_COLUMN_CLASS]) && $general_settings[Constants::DEFAULT_COLUMN_CLASS]) {
      $starting_default_column_class = \trim($general_settings[Constants::DEFAULT_COLUMN_CLASS]);
      $this->default_column_class = $starting_default_column_class;
    }

    // Set the default row class for the starting rows.
    $starting_default_row_class = '';
    if (isset($general_settings[Constants::DEFAULT_ROW_CLASS]) && $general_settings[Constants::DEFAULT_ROW_CLASS]) {
      $starting_default_row_class = \trim($general_settings[Constants::DEFAULT_ROW_CLASS]);
      $this->default_row_class = $starting_default_row_class;
    }

    /** @var \Drupal\dynamic_layouts\DynamicLayoutSettingsInterface $settings */
    $last_column_class = '';
    $column_width_prefix = '';
    if ($settings = \Drupal::entityTypeManager()
      ->getStorage(Constants::DYNAMIC_LAYOUT_SETTINGS)
      ->load(Constants::SETTINGS)) {
      $column_width_prefix = $settings
        ->getColumnPrefix();
      $column_classes = array_keys($settings
        ->getFrontendColumnClasses());
      $last_column_class = end($column_classes);
    }

    // Add new rows.
    $rows = [];
    for ($i = 1; $i <= $rows_count; $i++) {
      $row_id = uniqid();
      $column_id = uniqid();
      $columns = [];
      $edit_column = $this
        ->getEditColumnLink($this
        ->id(), $row_id, $column_id);
      $delete_column = $this
        ->getDeleteColumnLink($this
        ->id(), $row_id, $column_id);
      $columns[] = [
        Constants::EDIT_COLUMN => $edit_column,
        Constants::DELETE_COLUMN => $delete_column,
        Constants::COLUMN_ID => $column_id,
        Constants::COLUMN_WIDTH_NUMBER => $last_column_class,
        Constants::COLUMN_WIDTH_PREFIX => $column_width_prefix,
        Constants::DEFAULT_COLUMN_CLASS => $starting_default_column_class,
        Constants::CUSTOM_COLUMN_CLASSES => [],
        Constants::COLUMN_NAME => '',
        Constants::REGION_NAME => 'r' . $row_id . 'c' . $column_id,
        Constants::ADMIN_COLUMN_CLASSES => [
          Constants::DYNAMIC_LAYOUT_COLUMN,
        ],
      ];
      $rows[] = [
        Constants::ROW_ID => $row_id,
        Constants::DEFAULT_ROW_CLASS => $starting_default_row_class,
        'admin_row_classes' => [
          'dynamic-layout-row',
        ],
        Constants::CUSTOM_ROW_CLASSES => [],
        Constants::COLUMNS => $columns,
      ];
    }
    $this->regions = serialize($rows);
    $this
      ->save();
  }

  /**
   * {@inheritdoc}
   */
  private function getDeleteColumnLink($entity_id, $row_id, $column_id) {
    $delete_column_url = Url::fromRoute('dynamic_layouts.delete_column', [
      Constants::COLUMN_ID => $column_id,
      'dynamic_layout_id' => $entity_id,
      Constants::ROW_ID => $row_id,
    ]);
    $title = t('Delete column');
    $link_options = [
      'attributes' => [
        'class' => [
          'delete-link',
          'btn',
          'use-ajax',
        ],
        'title' => $title,
      ],
    ];
    $delete_column_url
      ->setOptions($link_options);
    $delete_column_link = Link::fromTextAndUrl($title, $delete_column_url);
    $delete_column = $delete_column_link
      ->toRenderable();
    return render($delete_column);
  }

  /**
   * {@inheritdoc}
   */
  private function getEditColumnLink($entity_id, $row_id, $column_id) {
    $edit_column_url = Url::fromRoute('dynamic_layouts.edit_column_modal_form', [
      Constants::COLUMN_ID => $column_id,
      'entity_id' => $entity_id,
      Constants::ROW_ID => $row_id,
    ]);
    $title = t('Edit column');
    $link_options = [
      'attributes' => [
        'class' => [
          'edit-link',
          'btn',
          'use-ajax',
        ],
        'title' => $title,
      ],
    ];
    $edit_column_url
      ->setOptions($link_options);
    $edit_column_link = Link::fromTextAndUrl($title, $edit_column_url);
    $edit_column = $edit_column_link
      ->toRenderable();
    return render($edit_column);
  }

  /**
   * Render a link to add a column to a row.
   *
   * @param int $row_id
   *   The specific row id.
   * @param string $route
   *   The route we need to render the link to.
   * @param string $text
   *   The text we want to render in the link.
   * @param array $options
   *   Give options to the link.
   *
   * @return string
   *   The rendered link.
   */
  public function getRowLink($row_id, $route, $text, array $options = []) {
    $link = Link::createFromRoute($text, $route, [
      'dynamic_layout_id' => $this
        ->id(),
      Constants::ROW_ID => $row_id,
    ], $options);
    $renderLink = $link
      ->toRenderable();
    return render($renderLink);
  }

  /**
   * {@inheritdoc}
   */
  public function deleteColumn($row_id, $column_id) {
    $updated_row = $this
      ->getRowById($row_id);
    $columns = $updated_row[Constants::COLUMNS];

    /** @var \Drupal\dynamic_layouts\DynamicLayoutSettingsInterface $settings */
    $calculated_column_width_number = NULL;
    if ($settings = \Drupal::entityTypeManager()
      ->getStorage(Constants::DYNAMIC_LAYOUT_SETTINGS)
      ->load(Constants::SETTINGS)) {
      $calculated_column_width_number = $this
        ->calculateColumnWidth($columns, $settings, 'deleted');
    }

    // Loop over the columns and set the updated column.
    foreach ($columns as $key => $column) {
      if ($column[Constants::COLUMN_ID] == $column_id) {
        unset($columns[$key]);
        continue;
      }
      if ($calculated_column_width_number && !isset($column[Constants::CUSTOM_COLUMN_WIDTH_NUMBER])) {
        $columns[$key][Constants::COLUMN_WIDTH_NUMBER] = $calculated_column_width_number;
      }
    }

    // Loop over the rows and find the corresponding row number.
    $rows = $this
      ->getRows();
    foreach ($rows as $key => $row) {
      if ($row[Constants::ROW_ID] == $row_id) {
        $rows[$key][Constants::COLUMNS] = $columns;
      }
    }
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  public function addColumn($row_id) {
    $updated_row = $this
      ->getRowById($row_id);
    $columns = $updated_row[Constants::COLUMNS];
    $column_id = uniqid();
    $column_width_number = '';
    $edit_column = $this
      ->getEditColumnLink($this
      ->id(), $row_id, $column_id);
    $delete_column = $this
      ->getDeleteColumnLink($this
      ->id(), $row_id, $column_id);

    /** @var \Drupal\dynamic_layouts\DynamicLayoutSettingsInterface $settings */
    $column_width_prefix = '';
    if ($settings = \Drupal::entityTypeManager()
      ->getStorage(Constants::DYNAMIC_LAYOUT_SETTINGS)
      ->load(Constants::SETTINGS)) {
      $column_classes = $settings
        ->getFrontendColumnClasses();
      $column_width_number = end($column_classes);
      $column_width_prefix = $settings
        ->getColumnPrefix();
      if ($calculated_column_width_number = $this
        ->calculateColumnWidth($columns, $settings, 'added')) {
        $column_width_number = $calculated_column_width_number;

        // Give each column this column width number.
        foreach ($columns as $key => $column) {
          if (!isset($column[Constants::CUSTOM_COLUMN_WIDTH_NUMBER])) {
            $columns[$key][Constants::COLUMN_WIDTH_NUMBER] = $calculated_column_width_number;
          }
        }
      }
    }
    $columns[] = [
      Constants::EDIT_COLUMN => $edit_column,
      Constants::DELETE_COLUMN => $delete_column,
      Constants::COLUMN_ID => $column_id,
      Constants::COLUMN_WIDTH_NUMBER => $column_width_number,
      Constants::COLUMN_WIDTH_PREFIX => $column_width_prefix,
      Constants::DEFAULT_COLUMN_CLASS => $this->default_column_class,
      Constants::CUSTOM_COLUMN_CLASSES => [],
      Constants::COLUMN_NAME => '',
      Constants::REGION_NAME => 'r' . $row_id . 'c' . $column_id,
      Constants::ADMIN_COLUMN_CLASSES => [
        Constants::DYNAMIC_LAYOUT_COLUMN,
      ],
    ];

    // Loop over the rows and find the corresponding row number.
    $rows = $this
      ->getRows();
    foreach ($rows as $key => $row) {
      if ($row[Constants::ROW_ID] == $row_id) {
        $rows[$key][Constants::COLUMNS] = $columns;
      }
    }
    $this->regions = serialize($rows);
  }

  /**
   * {@inheritdoc}
   */
  private function calculateColumnWidth($columns, DynamicLayoutSettingsInterface $settings, $action) {
    if (!$settings) {
      return NULL;
    }
    if (!$columns) {
      return NULL;
    }

    // Count the column's that dont have a custom column width number.
    $column_counter = 0;
    foreach ($columns as $column) {
      if (!isset($column[Constants::CUSTOM_COLUMN_WIDTH_NUMBER])) {
        $column_counter++;
      }
    }

    // Get the frontend library & column count and add/remove 1.
    $column_count = $column_counter + 1;
    if ($action == 'deleted') {
      $column_count = $column_counter - 1;
    }

    // Convert to integer, just to be sure.
    $grid_column_count = \intval($settings
      ->getGridColumnCount());

    // Divide the column count by grid column count.
    return \round($grid_column_count / $column_count);
  }

  /**
   * {@inheritdoc}
   */
  public function getRows() {
    return unserialize($this->regions);
  }

  /**
   * {@inheritdoc}
   */
  public function getLayoutRegions() {
    $rows = $this
      ->getRows();

    // Loop over the rows to gather the layout regions.
    $layout_regions = [];
    $row_count = 1;
    foreach ($rows as $row) {

      // Check if we have columns.
      if (!isset($row[Constants::ROW_ID]) || !isset($row[Constants::COLUMNS])) {
        continue;
      }

      // Loop over the columns from this row.
      $column_count = 1;
      foreach ($row[Constants::COLUMNS] as $column) {
        $region_name = t('Row @row_count - Column @column_count', [
          '@row_count' => $row_count,
          '@column_count' => $column_count,
        ]);
        $region_machine_name = 'r' . $row[Constants::ROW_ID] . 'c' . $column[Constants::COLUMN_ID];
        if (isset($column[Constants::COLUMN_NAME]) && $column[Constants::COLUMN_NAME]) {
          $region_name = $column[Constants::COLUMN_NAME];

          // Convert to machine name.
          $region_machine_name = strtolower($region_name);
          $region_machine_name = preg_replace('/[^a-z0-9_]+/', '_', $region_machine_name);
          $region_machine_name = preg_replace('/_+/', '_', $region_machine_name);

          // Overwrite if we have a region name.
          if (isset($column[Constants::REGION_NAME]) && $column[Constants::REGION_NAME]) {
            $region_machine_name = $column[Constants::REGION_NAME];
          }
        }
        $layout_regions[$region_machine_name] = [
          'label' => $region_name,
        ];
        $column_count++;
      }
      $row_count++;
    }
    return $layout_regions;
  }

  /**
   * {@inheritdoc}
   */
  private function getRowById($row_id) {
    $rows = $this
      ->getRows();
    $row_by_number = [];

    // Loop over the rows.
    foreach ($rows as $row) {
      if ($row[Constants::ROW_ID] === $row_id) {
        $row_by_number = $row;
      }
    }
    return $row_by_number;
  }

  /**
   * {@inheritdoc}
   */
  private function getColumnById($row, $column_id) {
    $column_by_id = [];

    // Loop over the row columns.
    foreach ($row[Constants::COLUMNS] as $column) {
      if ($column[Constants::COLUMN_ID] === $column_id) {
        $column_by_id = $column;
      }
    }
    return $column_by_id;
  }

  /**
   * {@inheritdoc}
   */
  public function getIconMap() {
    $icon_map = [];
    $rows = $this
      ->getRows();
    foreach ($rows as $key => $row) {
      $icon_map[$key] = [];
      if (isset($row[Constants::COLUMNS]) && !empty(Constants::COLUMNS)) {
        $columns = $row[Constants::COLUMNS];
        foreach ($columns as $column) {
          $column_width_number = $column[Constants::COLUMN_WIDTH_NUMBER];
          if (isset($column[Constants::CUSTOM_COLUMN_WIDTH_NUMBER]) && !empty($column[Constants::CUSTOM_COLUMN_WIDTH_NUMBER])) {
            $column_width_number = $column[Constants::CUSTOM_COLUMN_WIDTH_NUMBER];
          }
          for ($i = 1; $i <= $column_width_number; $i++) {
            $icon_map[$key][] = $column[Constants::COLUMN_ID];
          }
        }
      }
    }
    return array_values($icon_map);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
ConfigEntityBase::$isUninstalling private property Whether the config is being deleted by the uninstall process.
ConfigEntityBase::$langcode protected property The language code of the entity's default language.
ConfigEntityBase::$originalId protected property The original ID of the configuration entity.
ConfigEntityBase::$status protected property The enabled/disabled status of the configuration entity. 4
ConfigEntityBase::$third_party_settings protected property Third party entity settings.
ConfigEntityBase::$trustedData protected property Trust supplied data and not use configuration schema on save.
ConfigEntityBase::$uuid protected property The UUID for this entity.
ConfigEntityBase::$_core protected property Information maintained by Drupal core about configuration.
ConfigEntityBase::addDependency protected function Overrides \Drupal\Core\Entity\DependencyTrait:addDependency().
ConfigEntityBase::calculateDependencies public function Calculates dependencies and stores them in the dependency property. Overrides ConfigEntityInterface::calculateDependencies 13
ConfigEntityBase::createDuplicate public function Creates a duplicate of the entity. Overrides EntityBase::createDuplicate 1
ConfigEntityBase::disable public function Disables the configuration entity. Overrides ConfigEntityInterface::disable 1
ConfigEntityBase::enable public function Enables the configuration entity. Overrides ConfigEntityInterface::enable
ConfigEntityBase::get public function Returns the value of a property. Overrides ConfigEntityInterface::get
ConfigEntityBase::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityBase::getCacheTagsToInvalidate 1
ConfigEntityBase::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityBase::getConfigDependencyName
ConfigEntityBase::getConfigManager protected static function Gets the configuration manager.
ConfigEntityBase::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityBase::getConfigTarget
ConfigEntityBase::getDependencies public function Gets the configuration dependencies. Overrides ConfigEntityInterface::getDependencies
ConfigEntityBase::getOriginalId public function Gets the original ID. Overrides EntityBase::getOriginalId
ConfigEntityBase::getThirdPartyProviders public function Gets the list of third parties that store information. Overrides ThirdPartySettingsInterface::getThirdPartyProviders
ConfigEntityBase::getThirdPartySetting public function Gets the value of a third-party setting. Overrides ThirdPartySettingsInterface::getThirdPartySetting
ConfigEntityBase::getThirdPartySettings public function Gets all third-party settings of a given module. Overrides ThirdPartySettingsInterface::getThirdPartySettings
ConfigEntityBase::getTypedConfig protected function Gets the typed config manager.
ConfigEntityBase::hasTrustedData public function Gets whether on not the data is trusted. Overrides ConfigEntityInterface::hasTrustedData
ConfigEntityBase::invalidateTagsOnDelete protected static function Override to never invalidate the individual entities' cache tags; the config system already invalidates them. Overrides EntityBase::invalidateTagsOnDelete
ConfigEntityBase::invalidateTagsOnSave protected function Override to never invalidate the entity's cache tag; the config system already invalidates it. Overrides EntityBase::invalidateTagsOnSave
ConfigEntityBase::isInstallable public function Checks whether this entity is installable. Overrides ConfigEntityInterface::isInstallable 2
ConfigEntityBase::isNew public function Overrides Entity::isNew(). Overrides EntityBase::isNew
ConfigEntityBase::isUninstalling public function Returns whether this entity is being changed during the uninstall process. Overrides ConfigEntityInterface::isUninstalling
ConfigEntityBase::link public function Deprecated way of generating a link to the entity. See toLink(). Overrides EntityBase::link
ConfigEntityBase::onDependencyRemoval public function Informs the entity that entities it depends on will be deleted. Overrides ConfigEntityInterface::onDependencyRemoval 7
ConfigEntityBase::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides EntityBase::preDelete 8
ConfigEntityBase::preSave public function Acts on an entity before the presave hook is invoked. Overrides EntityBase::preSave 13
ConfigEntityBase::save public function Saves an entity permanently. Overrides EntityBase::save 1
ConfigEntityBase::set public function Sets the value of a property. Overrides ConfigEntityInterface::set
ConfigEntityBase::setOriginalId public function Sets the original ID. Overrides EntityBase::setOriginalId
ConfigEntityBase::setStatus public function Sets the status of the configuration entity. Overrides ConfigEntityInterface::setStatus
ConfigEntityBase::setThirdPartySetting public function Sets the value of a third-party setting. Overrides ThirdPartySettingsInterface::setThirdPartySetting
ConfigEntityBase::setUninstalling public function
ConfigEntityBase::sort public static function Helper callback for uasort() to sort configuration entities by weight and label. 6
ConfigEntityBase::status public function Returns whether the configuration entity is enabled. Overrides ConfigEntityInterface::status 4
ConfigEntityBase::toArray public function Gets an array of all property values. Overrides EntityBase::toArray 2
ConfigEntityBase::toUrl public function Gets the URL object for the entity. Overrides EntityBase::toUrl
ConfigEntityBase::trustData public function Sets that the data should be trusted. Overrides ConfigEntityInterface::trustData
ConfigEntityBase::unsetThirdPartySetting public function Unsets a third-party setting. Overrides ThirdPartySettingsInterface::unsetThirdPartySetting
ConfigEntityBase::url public function Gets the public URL for this entity. Overrides EntityBase::url
ConfigEntityBase::urlInfo public function Gets the URL object for the entity. Overrides EntityBase::urlInfo
ConfigEntityBase::__construct public function Constructs an Entity object. Overrides EntityBase::__construct 10
ConfigEntityBase::__sleep public function Overrides EntityBase::__sleep 4
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function Aliased as: traitSleep 1
DependencySerializationTrait::__wakeup public function 2
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency. Aliased as: addDependencyTrait
DynamicLayout::$category public property The category of this layout.
DynamicLayout::$default_column_class public property The default column class.
DynamicLayout::$default_row_class public property The default row class.
DynamicLayout::$id public property The layout machine name.
DynamicLayout::$label public property The human readable name of this layout.
DynamicLayout::$regions public property The regions of this layout.
DynamicLayout::$weight public property The position weight (not physical) of this layout.
DynamicLayout::addColumn public function Add a column to a row. Overrides DynamicLayoutInterface::addColumn
DynamicLayout::addRow public function Add a row to the layout. Overrides DynamicLayoutInterface::addRow
DynamicLayout::addStartingRows public function Add multiple rows to the layout. Overrides DynamicLayoutInterface::addStartingRows
DynamicLayout::calculateColumnWidth private function
DynamicLayout::deleteColumn public function Delete a specific column from the layout. Overrides DynamicLayoutInterface::deleteColumn
DynamicLayout::deleteRow public function Delete a specific row from the layout. Overrides DynamicLayoutInterface::deleteRow
DynamicLayout::getCategory public function Get the layout category. Overrides DynamicLayoutInterface::getCategory
DynamicLayout::getColumnById private function
DynamicLayout::getColumnClasses public function Get the layout column classes, comma separated. Overrides DynamicLayoutInterface::getColumnClasses
DynamicLayout::getColumnName public function Get the layout column name. Overrides DynamicLayoutInterface::getColumnName
DynamicLayout::getColumnWidthNumber public function Set the column width number. Overrides DynamicLayoutInterface::getColumnWidthNumber
DynamicLayout::getDefaultColumnClass public function Get the default column class. Overrides DynamicLayoutInterface::getDefaultColumnClass
DynamicLayout::getDefaultRowClass public function Get the default row class. Overrides DynamicLayoutInterface::getDefaultRowClass
DynamicLayout::getDeleteColumnLink private function
DynamicLayout::getEditColumnLink private function
DynamicLayout::getIconMap public function Get the icon map for this layout. Overrides DynamicLayoutInterface::getIconMap
DynamicLayout::getLayoutRegions public function Get all layout regions. Overrides DynamicLayoutInterface::getLayoutRegions
DynamicLayout::getRegions public function Get the layout regions. Overrides DynamicLayoutInterface::getRegions
DynamicLayout::getRowById private function
DynamicLayout::getRowClasses public function Get the layout row classes, comma separated. Overrides DynamicLayoutInterface::getRowClasses
DynamicLayout::getRowLink public function Render a link to add a column to a row.
DynamicLayout::getRows public function Get the unserialized rows. Overrides DynamicLayoutInterface::getRows
DynamicLayout::setColumnName public function Set the layout column classes. Overrides DynamicLayoutInterface::setColumnName
DynamicLayout::setCustomColumnClasses public function Set the layout column classes. Overrides DynamicLayoutInterface::setCustomColumnClasses
DynamicLayout::setCustomColumnWidthNumber public function Set the custom column width number. Overrides DynamicLayoutInterface::setCustomColumnWidthNumber
DynamicLayout::setDefaultColumnClass public function Set the default column class. Overrides DynamicLayoutInterface::setDefaultColumnClass
DynamicLayout::setDefaultRowClass public function Set the default row class. Overrides DynamicLayoutInterface::setDefaultRowClass
DynamicLayout::setRowClasses public function Set the layout row classes. Overrides DynamicLayoutInterface::setRowClasses
EntityBase::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
EntityBase::$entityTypeId protected property The entity type.
EntityBase::$typedData protected property A typed data object wrapping this entity.
EntityBase::access public function Checks data value access. Overrides AccessibleInterface::access 1
EntityBase::bundle public function Gets the bundle of the entity. Overrides EntityInterface::bundle 1
EntityBase::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
EntityBase::delete public function Deletes an entity permanently. Overrides EntityInterface::delete 2
EntityBase::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
EntityBase::entityManager Deprecated protected function Gets the entity manager.
EntityBase::entityTypeBundleInfo protected function Gets the entity type bundle info service.
EntityBase::entityTypeManager protected function Gets the entity type manager.
EntityBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyTrait::getCacheContexts
EntityBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyTrait::getCacheMaxAge
EntityBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyTrait::getCacheTags
EntityBase::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
EntityBase::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
EntityBase::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
EntityBase::getListCacheTagsToInvalidate protected function The list cache tags to invalidate for this entity.
EntityBase::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
EntityBase::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
EntityBase::id public function Gets the identifier. Overrides EntityInterface::id 11
EntityBase::label public function Gets the label of the entity. Overrides EntityInterface::label 6
EntityBase::language public function Gets the language of the entity. Overrides EntityInterface::language 1
EntityBase::languageManager protected function Gets the language manager.
EntityBase::linkTemplates protected function Gets an array link templates. 1
EntityBase::load public static function Loads an entity. Overrides EntityInterface::load
EntityBase::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
EntityBase::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityInterface::postCreate 4
EntityBase::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface::postDelete 16
EntityBase::postLoad public static function Acts on loaded entities. Overrides EntityInterface::postLoad 2
EntityBase::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides EntityInterface::postSave 14
EntityBase::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate 5
EntityBase::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityInterface::referencedEntities 1
EntityBase::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
EntityBase::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
EntityBase::urlRouteParameters protected function Gets an array of placeholders for this entity. 2
EntityBase::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface::uuid 1
EntityBase::uuidGenerator protected function Gets the UUID generator.
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance.
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. 1
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
SynchronizableEntityTrait::$isSyncing protected property Whether this entity is being created, updated or deleted through a synchronization process.
SynchronizableEntityTrait::isSyncing public function
SynchronizableEntityTrait::setSyncing public function