function entity_legal_entity_extra_field_info in Entity Legal 3.0.x
Same name and namespace in other branches
- 8.2 entity_legal.module \entity_legal_entity_extra_field_info()
- 4.0.x entity_legal.module \entity_legal_entity_extra_field_info()
Implements hook_entity_extra_field_info().
File
- ./
entity_legal.module, line 61 - Entity Legal module.
Code
function entity_legal_entity_extra_field_info() {
$extra = [];
$documents = \Drupal::entityTypeManager()
->getStorage(ENTITY_LEGAL_DOCUMENT_ENTITY_NAME)
->loadByProperties([
'require_signup' => 1,
]);
/** @var \Drupal\entity_legal\EntityLegalDocumentInterface $document */
foreach ($documents as $document) {
if ($document
->getPublishedVersion()) {
$extra['user']['user']['form']['legal_' . $document
->id()] = [
'label' => $document
->getPublishedVersion()
->label(),
'description' => t('Checkbox for accepting :link', [
':link' => Link::createFromRoute($document
->label(), 'entity.entity_legal_document.edit_form'),
]),
'weight' => -4,
];
}
}
return $extra;
}