You are here

interface TBMegaMenuBuilderInterface in The Better Mega Menu 8

Same name and namespace in other branches
  1. 2.x src/TBMegaMenuBuilderInterface.php \Drupal\tb_megamenu\TBMegaMenuBuilderInterface

Provides an interface defining a TB MegaMenu builder.

Hierarchy

Expanded class hierarchy of TBMegaMenuBuilderInterface

All classes that implement TBMegaMenuBuilderInterface

2 files declare their use of TBMegaMenuBuilderInterface
TBMegaMenuAdminController.php in src/Controller/TBMegaMenuAdminController.php
TBMegaMenuBlock.php in src/Plugin/Block/TBMegaMenuBlock.php

File

src/TBMegaMenuBuilderInterface.php, line 8

Namespace

Drupal\tb_megamenu
View source
interface TBMegaMenuBuilderInterface {

  /**
   * Get the configuration of blocks.
   *
   * @param string $menu_name
   *   Menu Machine name.
   * @param string $theme
   *   Theme machine name.
   *
   * @return array
   *   The block config array
   */
  public function getBlockConfig(string $menu_name, string $theme);

  /**
   * Get menus that belongs TB mega menu.
   *
   * @param string $menu_name
   *   The menu machine name.
   * @param string $theme
   *   The theme machine name.
   *
   * @return \Drupal\tb_megamenu\MegaMenuConfigInterface|null
   *   The configuration entity for this menu or NULL if not found.
   */
  public function getMenus(string $menu_name, string $theme);

  /**
   * Find a menu item.
   *
   * @param string $menu_name
   *   Menu machine name.
   * @param string $plugin_id
   *   The menu item plugin id.
   *
   * @return \Drupal\Core\Menu\MenuLinkTreeElement
   *   The menu item element.
   */
  public function getMenuItem(string $menu_name, string $plugin_id);

  /**
   * Search by menu item.
   *
   * @param array $tree
   *   The menu tree.
   * @param string $plugin_id
   *   The item plugin id.
   *
   * @return \Drupal\Core\Menu\MenuLinkTreeElement
   *   The menu link element.
   */
  public function findMenuItem(array $tree, string $plugin_id);

  /**
   * Load blocks by block_id.
   *
   * @param string $block_id
   *   The block id.
   *
   * @return \Drupal\Core\Entity\EntityInterface|null
   *   The block entity.
   *
   * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
   * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
   */
  public function loadEntityBlock(string $block_id);

  /**
   * Get configuration of menu.
   *
   * @param string $menu_name
   *   The menu machine name.
   * @param string $theme
   *   The theme machine name.
   *
   * @return array|object
   *   The menu configuration info.
   */
  public function getMenuConfig(string $menu_name, string $theme);

  /**
   * Create the default attributes for the configuration of block.
   *
   * @param array $block_config
   *   The block config array to fill with default values.
   */
  public function editBlockConfig(array &$block_config);

  /**
   * Set the default values to configuration in Sub TB Megamenu if it's empty.
   *
   * @param array $submenu_config
   *   The array to fill with default values.
   */
  public function editSubMenuConfig(array &$submenu_config);

  /**
   * Set the default values to configuration in TB Megamenu item if it's empty.
   *
   * @param array $item_config
   *   The array to fill with default values.
   */
  public function editItemConfig(array &$item_config);

  /**
   * Set the default values to configuration in columns if it's empty.
   *
   * @param array $col_config
   *   The array to fill with default values.
   */
  public function editColumnConfig(array &$col_config);

  /**
   * Create block which using tb_megamenu.
   *
   * @param string $menu_name
   *   The menu machine name.
   * @param string $theme
   *   The theme machine name.
   *
   * @return array
   *   The render array.
   */
  public function renderBlock(string $menu_name, string $theme);

  /**
   * Get Id of column.
   *
   * @param int $number_columns
   *   The number of columns.
   *
   * @return string
   *   The column id.
   */
  public function getIdColumn(int $number_columns);

  /**
   * Get all of blocks in system without blocks which belong to TB Mega Menu.
   *
   * In array, each element includes key which is plugin_id and value which is
   * label of block.
   *
   * @staticvar array $_blocks_array
   *
   * @return \Drupal\Core\Entity\EntityTypeInterface[]
   *   An array of block entities or an empty array if none found.
   */
  public function getAllBlocks(string $theme);

  /**
   * Create options for animation.
   *
   * @param array $block_config
   *   The block configuration.
   *
   * @return array
   *   The default block configuration.
   */
  public function createAnimationOptions(array $block_config);

  /**
   * Create options for styles.
   *
   * @param array $block_config
   *   The block configuration.
   *
   * @return array
   *   The options array.
   */
  public function createStyleOptions(array $block_config);

  /**
   * Builds the page trail for marking active items.
   *
   * @param \Drupal\Core\Menu\MenuLinkTreeElement[] $menu_items
   *   The menu items to use.
   */
  public function buildPageTrail(array $menu_items);

  /**
   * Add item config values to menu config array.
   *
   * @param array $menu_items
   *   The menu tree for this config.
   * @param array $menu_config
   *   The menu configuration.
   * @param string $section
   *   The menu section.
   */
  public function syncConfigAll(array $menu_items, array &$menu_config, string $section);

  /**
   * Populate the item_config values.
   *
   * @param array $items
   *   Menu items.
   * @param array $item_config
   *   The item config array to populate.
   * @param string $section
   *   The menu section.
   */
  public function syncConfig(array $items, array &$item_config, string $section);

  /**
   * Add menu item content to a column.
   *
   * @param array $items
   *   All items in the current menu.
   * @param array $item_config
   *   The current configuration for all items.
   */
  public function addColContent(array $items, array &$item_config);

