You are here

function filefield_sources_field_widget_settings_summary_alter in FileField Sources 8

Implements hook_field_widget_settings_summary_alter().

Add file field sources information to the field widget settings summary.

See also

\Drupal\field_ui\FormDisplayOverview

File

./filefield_sources.module, line 84
Extend FileField to allow files from multiple sources.

Code

function filefield_sources_field_widget_settings_summary_alter(&$summary, $context) {
  $plugin = $context['widget'];
  if (in_array($plugin
    ->getPluginId(), \Drupal::moduleHandler()
    ->invokeAll('filefield_sources_widgets'))) {
    $settings = $plugin
      ->getThirdPartySetting('filefield_sources', 'filefield_sources');
    $enabled_sources = _filefield_sources_enabled($settings);
    $summary[] = t('File field sources:') . ' ' . implode(', ', array_keys($enabled_sources));
  }
}