public function PriceItem::fieldSettingsForm in Price 8
Same name and namespace in other branches
- 3.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::fieldSettingsForm()
- 2.0.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::fieldSettingsForm()
- 2.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::fieldSettingsForm()
- 3.0.x src/Plugin/Field/FieldType/PriceItem.php \Drupal\price\Plugin\Field\FieldType\PriceItem::fieldSettingsForm()
Returns a form for the field-level settings.
Invoked from \Drupal\field_ui\Form\FieldConfigEditForm to allow administrators to configure field-level settings.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The form state of the (entire) configuration form.
Return value
array The form definition for the field settings.
Overrides FieldItemBase::fieldSettingsForm
1 call to PriceItem::fieldSettingsForm()
- PriceModifiedItem::fieldSettingsForm in src/
Plugin/ Field/ FieldType/ PriceModifiedItem.php - Returns a form for the field-level settings.
1 method overrides PriceItem::fieldSettingsForm()
- PriceModifiedItem::fieldSettingsForm in src/
Plugin/ Field/ FieldType/ PriceModifiedItem.php - Returns a form for the field-level settings.
File
- src/
Plugin/ Field/ FieldType/ PriceItem.php, line 80
Class
- PriceItem
- Plugin implementation of the 'price' field type.
Namespace
Drupal\price\Plugin\Field\FieldTypeCode
public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
$currencies = \Drupal::entityTypeManager()
->getStorage('price_currency')
->loadMultiple();
$currency_codes = array_keys($currencies);
$element = [];
$element['available_currencies'] = [
'#type' => count($currency_codes) < 10 ? 'checkboxes' : 'select',
'#title' => $this
->t('Available currencies'),
'#description' => $this
->t('If no currencies are selected, all currencies will be available.'),
'#options' => array_combine($currency_codes, $currency_codes),
'#default_value' => $this
->getSetting('available_currencies'),
'#multiple' => TRUE,
'#size' => 5,
];
return $element;
}