last day (16 days later) » 

11:08 AM
1
A: How to make my Editor plugin (type: editors-xtd) survive after updates?

SharkyNormally, the plugin would open a list of items. In this case, the component doesn't have the model/view for the items. So you have to create them. As a bare minimum, the model must contain getListQuery() method which returns the query used to retrieve the items. administrator/components/com_pi...

 
I've had to continue sprinting with this project, but I do intend to circle back and try your advice. Could you please specify where these new files need to be located? And can you explain why your solution (and several others that I have seen) are using & in $button->link while my original script works fine with just &?
 
Updated the answer to indicate file locations.
My guess is ampersand is escaped for compatibility with older browsers/templates and HTML validity.
 
Okay @Sharky I have com_picture/models/items.php returning the successful query. The var_dump($this->items) is delivering the expected result set. I am calling $this->items from inside of com_picture/views/items/tmpl/modal.php and writing all my dom there. This is what your are advising me to do, right?
I need to include some js and css into my modal (specifically: media/com_picture/js/admin-article-o3_insertpicturestag.js and media/jui/css/bootstrap.min.css Can you recommend the appropriate syntax? Is this the best line for the js? JHtml::script(Juri::root() . 'media/com_picture/js/admin-article-o3_insertpicturestag.js'‌​); I don't have a working Joomla-style css inclusion, I am hacking with <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bo‌​otstrap.min.css" integrity="..." crossorigin="anonymous">
I tried a heap of things like: JHtmlBootstrap::framework(true); and $doc->addStyleSheet(JPATH_ROOT . '/css/bootstrap_3.css'); and $document->addStyleSheet(JURI::root() . 'media/jui/css/bootstrap.min.css', 'text/css'); and $document->addStyleSheet(str_replace("/administrator", "", $this->baseurl) . '/media/jui/css/bootstrap.min.css', 'text/css'); but even if I get the path right, the library isn't accessed and bootstrap css is not applied to my elements. I'm hoping you can share the most appropriate way to load bootstrap for the modal.
 
You can use relative flag and omit media and js folders, these will be auto-detected: JHtml::_('script', 'com_picture/admin-article-o3_insertpicturestag.js', array('version' => 'auto', 'relative' => true));. Otherwise add them too JHtml::_('script', 'media/com_picture/js/admin-article-o3_insertpicturestag.js'‌​, array('version' => 'auto'));. Is your template based on Bootstrap? If it is, I suspect that you're not loading the CSS in template's component.php file but you should. I've seen too many templates that generate unstyled pages when using tmpl=component query.
 
As for the .js inclusion, I just checked my commented-out attempts. JHtml::_('script', 'com_picture/js/admin-article-o3_insertpicturestag.js', array('version' => 'auto', 'relative' => true)); is what I first tried before my JHTML::script(Juri::root()...` work around. I tried it again and it says that my function in the file is not defined (the resource isn't loaded). What might be the issue? I've told you the filepaths. Everything is in the right location isn't it?
As for the styling, I am going to passing my work to someone else who will be doing all of the styling. I am pretty sure that he is going to use CSS Grid, but I am trying to draft things with bootstrap to get the general concept in place. Are you saying I should abstract my component further to include a full-blown template? (it seems like overkill to me, but maybe it is not)
 
11:08 AM
For the first one remove js folder because you are using relative flag. For the second one I can only guess it's the same. Note that you don't need to use JUri::root() here.
 
removing /js gives me undefined with the resource not loading. AAAHHH, there is something wrong with if (!window.parent.Joomla.getOptions('xtd... in my .js file. What should ... be?
I previously copied if (!Joomla.getOptions('xtd-contacts')) { // Something went wrong! window.parent.jModalClose(); return false; } from media/com_contact/js/admin-contacts-modal.js to create my admin-article-o3_insertpicturestag.js I removed the conditional checkpoint and everything works, but do I need to keep this checkpoint to be safe?
I am not able to load the preloaded jui/css/bootstrap.min.css resource with JHtml::_'script'.. approach. I merely need to apply the existing copy of bootstrap to render my modal properly.
 
That snippet is related to this code in modal.php layout: JFactory::getDocument()->addScriptOptions('xtd-contacts', array('editor' => $editor));. Change xtd-contacts in both places to something else, e.g. xtd-pictures. Regarding Bootstrap, it is still unclear whether your template includes BS styling globally (in index.php file) or not. If it does, it should also do so in component.php file.
To load Joomla's Bootstrap files, use JHtml::_('bootstrap.loadCss', true, $direction); where $direction is language direction. To load specific stylesheets: JHtml::_('stylesheet', 'jui/bootstrap.min.css', array('version' => 'auto', 'relative' => true)); or JHtml::_('stylesheet', 'media/jui/css/bootstrap.min.css', array('version' => 'auto'));
 

  last day (16 days later) »