public function BulkSkuWidget::settingsSummary in Commerce Bulk 8
Returns a short summary for the current widget settings.
If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.
Return value
array A short summary of the widget settings.
Overrides StringTextfieldWidget::settingsSummary
File
- src/
Plugin/ Field/ FieldWidget/ BulkSkuWidget.php, line 125
Class
- BulkSkuWidget
- Plugin implementation of the 'commerce_bulk_sku' widget.
Namespace
Drupal\commerce_bulk\Plugin\Field\FieldWidgetCode
public function settingsSummary() {
$summary = [];
$none = $this
->t('None');
$settings = $this
->getSettings();
$sku = uniqid($settings['prefix'], $settings['more_entropy']) . $settings['suffix'];
$settings['auto SKU sample'] = $settings['uniqid_enabled'] ? $sku : $none;
$settings['hide'] = $settings['hide'] ? $this
->t('Yes') : $this
->t('No');
unset($settings['uniqid_enabled'], $settings['more_entropy']);
foreach ($settings as $name => $value) {
$value = empty($settings[$name]) ? $none : $value;
$summary[] = "{$name}: {$value}";
}
return $summary;
}