teapotHeaderStatus example

class AttachedRenderingBlock extends BlockBase {

  /** * {@inheritdoc} */
  public function build() {
    // Grab test attachment fixtures from     // Drupal\render_attached_test\Controller\RenderAttachedTestController.     $controller = new RenderAttachedTestController();
    $attached = BubbleableMetadata::mergeAttachments($controller->feed()$controller->head());
    $attached = BubbleableMetadata::mergeAttachments($attached$controller->header());
    $attached = BubbleableMetadata::mergeAttachments($attached$controller->teapotHeaderStatus());

    // Return some arbitrary markup so the block doesn't disappear.     $attached['#markup'] = 'Markup from attached_rendering_block.';
    return $attached;
  }

  /** * {@inheritdoc} */
  public function getCacheMaxAge() {
    return Cache::PERMANENT;
  }
Home | Imprint | This part of the site doesn't use cookies.