[uml] IBlock

Webel module:

Package/Namespace: 

UML element type:

OOE stereotypes:

Relationships (inverse)
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:

Refactoring

Consider Enum StatusKind (interim solution, BlockStatusKind with consts)

Consider Visibility enum matching BLOCK_VISIBLITY_.. (interim solution, BlockVisibilityKind with consts)

Consider Cache enum (interim solution, BlockCacheKind with consts)

? how check $cache is bitmask

Iff exactly same Cache options used elsewhere promote to DrupalCacheKind.

Consider addProperty(IProperty)

One would not usually show so many related wrapper Components in an analysis interface diagram, however the Enum-like encapsulators of permitted values for $cache, $visibility, and $status are relevant here. For the moment they are represented as static constant attributes of wrapper Components, however one could also model them as literals of UML Enumerations.

There are many strategies for imitating Enums in PHP , but until a decision is made about which way to go, it at least helps to have some encapsulation of allowed values as shown. See also the code example below:

Code examples
  public function block_info() {
 
    $blockSet = $this->factory()->newBlockSet();
 
    $block_current_posts = $this->factory()->newBlock(
            BLOCK_DELTA_CURRENT_POSTS,
            $this->getModuleDisplayName() . ': Current posts');
    $block_current_posts->setCache(BlockCacheKind::CACHE_PER_ROLE);
    $block_current_posts->setStatus(BlockStatusKind::ENABLED);
    $blockSet->addBlock($block_current_posts);
 
    $block_demo = $this->factory()->newBlock(
            BLOCK_DELTA_DEMO,
            $this->getModuleDisplayName() . ': Demo block');
    $block_demo->setCache(BlockCacheKind::CACHE_PER_ROLE);
    $block_demo->setRegion($this->factory()->newRegion(REGION_SIDEBAR_FIRST));
    $block_demo->setStatus(BlockStatusKind::ENABLED);
    $blockSet->addBlock($block_demo);
 
    return $blockSet->get();
  }
Visit also