ccm_activateTabBar() not defined when not logged in

Permalink
I did build a component with tabs in concrete5 v8 with this tutorial, when logged in as administrator it works just fine, when not logged in the tabs wont work, it seems to be some kind of missing asset error.

For more details I submitted this stackoverflow post:
https://stackoverflow.com/questions/48789390/concrete5-ccm-activatet...

View Replies: View Best Answer
hutman replied on at Permalink Reply
hutman
It sounds like you're just missing the jquery ui asset. Do you have these two lines in your view function for the block?

$this->requireAsset('javascript', 'jquery');
$this->requireAsset('jquery/ui');
Om3s replied on at Permalink Reply
Yes as I stated in my stackoverflow post.

Meanwhile I got an comment there, that those tabs are not meant to use outside of editing mode, if this is true, is there a way to workaround without refactoring the component with custom code?
MrKDilkington replied on at Permalink Best Answer Reply
MrKDilkington
Hi Om3s,

To use the concrete5 tabs JavaScript outside of the concrete5 interface, you would need to require app.js. I would not recommend this because app.js is a very large file.

The ccm_activateTabBar() method is part of concrete\js\build\core\app\tabs.js. The tab.js file is part of concrete\js\app.js.

A suggestion would be to write your own tab JS, extract and modify the core JS, or use a tab JS library.
Om3s replied on at Permalink Reply
Thank you very much, I just copied the tabs.js (which only contain that missing function) and bind it if the user is not logged in. Works like a charm