FOF30\Factory\SwitchFactory::toolbar PHP Method

toolbar() public method

Creates a new Toolbar
public toolbar ( array $config = [] ) : Toolbar
$config array The configuration values for the Toolbar object
return FOF30\Toolbar\Toolbar
    public function toolbar(array $config = array())
    {
        $toolbarClass = $this->container->getNamespacePrefix($this->getSection()) . 'Toolbar\\Toolbar';
        try {
            return $this->createToolbar($toolbarClass, $config);
        } catch (ToolbarNotFound $e) {
            // Not found. Let's go on.
        }
        $toolbarClass = $this->container->getNamespacePrefix('inverse') . 'Toolbar\\Toolbar';
        try {
            return $this->createToolbar($toolbarClass, $config);
        } catch (ToolbarNotFound $e) {
            // Not found. Return the default Toolbar
            return new Toolbar($this->container, $config);
        }
    }

Usage Example

Beispiel #1
0
 /**
  * @group           SwitchFactory
  * @covers          FOF30\Factory\SwitchFactory::toolbar
  * @dataProvider    SwitchFactoryDataprovider::getTestToolbar
  */
 public function testToolbar($test, $check)
 {
     $msg = 'SwitchFactory::toolbar %s - Case: ' . $check['case'];
     $container = new TestContainer(array('componentName' => $test['component']));
     $platform = $container->platform;
     $platform::$isAdmin = $test['backend'];
     $factory = new SwitchFactory($container);
     $result = $factory->toolbar();
     $this->assertEquals($check['result'], get_class($result), sprintf($msg, 'Returned the wrong result'));
 }
All Usage Examples Of FOF30\Factory\SwitchFactory::toolbar