class DefaultFactory

Implements an IFactory by providing default products.

It provides a StubBlockView as IBlockView product for those IProject implementations that don't intend to use a block, even though a block is provided (in such cases usually hidden).

Mostly a real-world IProject implementation should instead use a factory that extends AbstractFactory and provides a block view of use to that project.

This default project is provided so that there is at least a concrete factory implementation that can be used by demos.

UML: DefaultFactory

Visit also: Abstract factory pattern

@author darrenkelly

Hierarchy

Expanded class hierarchy of DefaultFactory

1 file declares its use of DefaultFactory
DefaultModuleHelper.php in lib/Drupal/ooe/Module/DefaultModuleHelper.php
DefaultModuleHelper

File

lib/Drupal/ooe/Factory/DefaultFactory.php, line 36
DefaultFactory

Namespace

Drupal\ooe\Factory
View source
class DefaultFactory extends AbstractFactory {

  /**
   * Constructor.
   *
   * @todo Consider inject instead IModule
   *
   * @param string $moduleName
   *   The module machine name
   */
  public function __construct($moduleName) {
    parent::__construct($moduleName);
  }

  /**
   * Provides a new @link StubBlockView @endlink as a block view product.
   *
   * An @link IProject @endlink implementation that requires a
   * specific block view could use a factory that
   * overrides this with a more suitable block view,
   * or could instead provide a factory that extends
   * @link AbstractFactory @endlink and provides
   * a block view suitable for that project.
   *
   * @param IBlock $block
   *   The block for which this acts as a view.
   * @param string $subject
   *   The subject of the block. Translated !
   *
   * @return \Drupal\ooe\Block\IBlockView
   *   A stub block with stub content.
   */
  public function newBlockView(IBlock $block, $subject) {
    return new StubBlockView($block, $subject);
  }

}

Members

Contains filters are case sensitive
Namesort descending Modifiers Type Description
AbstractFactory::$moduleName private property The module machine name.
AbstractFactory::getModuleName public function The module machine name. Overrides IFactory::getModuleName
AbstractFactory::newAdminMenuItem public function Supplies a new AdminMenuItem as product. Overrides IFactory::newAdminMenuItem
AbstractFactory::newBlock public function Supplies a new DefaultBlock as product. Overrides IFactory::newBlock
AbstractFactory::newBlockSet public function Supplies a new BlockSet as product. Overrides IFactory::newBlockSet
AbstractFactory::newFormMenuItem public function Supplies a new FormMenuItem as product. Overrides IFactory::newFormMenuItem
AbstractFactory::newMenuItem public function Supplies a new DefaultMenuItem as product. Overrides IFactory::newMenuItem
AbstractFactory::newMenuItemSet public function Supplies a new MenuItemSet as product. Overrides IFactory::newMenuItemSet
AbstractFactory::newMenuTabs public function Supplies a new MenuTabs as product. Overrides IFactory::newMenuTabs
AbstractFactory::newPageMenuItem public function Supplies a new PageMenuItem as product. Overrides IFactory::newPageMenuItem
AbstractFactory::newRegion public function Supplies a new DefaultRegion as product. Overrides IFactory::newRegion
AbstractFactory::setModuleName private function Sets the module machine name.
DefaultFactory::newBlockView public function Provides a new StubBlockView as a block view product. Overrides IFactory::newBlockView
DefaultFactory::__construct public function Constructor. Overrides AbstractFactory::__construct