Override concrete5 bootstrap only in frontend but not in dashboard?

Permalink
Hi,

I've been going crazy for the past few days when trying to implement a theme into Concrete5.7 because of the assets included. Basically the theme comes with full bootstrap css and js files among other things - this creates certain issues that I've tried to come across. Actually it took hours and hours just to sort out that it was bootstrap causing the errors (which did not show up in the console). Where I am now, I've come to the conclusion that in my frontend, I want to include my own full bootstrap js and css (because they conflict if loaded along with the core bootstrap) by using the following in the page_theme.php:

$this->providesAsset('javascript', 'bootstrap/*');
$this->requireAsset('javascript', 'twitter-bootstrap');


For some reason this works only in the front end, which makes me don't want to use my own (std) boostrap in the backend, because for instance when working with stacks, now this suddenly won't work in the backend. To be specific, what has caused me all these troubles are the advanced styling toolbar options, which won't show up on click when bootstrap conflicts.

see here what will not show up:https://www.dropbox.com/s/ndlo3jo6hk1a2pl/conc01.jpg...

So what I tried was to add a page type controller, to make sure to fetch my assets when using my page types like this:

class EmptyGrid extends PageTypeController
{
    public function view()
    {
        //JS
        $this->providesAsset('javascript', 'bootstrap/*');
        $this->requireAsset('javascript', 'twitter-bootstrap');
        //CSS
        $this->providesAsset('css', 'bootstrap/*');
        $this->requireAsset('css', 'bootstrap-theme');
    }
}


Unfortunately I get this error:
Call to undefined method Concrete\Package\Frontend\Controller\PageType\EmptyGrid::providesAsset()

So, I can use the requireAsset but not the providesAsset function, which makes my possible solution to bootstrap swapping fall apart :-(
So right now I am stuck on how to tell the system that for my frontend I want to include plain bootstrap, and in the dashboard I would like concrete5 to user their own assets?

Hopefully some clever magician out there can guide me? :-)

Thank you so much in advance!

pixel8
View Replies:
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi pixel8,

You have multiple issues.

You are trying to require "invalid" assets. There are no internal assets named "bootstrap-theme" and "twitter-bootstrap".
$this->requireAsset('css', 'bootstrap-theme');
$this->requireAsset('javascript', 'twitter-bootstrap');

Here is a list of concrete5 assets.
http://www.concrete5.org/documentation/developers/5.7/appendix/asse...

Even though it doesn't work, you are trying to both require and provide the same assets.

Here is an example of how requiring and providing works.
Example: jQuery
- By requiring the asset, I am telling concrete5 to load jQuery for me (to use its internal asset).
$this->requireAsset('javascript', 'jquery');

- By providing the asset, I am telling concrete5 that I am providing my own copy of jQuery.
$this->providesAsset('javascript', 'jquery');

If you are "requiring" a CSS or JS asset, the asset does not need to be included in your theme. If you are "providing" an asset, then it does need to be included in your theme.

Call to undefined method Concrete\Package\Frontend\Controller\PageType\EmptyGrid::providesAsset()

PageTypeController does not have the providesAsset() method defined. The page_theme.php file extends Concrete\Core\Page\Theme\Theme which does have the method defined.
http://www.concrete5.org/api/class-Concrete.Core.Page.Theme.Theme.h...