public function AddtoCartFormatter::settingsForm in Basic cart 8
Same name and namespace in other branches
- 8.6 src/Plugin/Field/FieldFormatter/AddToCartFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddToCartFormatter::settingsForm()
- 8.2 src/Plugin/Field/FieldFormatter/AddToCartFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddtoCartFormatter::settingsForm()
- 8.3 src/Plugin/Field/FieldFormatter/AddToCartFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddtoCartFormatter::settingsForm()
- 8.4 src/Plugin/Field/FieldFormatter/AddToCartFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddtoCartFormatter::settingsForm()
- 8.5 src/Plugin/Field/FieldFormatter/AddToCartFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddtoCartFormatter::settingsForm()
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 FormatterBase::settingsForm
File
- src/
Plugin/ Field/ FieldFormatter/ AddToCartFormatter.php, line 91
Class
- AddtoCartFormatter
- Plugin implementation of the 'addtocart' formatter.
Namespace
Drupal\basic_cart\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
global $base_url;
$element = array();
$element['addtocart_wrapper_container_class'] = array(
'#type' => 'textfield',
'#title' => t('Add to cart wrapper class (css)'),
'#default_value' => $this
->getSetting('addtocart_wrapper_container_class'),
);
$element['addtocart_button_container_class'] = array(
'#type' => 'textfield',
'#title' => t('Add to cart button container class (css)'),
'#default_value' => $this
->getSetting('addtocart_button_container_class'),
);
$element['addtocart_button_class'] = array(
'#type' => 'textfield',
'#title' => t('Add to cart button class (css)'),
'#default_value' => $this
->getSetting('addtocart_button_class'),
);
$element['addtocart_message_wrapper_class'] = array(
'#type' => 'textfield',
'#title' => t('Add to cart button class (css)'),
'#default_value' => $this
->getSetting('addtocart_message_wrapper_class'),
);
return $element;
}