function TestInlineTemplateFormBlock::build

Same name and namespace in other branches
  1. 8.9.x core/modules/layout_builder/tests/modules/layout_builder_form_block_test/src/Plugin/Block/TestInlineTemplateFormBlock.php \Drupal\layout_builder_form_block_test\Plugin\Block\TestInlineTemplateFormBlock::build()
  2. 10 core/modules/layout_builder/tests/modules/layout_builder_form_block_test/src/Plugin/Block/TestInlineTemplateFormBlock.php \Drupal\layout_builder_form_block_test\Plugin\Block\TestInlineTemplateFormBlock::build()
  3. 11.x core/modules/layout_builder/tests/modules/layout_builder_form_block_test/src/Plugin/Block/TestInlineTemplateFormBlock.php \Drupal\layout_builder_form_block_test\Plugin\Block\TestInlineTemplateFormBlock::build()

Overrides BlockPluginInterface::build

File

core/modules/layout_builder/tests/modules/layout_builder_form_block_test/src/Plugin/Block/TestInlineTemplateFormBlock.php, line 23

Class

TestInlineTemplateFormBlock
Provides a block containing inline template with <form> tag.

Namespace

Drupal\layout_builder_form_block_test\Plugin\Block

Code

public function build() {
    $build['form'] = [
        '#type' => 'inline_template',
        '#template' => '<form method="POST"><label>{{ "Keywords"|t }}<input name="keyword" type="text" required /></label><input name="submit" type="submit" value="{{ "Submit"|t }}" /></form>',
    ];
    return $build;
}

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