public function ProfileFormEmbedded::execute in Entity Legal 3.0.x
Same name and namespace in other branches
- 8.2 src/Plugin/EntityLegal/ProfileFormEmbedded.php \Drupal\entity_legal\Plugin\EntityLegal\ProfileFormEmbedded::execute()
- 4.0.x src/Plugin/EntityLegal/ProfileFormEmbedded.php \Drupal\entity_legal\Plugin\EntityLegal\ProfileFormEmbedded::execute()
Execute callback for Entity Legal method plugin.
Parameters
array $context: Contextual information for plugin to execute on.
Overrides ProfileForm::execute
File
- src/
Plugin/ EntityLegal/ ProfileFormEmbedded.php, line 19
Class
- ProfileFormEmbedded
- Method class for displaying a checkbox on the user register form.
Namespace
Drupal\entity_legal\Plugin\EntityLegalCode
public function execute(array &$context = []) {
parent::execute($context);
if (!empty($this->documents)) {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$view_builder = \Drupal::entityTypeManager()
->getViewBuilder(ENTITY_LEGAL_DOCUMENT_VERSION_ENTITY_NAME);
/** @var \Drupal\entity_legal\EntityLegalDocumentInterface $document */
foreach ($this->documents as $document) {
$document_markup = $view_builder
->view($document
->getPublishedVersion());
$context['form']["legal_{$document->id()}"]['#prefix'] = $renderer
->renderPlain($document_markup);
}
}
}