Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
C
color_field
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Drupal.org issue queue
Drupal.org issue queue
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
project
color_field
Commits
5482b692
Commit
5482b692
authored
Feb 28, 2015
by
targoo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reorganise function in main color item function
parent
3ad3fb82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
9 deletions
+29
-9
src/Plugin/Field/FieldType/ColorFieldItem.php
src/Plugin/Field/FieldType/ColorFieldItem.php
+29
-9
No files found.
src/Plugin/Field/FieldType/ColorFieldItem.php
View file @
5482b692
...
...
@@ -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}
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment