function message_entity_extra_field_info in Message 8
Implements hook_entity_extra_field_info().
File
- ./
message.module, line 137 - API functions to manipulate messages.
Code
function message_entity_extra_field_info() {
$extra = [];
/** @var \Drupal\message\Entity\MessageTemplate[] $bundles */
$bundles = MessageTemplate::loadMultiple();
foreach ($bundles as $bundle) {
foreach (array_keys($bundle
->getText()) as $delta) {
if (!is_int($delta)) {
// The get text holds also the translated text. Since we hold only need
// the number of partials we don't need to include delta of texts.
continue;
}
$params = [
'%number' => $delta,
];
$extra['message'][$bundle
->id()]['display']['partial_' . $delta] = [
'label' => t('Partial %number', $params),
'description' => t('Holds the partial text at position %number', $params),
'weight' => 0,
];
}
}
return $extra;
}