  /**
   * Sync a core menu item with the TB config.
   *
   * @param array $hash
   *   An array of hashes for all menu items based on their positions.
   * @param array $tb_item
   *   The individual menu item.
   * @param int|string $row_delta
   *   The delta for the current row.
   * @param int|string $col_delta
   *   The delta for the current column.
   * @param int|string $item_delta
   *   The delta for the current item.
   * @param array $items
   *   All items in the current menu.
   * @param array $item_config
   *   The current configuration for all items.
   */
  public function syncMenuItem(array &$hash, array $tb_item, $row_delta, $col_delta, $item_delta, array $items, array &$item_config);

  /**
   * Sync a core block with the TB config.
   *
   * @param array $tb_item
   *   The individual menu item.
   * @param int|string $row_delta
   *   The delta for the current row.
   * @param int|string $col_delta
   *   The delta for the current column.
   * @param int|string $item_delta
   *   The delta for the current item.
   * @param string $section
   *   The portion of the configuration to sync.
   * @param array $item_config
   *   The current configuration for all items.
   */
  public function syncBlock(array $tb_item, $row_delta, $col_delta, $item_delta, string $section, array &$item_config);

  /**
   * Remove a column from the TB config.
   *
   * @param array $tb_item
   *   The individual menu item.
   * @param int|string $row_delta
   *   The delta for the current row.
   * @param int|string $col_delta
   *   The delta for the current column.
   * @param int|string $item_delta
   *   The delta for the current item.
   * @param array $item_config
   *   The current configuration for all items.
   */
  public function removeColumn(array $tb_item, $row_delta, $col_delta, $item_delta, array &$item_config);

  /**
   * Insert an enabled link into the TB config.
   *
   * @param array $items
   *   All items in the current menu.
   * @param array $hash
   *   An array of hashes for all menu items based on their positions.
   * @param array $item_config
   *   The current configuration for all items.
   */
  public function insertEnabledLinks(array $items, array $hash, array &$item_config);

  /**
   * Sync order of menu items between menu and tb_megamenus.
   *
   * @param array $menu_config
   *   The menu configuration.
   */
  public function syncOrderMenus(array &$menu_config);

  /**
   * Sort menu items by weight.
   *
   * @param array $item_sorted
   *   The unsorted weights of all menu items.
   *
   * @return array
   *   All weights sorted lowest to highest.
   */
  public function sortByWeight(array $item_sorted);

  /**
   * Test if a block has content or not.
   *
   * @param string $block_id
   *   The block id.
   * @param string $section
   *   The menu section.
   *
   * @return bool
   *   True if empty.
   */
  public function isBlockContentEmpty(string $block_id, string $section);

  /**
   * Insert a menu item into the item config array.
   *
   * @param array $item_config
   *   The item config array.
   * @param int|string $row
   *   The row to insert at.
   * @param int|string $col
   *   The column to insert at.
   * @param object $item
   *   The menu item to insert.
   */
  public function insertTbMenuItem(array &$item_config, $row, $col, object $item);

}

Members

Namesort descending Modifiers Type Description Overrides
TBMegaMenuBuilderInterface::addColContent public function Add menu item content to a column. 1
TBMegaMenuBuilderInterface::buildPageTrail public function Builds the page trail for marking active items. 1
TBMegaMenuBuilderInterface::createAnimationOptions public function Create options for animation. 1
TBMegaMenuBuilderInterface::createStyleOptions public function Create options for styles. 1
TBMegaMenuBuilderInterface::editBlockConfig public function Create the default attributes for the configuration of block. 1
TBMegaMenuBuilderInterface::editColumnConfig public function Set the default values to configuration in columns if it's empty. 1
TBMegaMenuBuilderInterface::editItemConfig public function Set the default values to configuration in TB Megamenu item if it's empty. 1
TBMegaMenuBuilderInterface::editSubMenuConfig public function Set the default values to configuration in Sub TB Megamenu if it's empty. 1
TBMegaMenuBuilderInterface::findMenuItem public function Search by menu item. 1
TBMegaMenuBuilderInterface::getAllBlocks public function Get all of blocks in system without blocks which belong to TB Mega Menu. 1
TBMegaMenuBuilderInterface::getBlockConfig public function Get the configuration of blocks. 1
TBMegaMenuBuilderInterface::getIdColumn public function Get Id of column. 1
TBMegaMenuBuilderInterface::getMenuConfig public function Get configuration of menu. 1
TBMegaMenuBuilderInterface::getMenuItem public function Find a menu item. 1
TBMegaMenuBuilderInterface::getMenus public function Get menus that belongs TB mega menu. 1
TBMegaMenuBuilderInterface::insertEnabledLinks public function Insert an enabled link into the TB config. 1
TBMegaMenuBuilderInterface::insertTbMenuItem public function Insert a menu item into the item config array. 1
TBMegaMenuBuilderInterface::isBlockContentEmpty public function Test if a block has content or not. 1
TBMegaMenuBuilderInterface::loadEntityBlock public function Load blocks by block_id. 1
TBMegaMenuBuilderInterface::removeColumn public function Remove a column from the TB config. 1
TBMegaMenuBuilderInterface::renderBlock public function Create block which using tb_megamenu. 1
TBMegaMenuBuilderInterface::sortByWeight public function Sort menu items by weight. 1
TBMegaMenuBuilderInterface::syncBlock public function Sync a core block with the TB config. 1
TBMegaMenuBuilderInterface::syncConfig public function Populate the item_config values. 1
TBMegaMenuBuilderInterface::syncConfigAll public function Add item config values to menu config array. 1
TBMegaMenuBuilderInterface::syncMenuItem public function Sync a core menu item with the TB config. 1
TBMegaMenuBuilderInterface::syncOrderMenus public function Sync order of menu items between menu and tb_megamenus. 1