public function EnrollActionBlock::build in Open Social 8.6
Same name and namespace in other branches
- 8.9 modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 8 modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 8.2 modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 8.3 modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 8.4 modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 8.5 modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 8.7 modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 8.8 modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 10.3.x modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 10.0.x modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 10.1.x modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
- 10.2.x modules/social_features/social_event/src/Plugin/Block/EnrollActionBlock.php \Drupal\social_event\Plugin\Block\EnrollActionBlock::build()
Builds and returns the renderable array for this block plugin.
If a block should not be rendered because it has no content, then this method must also ensure to return no content: it must then only return an empty array, or an empty array with #cache set (with cacheability metadata indicating the circumstances for it being empty).
Return value
array A renderable array representing the content of the block.
Overrides BlockPluginInterface::build
See also
\Drupal\block\BlockViewBuilder
File
- modules/
social_features/ social_event/ src/ Plugin/ Block/ EnrollActionBlock.php, line 112
Class
- EnrollActionBlock
- Provides a 'EnrollActionBlock' block.
Namespace
Drupal\social_event\Plugin\BlockCode
public function build() {
$form = $this->formBuilder
->getForm('Drupal\\social_event\\Form\\EnrollActionForm');
$render_array = [
'enroll_action_form' => $form,
];
$text = (string) $this
->t('You have enrolled for this event.');
// Add extra text to.
if ($form['to_enroll_status']['#value'] === '0') {
$render_array['feedback_user_has_enrolled'] = [
'#markup' => '<div><strong>' . $text . '</strong></div>',
];
}
return $render_array;
}