Did something change to the color helper?
Permalink
I now get a undefined is not a function when using the color helper. This is new since 5.7.2.1 :/
Hmm, weird. I'm not getting this. I know we updated the javascript behind the color helper at one point not too long ago – or at the very least the defaults we were sending to it. I don't remember doing it in 5.7.2.1 though.
I realized the difference was in the theme I was using, but when I stripped it down, it still seems like an issue to be resolved somehow.
When I have a theme that "provides" jquery (providesAsset()), it doesn't work.
When I have a theme that "requires" it, then it works.
Same jQ version.
When I have a theme that "provides" jquery (providesAsset()), it doesn't work.
When I have a theme that "requires" it, then it works.
Same jQ version.
This is the intended behavior. Anything in "providesAsset" has to be provided by the theme. i.e. Included in the themes <head> tag through hard coding, etc... This is basically a way for you to tell concrete5 "I've hard coded a reference to bootstrap in the <head> tag of my theme – so you don't need to include it yourself if any block says it needs it.". It's a way to skip assets. requireAsset does the opposite – it goes into the core and says "I have to have this asset injected into my view layer in order for the current functionality to work.
Right, so my page_theme.php has this
but it seems when I provide the jquery asset, the color picker doesn't work.
Am I missing something?
public function registerAssets() { $this->requireAsset('css', 'font-awesome'); $this->providesAsset('javascript', 'jquery'); }
but it seems when I provide the jquery asset, the color picker doesn't work.
Am I missing something?
How are you providing jQuery? Where you adding it to the theme's template files?
<head> <? Loader::element('header_required'); ?> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" ></script> <?php echo $html->css($view->getStylesheet('iGotStyle.less'))?> </head>
should I throw it before header_required?
Ah, yes. Try doing that. I don't know of any javascript files that go into the header in header_required.php but it's possible there are some.
The code MichaelG posted worked for me in a test block using the Elemental theme.
On the topic of the color helper:
- is there a way to enable the rgba version (with transparency slider) that the theme preset system uses?
- is there a recommended way to set a default color for the color picker instead of transparent with an X?
I am very excited about your documentation for attributes. I am working on a pretty neat free theme that uses colors and being able to use a color picker in composer would be perfect.
$color = Core::make('helper/form/color'); $color->output('bgcolor',$bgcolor);
On the topic of the color helper:
- is there a way to enable the rgba version (with transparency slider) that the theme preset system uses?
- is there a recommended way to set a default color for the color picker instead of transparent with an X?
I am very excited about your documentation for attributes. I am working on a pretty neat free theme that uses colors and being able to use a color picker in composer would be perfect.
For the record, I'm pretty sure it was a theme js conflict issue. I haven't circled back to it.
I set the default color by doing this though
I set the default color by doing this though
$color->output('bgcolor',$bgcolor?$bgcolor:"rgb(255,0,0)")?>
That is a great tip, thank you MichaelG.
I didn't even know you could do that.
Have you tried using the color picker with the transparency slider yet?
I didn't even know you could do that.
Have you tried using the color picker with the transparency slider yet?
$color->output('bgcolor',$bgcolor,array('showAlpha'=>'true');
You can see all of the options available here:http://bgrins.github.io/spectrum/#options...
and you can see what the default selected options are here in /concrete/src/Form/Widget/Color.php
I bookmarked that site.
Thank you.
Thank you.
I'm simply doing this:
and getting "Undefined is not a function" error in my console.
This is strictly as of 5.7.2.1