Last active
May 12, 2020 15:47
-
-
Save hadl/b508d12f5e3150426afb1bf93fd70033 to your computer and use it in GitHub Desktop.
Pimcore Basic Document Editable Color Picker (https://pimcore.com/docs/6.x/Development_Documentation/Extending_Pimcore/Bundle_Developers_Guide/Adding_Document_Editables.html)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-undef,object-shorthand,no-param-reassign */ | |
pimcore.registerNS('pimcore.document.tags.color'); | |
pimcore.document.tags.color = Class.create(pimcore.document.tag, { | |
initialize: function (id, name, options, data, inherited) { | |
this.id = id; | |
this.name = name; | |
this.setupWrapper(); | |
options = this.parseOptions(options); | |
options.value = data || ''; | |
options.name = id + '_editable'; | |
this.element = new Ext.form.field.Text(options); | |
this.element.inputType = 'color'; | |
this.element.render(id); | |
if (options.required) { | |
this.required = options.required; | |
} | |
}, | |
getType: function () { | |
return 'color'; | |
}, | |
getValue: function () { | |
return this.element.getValue(); | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Color Input Editable | |
*/ | |
namespace AppBundle\Model\Document\Tag; | |
use Pimcore\Model\Document\Tag\Input; | |
class Color extends Input | |
{ | |
/** | |
* Return the type of the element | |
* @see TagInterface::getType | |
* | |
* @return string | |
*/ | |
public function getType() | |
{ | |
return 'color'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pimcore: | |
documents: | |
tags: | |
map: | |
color: AppBundle\Model\Document\Tag\Color |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment