Commit 9a2b78b1 authored by targoo's avatar targoo

fix a number of issue with annotation

parent 21ba2a4b
......@@ -4,8 +4,6 @@
* An color field with a custom color picker using the Field Types API.
*/
use Drupal\Core\Entity\EntityInterface;
/**
* Implements hook_help().
*/
......@@ -24,7 +22,6 @@ function color_field_help($path, $arg) {
*/
function color_field_field_instance_settings_form($field, $instance) {
$settings = $instance['settings'];
$form['alfa'] = array(
'#type' => 'checkbox',
'#title' => t('Alfa'),
......
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\color_field\Plugin\Field\FieldType\ColorFieldType.
* Contains \Drupal\color_field\Plugin\Field\FieldType\ColorFieldItem.
*/
namespace Drupal\color_field\Plugin\Field\FieldType;
......
......@@ -13,7 +13,7 @@ use Drupal\Core\Field\WidgetBase;
/**
* Plugin implementation of the 'color_field_default' widget.
*
* @Plugin(
* @FieldWidget(
* id = "color_field_default",
* module = "color_field",
* label = @Translation("Color field default"),
......@@ -31,22 +31,13 @@ class ColorFieldDefaultWidget extends WidgetBase {
* Implements \Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) {
$element['rgb'] = $element + array(
'#type' => 'textfield',
'#maxlength' => 7,
$element['rgb'] = array(
'#title' => t('Color Field'),
'#default_value' => isset($items[$delta]['rgb']) ? $items[$delta]['rgb'] : NULL,
//'#placeholder' => $this->getSetting('placeholder'),
'#required' => $element['#required'],
);
/*$element['alfa'] = $element + array(
'#type' => 'textfield',
'#maxlength' => 7,
'#title' => t('Color Field'),
'#default_value' => isset($items[$delta]['alfa']) ? $items[$delta]['alfa'] : NULL,
//'#placeholder' => $this->getSetting('placeholder'),
'#required' => $element['#required'],
);*/
'#default_value' => isset($items[$delta]->rgb) ? $items[$delta]->rgb : NULL,
);
return $element;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment