Same filename and directory in other branches
Namespace
Drupal\color_field\Plugin\Field\FieldWidgetFichier
-
src/
Plugin/ Field/ FieldWidget/ ColorFieldWidgetHTML5.php
View source
<?php
namespace Drupal\color_field\Plugin\Field\FieldWidget;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
/**
* Plugin implementation of the color_field spectrum widget.
*
* @FieldWidget(
* id = "color_field_widget_html5",
* module = "color_field",
* label = @Translation("Color HTML5"),
* field_types = {
* "color_field_type"
* }
* )
*/
class ColorFieldWidgetHTML5 extends ColorFieldWidgetBase {
/**
* {@inheritdoc}
*/
public static function defaultSettings() {
return [];
}
/**
* {@inheritdoc}
*/
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = [];
return $element;
}
/**
* {@inheritdoc}
*/
public function settingsSummary() {
$summary = [];
return $summary;
}
/**
* {@inheritdoc}
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element = parent::formElement($items, $delta, $element, $form, $form_state);
$element['color']['#type'] = 'color';
return $element;
}
}
Classes
Titre | Deprecated | Résumé |
---|---|---|
ColorFieldWidgetHTML5 | Plugin implementation of the color_field spectrum widget. |