public function PriceTableDefaultFormatter::settingsForm in Commerce Price Table 8
Returns a form to configure settings for the formatter.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form elements for the formatter settings.
Overrides PriceDefaultFormatter::settingsForm
File
- src/
Plugin/ Field/ FieldFormatter/ PriceTableDefaultFormatter.php, line 75
Class
- PriceTableDefaultFormatter
- Plugin implementation of the 'commerce_price_table' formatter.
Namespace
Drupal\commerce_price_table\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$settings = [
'price_label' => [
'#type' => 'textfield',
'#title' => $this
->t('Price label for the price table'),
'#default_value' => $this
->getSetting('price_label'),
],
'quantity_label' => [
'#type' => 'textfield',
'#title' => $this
->t('Quantity label for the price table'),
'#default_value' => $this
->getSetting('quantity_label'),
],
'table_orientation' => [
'#type' => 'radios',
'#options' => $this
->getOrientationOptionsList(),
'#title' => $this
->t('Orientation of the price table'),
'#default_value' => $this
->getSetting('table_orientation'),
],
] + parent::settingsForm($form, $form_state);
return $settings;
}