You are here

public function EntityTypeInfo::entityExtraFieldInfo in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/EntityTypeInfo.php \Drupal\workbench_moderation\EntityTypeInfo::entityExtraFieldInfo()

Gets the "extra fields" for a bundle.

This is a hook bridge.

Return value

array A nested array of 'pseudo-field' elements. Each list is nested within the following keys: entity type, bundle name, context (either 'form' or 'display'). The keys are the name of the elements as appearing in the renderable array (either the entity form or the displayed entity). The value is an associative array:

  • label: The human readable name of the element. Make sure you sanitize this appropriately.
  • description: A short description of the element contents.
  • weight: The default weight of the element.
  • visible: (optional) The default visibility of the element. Defaults to TRUE.
  • edit: (optional) String containing markup (normally a link) used as the element's 'edit' operation in the administration interface. Only for 'form' context.
  • delete: (optional) String containing markup (normally a link) used as the element's 'delete' operation in the administration interface. Only for 'form' context.

See also

hook_entity_extra_field_info()

File

src/EntityTypeInfo.php, line 209

Class

EntityTypeInfo
Service class for manipulating entity type information.

Namespace

Drupal\workbench_moderation

Code

public function entityExtraFieldInfo() {
  $return = [];
  foreach ($this
    ->getModeratedBundles() as $bundle) {
    $return[$bundle['entity']][$bundle['bundle']]['display']['workbench_moderation_control'] = [
      'label' => $this
        ->t('Moderation control'),
      'description' => $this
        ->t("Status listing and form for the entitiy's moderation state."),
      'weight' => -20,
      'visible' => TRUE,
    ];
  }
  return $return;
}