[uml] Drupal\ooe\Demo\Tabs

HOT TIP: this content is flagged as highly recommended !

Webel module:

Package/Namespace: 

UML element type:

OOE stereotypes:

This package contains an important "anti-example" because it shows you HOW NOT TO DO SOME THINGS in PHP when working with UML-friendly OOE = Object Oriented Examples = One Of Each, and why. Please examine this package overview and then please examine also DemoOfMenuTabs for more details and more code examples. These pages together contain crucial information that explains why the educational OOE = Object Oriented Examples = One Of Each tutorial module is coded as it is.
UML Diagram
Click on the UML diagram to view it in a lightbox image viewer. You may then zoom in (or just open the image in a new web browser tab using the Download Original link to view large diagrams).

UML diagram type:

UML modelling domain:

Please note also, this is a special case giving an overview of an "anti-example"; normally one would not show such detail in a package overview diagram.

Code examples
The constructor code below is an ANTI-EXAMPLE ! Please when working with UML-friendly OOE do not code like this, as the reverse-engineering engine can't "see" what is created on-the-fly and passed (in this case) to the factory ! Prefer instead private class variables and lazy instantiation in dedicated protected on-the-fly creation methods.

From DemoOfMenuTabs:

  public function __construct($module, IFactory $factory = null) {
    parent::__construct($module,$factory);
 
    $path = $module . '/demo/tabs'; //TODO !ENCAPSULATE
    $this->menuTabs = $this->factory()->newMenuTabs(
        $path, 
        new DemoPageControllerMain(),
        //pseudo local page controller is not UML-friendly 
        $this->getModuleDisplayName() . ": Tabs demo"
            );
 
    $this->menuTabs->newTabMenuItem(
            new DemoPageControllerTab2(), 
            //pseudo local page controller is not UML-friendly
            "Tab2"
            );
 
 
    $this->menuTabs->newTabMenuItem(
            new DemoPageControllerTab3(), 
            //pseudo local page controller is not UML-friendly
            "Tab3"
            );    
  }
Demos
Visit also