You are here

public function AddtoCartWithQuantityFormatter::settingsForm in Basic cart 8

Same name and namespace in other branches
  1. 8.6 src/Plugin/Field/FieldFormatter/AddToCartWithQuantityFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddToCartWithQuantityFormatter::settingsForm()
  2. 8.2 src/Plugin/Field/FieldFormatter/AddToCartWithQuantityFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddtoCartWithQuantityFormatter::settingsForm()
  3. 8.3 src/Plugin/Field/FieldFormatter/AddToCartWithQuantityFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddtoCartWithQuantityFormatter::settingsForm()
  4. 8.4 src/Plugin/Field/FieldFormatter/AddToCartWithQuantityFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddtoCartWithQuantityFormatter::settingsForm()
  5. 8.5 src/Plugin/Field/FieldFormatter/AddToCartWithQuantityFormatter.php \Drupal\basic_cart\Plugin\Field\FieldFormatter\AddtoCartWithQuantityFormatter::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/AddToCartWithQuantityFormatter.php, line 106

Class

AddtoCartWithQuantityFormatter
Plugin implementation of the 'addtocartwithquantity' formatter.

Namespace

Drupal\basic_cart\Plugin\Field\FieldFormatter

Code

public function settingsForm(array $form, FormStateInterface $form_state) {
  global $base_url;
  $element = array();
  $element['quantity_addtocart_wrapper_container_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Add to cart wrapper class (css)'),
    '#default_value' => $this
      ->getSetting('quantity_addtocart_wrapper_container_class'),
  );
  $element['quantity_addtocart_button_container_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Add to cart button container class (css)'),
    '#default_value' => $this
      ->getSetting('quantity_addtocart_button_container_class'),
  );
  $element['quantity_addtocart_button_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Add to cart button class (css)'),
    '#default_value' => $this
      ->getSetting('quantity_addtocart_button_class'),
  );
  $element['quantity_addtocart_message_wrapper_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Add to cart button class (css)'),
    '#default_value' => $this
      ->getSetting('quantity_addtocart_message_wrapper_class'),
  );
  $element['quantity_addtocart_quantity_wrapper_container_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Quantity wrapper class (css)'),
    '#default_value' => $this
      ->getSetting('quantity_addtocart_quantity_wrapper_container_class'),
  );
  $element['quantity_addtocart_quantity_textfield_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Quantity textfield class (css)'),
    '#default_value' => $this
      ->getSetting('quantity_addtocart_quantity_textfield_class'),
  );
  $element['quantity_addtocart_quantity_label_class'] = array(
    '#type' => 'textfield',
    '#title' => t('Quantity label class (css)'),
    '#default_value' => $this
      ->getSetting('quantity_addtocart_quantity_label_class'),
  );
  $element['quantity_addtocart_quantity_label_value'] = array(
    '#type' => 'textfield',
    '#title' => t('Quantity label value'),
    '#default_value' => $this
      ->getSetting('quantity_addtocart_quantity_label_value'),
  );
  return $element;
}