You are here

function paragraphs_ee_field_widget_settings_summary_alter in Paragraphs Editor Enhancements 8

Implements hook_field_widget_settings_summary_alter().

File

./paragraphs_ee.module, line 345
Main functions for "Paragraphs Editor Enhancements" module.

Code

function paragraphs_ee_field_widget_settings_summary_alter(&$summary, $context) {
  if (!$context['widget'] instanceof ParagraphsWidget) {
    return;
  }
  if ($context['widget']
    ->getSetting('add_mode') !== 'modal') {
    return;
  }
  $settings = $context['widget']
    ->getThirdPartySettings('paragraphs_ee');
  if (!empty($settings['paragraphs_ee']['dialog_off_canvas'])) {
    $summary[] = t('Use off-canvas dialog');
  }
  $styles = [
    'tiles' => t('Tiles', [], [
      'context' => 'Paragraphs Editor Enhancements',
    ]),
    'list' => t('List', [], [
      'context' => 'Paragraphs Editor Enhancements',
    ]),
  ];
  if (!empty($settings['paragraphs_ee']['dialog_style']) && isset($styles[$settings['paragraphs_ee']['dialog_style']])) {
    $summary[] = t('Display paragraphs in dialog as: %style', [
      '%style' => $styles[$settings['paragraphs_ee']['dialog_style']],
    ], [
      'context' => 'Paragraphs Editor Enhancements',
    ]);
  }
  $easy_access_count = isset($settings['paragraphs_ee']['easy_access_count']) ? $settings['paragraphs_ee']['easy_access_count'] : 2;
  $summary[] = t('Number of easy-access-buttons: @count', [
    '@count' => $easy_access_count,
  ], [
    'context' => 'Paragraphs Editor Enhancements',
  ]);
}