Commit 5482b692 authored by targoo's avatar targoo

reorganise function in main color item function

parent 3ad3fb82
......@@ -26,15 +26,6 @@ use Drupal\Core\TypedData\DataDefinition;
*/
class ColorFieldItem extends FieldItemBase {
/**
* {@inheritdoc}
*/
public static function defaultFieldSettings() {
return array(
'opacity' => TRUE,
) + parent::defaultFieldSettings();
}
/**
* {@inheritdoc}
*/
......@@ -60,6 +51,15 @@ class ColorFieldItem extends FieldItemBase {
);
}
/**
* {@inheritdoc}
*/
public static function defaultFieldSettings() {
return array(
'opacity' => TRUE,
) + parent::defaultFieldSettings();
}
/**
* {@inheritdoc}
*/
......@@ -96,6 +96,26 @@ class ColorFieldItem extends FieldItemBase {
return $element;
}
/**
* {@inheritdoc}
*/
/*public function getConstraints() {
$constraint_manager = \Drupal::typedDataManager()->getValidationConstraintManager();
$constraints = parent::getConstraints();
$max_length = 256;
$constraints[] = $constraint_manager->create('ComplexData', array(
'value' => array(
'Length' => array(
'max' => $max_length,
'maxMessage' => t('%name: the color may not be longer than @max characters.', array('%name' => $this->getFieldDefinition()->getLabel(), '@max' => $max_length)),
)
),
));
return $constraints;
}*/
/**
* {@inheritdoc}
*/
......
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