Assets question: Jquery UI
Permalink
Hi,
I'm building a site in 5.7. The site needs JQuery UI so I want to load the asset, so in my page_theme.php file I've added it to the registerAssets function:
public function registerAssets() {
...
$this->requireAsset('javascript', 'jquery/ui');
...
}
However, when logged out it isn't loading Jquery UI. Any ideas please? :)
Dave
I'm building a site in 5.7. The site needs JQuery UI so I want to load the asset, so in my page_theme.php file I've added it to the registerAssets function:
public function registerAssets() {
...
$this->requireAsset('javascript', 'jquery/ui');
...
}
However, when logged out it isn't loading Jquery UI. Any ideas please? :)
Dave
Hi Karl
Thanks for the reply. I did try that and it didn't seem to help, but I think I'll try it again...
Cheers
Dave
Thanks for the reply. I did try that and it didn't seem to help, but I think I'll try it again...
Cheers
Dave
OK so I just activated Elemental, Removed my theme then cleared the cache.
Then I re-installed my theme and it's still not loading jqueryUI - it is loading jQuery though.
Then I re-installed my theme and it's still not loading jqueryUI - it is loading jQuery though.
As a work-around, you could try to provide this asset and paste the code into your head. It shouldn't double load in any case, as you are stating you provide it yourself.
$this->providesAsset('javascript', 'jquery/ui');
$this->providesAsset('javascript', 'jquery/ui');
Thanks but now I just get
Call to undefined method Concrete\Core\Page\View\PageView::providesAsset()
Call to undefined method Concrete\Core\Page\View\PageView::providesAsset()
It shouldn't call "Concrete\Core\Page\View\PageView", but "Concrete\Core\Page\Theme\Theme" instead...
Does your class PageTheme extend "\Concrete\Core\Page\Theme\Theme"?
Does your class PageTheme extend "\Concrete\Core\Page\Theme\Theme"?
class PageTheme extends \Concrete\Core\Page\Theme\Theme { // your registerAssets function and all that }
Yes that's exactly what it's set to do
Can you copy/paste the whole page_theme.php file? And what version number are you using, perhaps this is a Concrete5 bug... but as it tries to call the wrong class, it seems it's not extending the correct class... Can anyone else take a look at this too (are the tech-y people around)?
Here you go:
It Concrete5 v 5.7.5.2
<?php namespace Application\Theme\Gbliners; class PageTheme extends \Concrete\Core\Page\Theme\Theme { public function registerAssets() { //$this->providesAsset('javascript', 'bootstrap/*'); $this->providesAsset('css', 'bootstrap/*'); $this->providesAsset('css', 'blocks/form'); $this->providesAsset('css', 'blocks/social_links'); $this->providesAsset('css', 'blocks/share_this_page'); $this->providesAsset('css', 'blocks/feature'); $this->providesAsset('css', 'blocks/testimonial'); $this->providesAsset('css', 'blocks/date_navigation'); $this->providesAsset('css', 'blocks/topic_list'); $this->providesAsset('css', 'blocks/faq'); $this->providesAsset('css', 'blocks/tags');
Viewing 15 lines of 84 lines. View entire code block.
It Concrete5 v 5.7.5.2
To start with it seems all your providesAsset should really be requireAsset unless you are actually providing all those files
Otherwise I tried the code with requireasset and jquery ui loads normally
oh and the way you did it is not recommended. If somebody installs a block on that site that provides its own version of jquery ui or requires core jquery ui, there will be no awareness between the theme and the block and jquery ui will be loaded twice
I believe you need to refresh the theme by uninstalling and reinstalling it.