class AttachedRenderingBlock
Same name in other branches
- 9 core/modules/system/tests/modules/render_attached_test/src/Plugin/Block/AttachedRenderingBlock.php \Drupal\render_attached_test\Plugin\Block\AttachedRenderingBlock
- 10 core/modules/system/tests/modules/render_attached_test/src/Plugin/Block/AttachedRenderingBlock.php \Drupal\render_attached_test\Plugin\Block\AttachedRenderingBlock
- 11.x core/modules/system/tests/modules/render_attached_test/src/Plugin/Block/AttachedRenderingBlock.php \Drupal\render_attached_test\Plugin\Block\AttachedRenderingBlock
A block we can use to test caching of #attached headers.
Plugin annotation
@Block(
id = "attached_rendering_block",
admin_label = @Translation("AttachedRenderingBlock")
)
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Component\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\ContextAwarePluginInterface
- class \Drupal\Core\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\ContextAwarePluginBase implements \Drupal\Core\Plugin\ContextAwarePluginInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\TypedData\TypedDataTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Core\Block\BlockBase extends \Drupal\Core\Plugin\ContextAwarePluginBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Render\PreviewFallbackInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\render_attached_test\Plugin\Block\AttachedRenderingBlock extends \Drupal\Core\Block\BlockBase
- class \Drupal\Core\Block\BlockBase extends \Drupal\Core\Plugin\ContextAwarePluginBase implements \Drupal\Core\Block\BlockPluginInterface, \Drupal\Core\Plugin\PluginWithFormsInterface, \Drupal\Core\Render\PreviewFallbackInterface uses \Drupal\Core\Block\BlockPluginTrait, \Drupal\Core\Plugin\ContextAwarePluginAssignmentTrait
- class \Drupal\Core\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\ContextAwarePluginBase implements \Drupal\Core\Plugin\ContextAwarePluginInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\TypedData\TypedDataTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Component\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\ContextAwarePluginInterface
Expanded class hierarchy of AttachedRenderingBlock
See also
\Drupal\system\Tests\Render\HtmlResponseAttachmentsTest
File
-
core/
modules/ system/ tests/ modules/ render_attached_test/ src/ Plugin/ Block/ AttachedRenderingBlock.php, line 20
Namespace
Drupal\render_attached_test\Plugin\BlockView source
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;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
AttachedRenderingBlock::build | public | function | |
AttachedRenderingBlock::getCacheMaxAge | public | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.