public function CartBlockBase::blockForm in Commerce Cart Blocks 8
Overrides BlockPluginTrait::blockForm
1 call to CartBlockBase::blockForm()
- CartBlock::blockForm in src/
Plugin/ Block/ CartBlock.php
1 method overrides CartBlockBase::blockForm()
- CartBlock::blockForm in src/
Plugin/ Block/ CartBlock.php
File
- src/
Plugin/ Block/ CartBlockBase.php, line 87
Class
- CartBlockBase
- CartBlockBase class.
Namespace
Drupal\commerce_cart_blocks\Plugin\BlockCode
public function blockForm($form, FormStateInterface $form_state) {
$form['hide_if_empty'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Hide if empty'),
'#description' => $this
->t('When checked, then the block will be hidden if the cart is empty.'),
'#default_value' => $this->configuration['hide_if_empty'],
];
$form['display_links'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Display links'),
'#description' => $this
->t('Choose which links to display within the block content.'),
'#options' => [
'cart' => $this
->t('Cart'),
'checkout' => $this
->t('Checkout'),
],
'#default_value' => $this->configuration['display_links'],
];
$form['cart_link_text'] = [
'#type' => 'textfield',
'#title' => $this
->t('Cart link text'),
'#description' => $this
->t('Enter the text for the Cart link, if shown.'),
'#default_value' => $this->configuration['cart_link_text'],
];
$form['checkout_link_text'] = [
'#type' => 'textfield',
'#title' => $this
->t('Checkout link text'),
'#description' => $this
->t('Enter the text for the Checkout link, if shown.'),
'#default_value' => $this->configuration['checkout_link_text'],
];
$form['count_text_plural'] = [
'#type' => 'textfield',
'#title' => $this
->t('Count text (plural)'),
'#description' => $this
->t('The text to use when describing the number of cart items, including the @count placeholder.'),
'#default_value' => $this->configuration['count_text_plural'],
];
$form['count_text_singular'] = [
'#type' => 'textfield',
'#title' => $this
->t('Count text (singular)'),
'#description' => $this
->t('The text to use when describing a single cart item, including the @count placeholder.'),
'#default_value' => $this->configuration['count_text_singular'],
];
$form['count_text_empty'] = [
'#type' => 'textfield',
'#title' => $this
->t('Count text (empty)'),
'#description' => $this
->t('The text to use when describing an empty cart item, including the @count placeholder.'),
'#default_value' => $this->configuration['count_text_empty'],
];
return $form;
}