You are here

function entity_browser_entity_form_field_widget_settings_summary_alter in Entity Browser 8.2

Same name and namespace in other branches
  1. 8 modules/entity_form/entity_browser_entity_form.module \entity_browser_entity_form_field_widget_settings_summary_alter()

Implements hook_field_widget_settings_summary_alter().

File

modules/entity_form/entity_browser_entity_form.module, line 193
Hook implementations for entity_browser_entity_form.module.

Code

function entity_browser_entity_form_field_widget_settings_summary_alter(&$summary, $context) {
  $plugin = $context['widget'];
  if ($plugin instanceof InlineEntityFormComplex && $plugin
    ->getThirdPartySetting('entity_browser_entity_form', 'entity_browser_id') && $plugin
    ->getThirdPartySetting('entity_browser_entity_form', 'entity_browser_id') !== '_none') {
    $entity_browser_id = $plugin
      ->getThirdPartySetting('entity_browser_entity_form', 'entity_browser_id');
    $entity_browser = \Drupal::service('entity_type.manager')
      ->getStorage('entity_browser')
      ->load($entity_browser_id);
    if ($entity_browser) {
      $summary[] = t('Entity browser: @entity_browser.', [
        '@entity_browser' => $entity_browser
          ->label(),
      ]);
    }
    return $summary;
  }
}