You are here

public static function ImageWidgetHelper::summarize in Lightning Media 8.4

Same name and namespace in other branches
  1. 8 src/ImageWidgetHelper.php \Drupal\lightning_media\ImageWidgetHelper::summarize()
  2. 8.2 src/ImageWidgetHelper.php \Drupal\lightning_media\ImageWidgetHelper::summarize()
  3. 8.3 src/ImageWidgetHelper.php \Drupal\lightning_media\ImageWidgetHelper::summarize()

Summarizes an image widget's Lightning Media-specific settings.

Parameters

\Drupal\image\Plugin\Field\FieldWidget\ImageWidget $widget: The widget plugin.

array $summary: (optional) An existing summary to augment.

Return value

string[] The summarized settings.

1 call to ImageWidgetHelper::summarize()
lightning_media_field_widget_settings_summary_alter in ./lightning_media.module
Implements hook_field_widget_settings_summary_alter().

File

src/ImageWidgetHelper.php, line 69

Class

ImageWidgetHelper
Contains helper functions for manipulating image field widgets.

Namespace

Drupal\lightning_media

Code

public static function summarize(ImageWidget $widget, array &$summary = NULL) {
  $settings = static::getSettings($widget);
  if (is_null($summary)) {
    $summary = [];
  }
  if (empty($settings['file_links'])) {
    $summary[] = t('Do not link to uploaded files');
  }
  if (empty($settings['remove_button'])) {
    $summary[] = t('Hide Remove button');
  }
  return $summary;
}