class TestContextAwareNoValidContextOptionsBlock

Same name in other branches
  1. 9 core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareNoValidContextOptionsBlock.php \Drupal\block_test\Plugin\Block\TestContextAwareNoValidContextOptionsBlock
  2. 10 core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareNoValidContextOptionsBlock.php \Drupal\block_test\Plugin\Block\TestContextAwareNoValidContextOptionsBlock
  3. 11.x core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareNoValidContextOptionsBlock.php \Drupal\block_test\Plugin\Block\TestContextAwareNoValidContextOptionsBlock

Provides a context-aware block that uses a not-passed, non-required context.

Plugin annotation


@Block(
  id = "test_context_aware_no_valid_context_options",
  admin_label = @Translation("Test context-aware block - no valid context options"),
  context_definitions = {
    "email" = @ContextDefinition("email", required = FALSE)
  }
)

Hierarchy

Expanded class hierarchy of TestContextAwareNoValidContextOptionsBlock

File

core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareNoValidContextOptionsBlock.php, line 18

Namespace

Drupal\block_test\Plugin\Block
View source
class TestContextAwareNoValidContextOptionsBlock extends BlockBase {
    
    /**
     * {@inheritdoc}
     */
    public function build() {
        return [
            '#markup' => 'Rendered block with no valid context options',
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary
TestContextAwareNoValidContextOptionsBlock::build public function

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.