ColorFieldWidgetHTML5.php in Color Field 8.2
File
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;
class ColorFieldWidgetHTML5 extends ColorFieldWidgetBase {
public static function defaultSettings() {
return [] + parent::defaultSettings();
}
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = [];
return $element;
}
public function settingsSummary() {
$summary = [];
return $summary;
}
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;
}
}