interface IFactory

Interface for factories for common Drupal concepts like menu items, blocks, block views and theme regions.

Because the factory has knowledge of the module machine name, the signatures of the creation methods are more concise than the matching constructors of the classes for some products (do not have to include the module machine name as a parameter). This is a very simple example of the kind of "policy" value adding a factory can offer.

UML: IFactory

Visit also:

Abstract factory pattern

IRenderFactory

@author darrenkelly

Hierarchy

Expanded class hierarchy of IFactory

All classes that implement IFactory

6 files declare their use of IFactory
AbstractFactory.php in lib/Drupal/ooe/Factory/AbstractFactory.php
AbstractFactory
AbstractPageController.php in lib/Drupal/ooe/Page/AbstractPageController.php
AbstractPageController
AbstractProject.php in lib/Drupal/ooe/Project/AbstractProject.php
AbstractProject
DefaultModuleHelper.php in lib/Drupal/ooe/Module/DefaultModuleHelper.php
DefaultModuleHelper
DemoOfMenuTabs.php in lib/Drupal/ooe/Demo/Tabs/DemoOfMenuTabs.php
DemoOfMenuTabs

... See full list

File

lib/Drupal/ooe/Factory/IFactory.php, line 34
IFactory

Namespace

Drupal\ooe\Factory
View source
interface IFactory {

  /**
   * Gets the module machine name.
   *
   * @return string
   *   The module machine name.
   */
  public function getModuleName();

  /**
   * Supplies a basic menu item product.
   *
   * @param string $title
   *   Required.
   * @param string $path
   *   Required.
   *
   * @return \Drupal\ooe\Menu\IMenuItem
   *   A new menu item.
   */
  public function newMenuItem($title, $path);

  /**
   * Supplies a controlled page menu item product.
   *
   * @param IPageController $pageController
   *   Required. The controller for the page.
   * @param string $title
   *   Required. The title of the menu item.
   * @param string $path
   *   Required. The path of the menu item.
   *
   * @return \Drupal\ooe\Page\IPageMenuItem
   *   A new page menu item.
   */
  public function newPageMenuItem(IPageController $pageController, $title, $path);

  /**
   * Supplies an admin menu item product.
   *
   * @param string $title
   *   Required. The title of the menu item.
   * @param string $path
   *   Required. The path of the menu item.
   *
   * @return \Drupal\ooe\Menu\IMenuItem
   *   A new menu item.
   */
  public function newAdminMenuItem($title, $path);

  /**
   * Supplies a form menu item product.
   *
   * @param string $title
   *   The title.
   * @param string $path
   *   The path.
   *
   * @return \Drupal\ooe\Form\IFormMenuItem
   *   A new form menu item.
   */
  public function newFormMenuItem($title, $path);

  /**
   * Supplies a block set/group product.
   *
   * @return \Drupal\ooe\Block\IBlockSet
   *   A new block set.
   */
  public function newBlockSet();

  /**
   * Supplies a block view product.
   *
   * @todo Consider moving the subject into the block.
   *
   * @param IBlock $block
   *   The block for which this block view products acts as a view.
   * @param string $subject
   *   The subject of the block view. Translated !
   *
   * @return \Drupal\ooe\Block\IBlockView
   *   A new block view.
   */
  public function newBlockView(IBlock $block, $subject);

  /**
   * Supplies a block product.
   *
   * @param string $delta
   *   Required. The block delta identifier.
   * @param string $info
   *   Required. Translated ! The block info. From hook_block_info():
   *   'The human-readable administrative name of the block.'
   *
   * @return \Drupal\ooe\Block\IBlock
   *   A new block.
   */
  public function newBlock($delta, $info);

  /**
   * Supplies a menu item set/group product.
   *
   * @return \Drupal\ooe\Menu\IMenuItemSet
   *   A new menu item set.
   */
  public function newMenuItemSet();

  /**
   * Supplies a theme region product.
   *
   * It is recommended that the name be obtained via
   * a class that encapsulates constants representing
   * the names of regions for a given theme.
   *
   * @see \Drupal\ooe\Theme\BartikRegions
   *
   * @param string $name
   *   A non-null name that identifies the layout region.
   *
   * @return \Drupal\ooe\Layout\IRegion
   *   A new layout region.
   */
  public function newRegion($name);

  /**
   * Supplies a new @link MenuTabs @endlink as product.
   *
   * Configured
   * with the base page controller that will act for the base
   * page and the 1st tab.
   *
   * @param string $path
   *   Required. The path of the primary page menu item.
   * @param IPageController $pageControllerBase
   *   Required. The page controller for the primary page.
   * @param string $title
   *   Required. The title of primary page menu item.
   *
   * @return \Drupal\ooe\Menu\IMenuTabs
   *   A new menu tabs.
   */
  public function newMenuTabs($path, IPageController $pageControllerBase, $title);
}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
IFactory::getModuleName public function Gets the module machine name.
IFactory::newAdminMenuItem public function Supplies an admin menu item product.
IFactory::newBlock public function Supplies a block product.
IFactory::newBlockSet public function Supplies a block set/group product.
IFactory::newBlockView public function Supplies a block view product.
IFactory::newFormMenuItem public function Supplies a form menu item product.
IFactory::newMenuItem public function Supplies a basic menu item product.
IFactory::newMenuItemSet public function Supplies a menu item set/group product.
IFactory::newMenuTabs public function Supplies a new MenuTabs as product.
IFactory::newPageMenuItem public function Supplies a controlled page menu item product.
IFactory::newRegion public function Supplies a theme region product.