diff --git a/build/media_source/plg_editors_tinymce/js/tinymce.es6.js b/build/media_source/plg_editors_tinymce/js/tinymce.es6.js index 04ad61fe734cf..dccbd24670801 100644 --- a/build/media_source/plg_editors_tinymce/js/tinymce.es6.js +++ b/build/media_source/plg_editors_tinymce/js/tinymce.es6.js @@ -94,7 +94,7 @@ if (xtdButton.href) { tmp.onAction = () => { - document.getElementById(`${xtdButton.id}Modal`).open(); + document.getElementById(`${xtdButton.id}_modal`).open(); }; } else { tmp.onAction = () => { diff --git a/layouts/joomla/editors/buttons/button.php b/layouts/joomla/editors/buttons/button.php index a245755ca6e1d..49993ee41fb85 100644 --- a/layouts/joomla/editors/buttons/button.php +++ b/layouts/joomla/editors/buttons/button.php @@ -17,13 +17,14 @@ $class = 'btn btn-secondary'; $class .= ($button->get('class')) ? ' ' . $button->get('class') : null; $class .= ($button->get('modal')) ? ' modal-button' : null; - $href = '#' . str_replace(' ', '', $button->get('text')) . 'Modal'; + $href = '#' . strtolower($button->get('name')) . '_modal'; $link = ($button->get('link')) ? Uri::base() . $button->get('link') : null; $onclick = ($button->get('onclick')) ? ' onclick="' . $button->get('onclick') . '"' : ''; $title = ($button->get('title')) ? $button->get('title') : $button->get('text'); + $icon = ($button->get('icon')) ? $button->get('icon') : $button->get('name'); ?> diff --git a/layouts/joomla/editors/buttons/modal.php b/layouts/joomla/editors/buttons/modal.php index 93a200a483524..099590bf606d3 100644 --- a/layouts/joomla/editors/buttons/modal.php +++ b/layouts/joomla/editors/buttons/modal.php @@ -22,7 +22,7 @@ $class = ($button->get('class')) ? $button->get('class') : null; $class .= ($button->get('modal')) ? ' modal-button' : null; -$href = '#' . str_replace(' ', '', $button->get('text')) . 'Modal'; +$href = '#' . strtolower($button->get('name')) . '_modal'; $link = ($button->get('link')) ? Uri::base() . $button->get('link') : null; $onclick = ($button->get('onclick')) ? ' onclick="' . $button->get('onclick') . '"' : ''; $title = ($button->get('title')) ? $button->get('title') : $button->get('text'); @@ -42,7 +42,7 @@ } else { - $id = str_replace(' ', '', $button->get('text')) . 'Modal'; + $id = strtolower($button->get('name')) . '_modal'; } // TODO: J4: Move Make buttons fullscreen on smaller devices per https://github.com/joomla/joomla-cms/pull/23091 diff --git a/plugins/editors-xtd/article/article.php b/plugins/editors-xtd/article/article.php index 86cec46fe207f..62f1cb0c270ef 100644 --- a/plugins/editors-xtd/article/article.php +++ b/plugins/editors-xtd/article/article.php @@ -61,15 +61,15 @@ public function onDisplay($name) $link = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&' . Session::getFormToken() . '=1&editor=' . $name; - $button = new CMSObject; - $button->modal = true; - $button->link = $link; - $button->text = Text::_('PLG_ARTICLE_BUTTON_ARTICLE'); - $button->name = 'file-add'; - $button->iconSVG = ''; - $button->realName = 'PlgButtonArticle'; - $button->options = [ + $button->options = [ 'height' => '300px', 'width' => '800px', 'bodyHeight' => '70', diff --git a/plugins/editors-xtd/contact/contact.php b/plugins/editors-xtd/contact/contact.php index cff2f99803496..83c431e2b4913 100644 --- a/plugins/editors-xtd/contact/contact.php +++ b/plugins/editors-xtd/contact/contact.php @@ -55,7 +55,8 @@ public function onDisplay($name) $button->modal = true; $button->link = $link; $button->text = Text::_('PLG_EDITORS-XTD_CONTACT_BUTTON_CONTACT'); - $button->name = 'address'; + $button->name = $this->_type . '_' . $this->_name; + $button->icon = 'address'; $button->iconSVG = ''; $button->options = [ - 'height' => '400px', - 'width' => '800px', - 'bodyHeight' => '70', - 'modalWidth' => '80', - 'tinyPath' => $link, + 'height' => '400px', + 'width' => '800px', + 'bodyHeight' => '70', + 'modalWidth' => '80', + 'tinyPath' => $link, 'confirmCallback' => 'Joomla.getImage(Joomla.selectedMediaFile, \'' . $name . '\', this)', - 'confirmText' => Text::_('PLG_IMAGE_BUTTON_INSERT') + 'confirmText' => Text::_('PLG_IMAGE_BUTTON_INSERT') ]; return $button; diff --git a/plugins/editors-xtd/menu/menu.php b/plugins/editors-xtd/menu/menu.php index 2421c2824bae4..61b0d08a7eab0 100644 --- a/plugins/editors-xtd/menu/menu.php +++ b/plugins/editors-xtd/menu/menu.php @@ -52,11 +52,12 @@ public function onDisplay($name) $link = 'index.php?option=com_menus&view=items&layout=modal&tmpl=component&' . Session::getFormToken() . '=1&editor=' . $name; - $button = new CMSObject; + $button = new CMSObject; $button->modal = true; $button->link = $link; $button->text = Text::_('PLG_EDITORS-XTD_MENU_BUTTON_MENU'); - $button->name = 'list'; + $button->name = $this->_type . '_' . $this->_name; + $button->icon = 'list'; $button->iconSVG = ''; $button->options = [ - 'height' => '300px', - 'width' => '800px', + 'height' => '300px', + 'width' => '800px', 'bodyHeight' => '70', 'modalWidth' => '80', ]; diff --git a/plugins/editors-xtd/module/module.php b/plugins/editors-xtd/module/module.php index dd9b8c9d341d0..9f03874d7c817 100644 --- a/plugins/editors-xtd/module/module.php +++ b/plugins/editors-xtd/module/module.php @@ -53,12 +53,13 @@ public function onDisplay($name) { $link = 'index.php?option=com_modules&view=modules&layout=modal&tmpl=component&editor=' . $name . '&' . Session::getFormToken() . '=1'; - $button = new CMSObject; + $button = new CMSObject; $button->modal = true; $button->link = $link; $button->text = Text::_('PLG_MODULE_BUTTON_MODULE'); - $button->name = 'cube'; - $button->iconSVG = ''; diff --git a/plugins/editors-xtd/pagebreak/pagebreak.php b/plugins/editors-xtd/pagebreak/pagebreak.php index f1c823c33636a..639d6ca497d48 100644 --- a/plugins/editors-xtd/pagebreak/pagebreak.php +++ b/plugins/editors-xtd/pagebreak/pagebreak.php @@ -60,11 +60,12 @@ public function onDisplay($name) Factory::getDocument()->addScriptOptions('xtd-pagebreak', array('editor' => $name)); $link = 'index.php?option=com_content&view=article&layout=pagebreak&tmpl=component&e_name=' . $name; - $button = new CMSObject; + $button = new CMSObject; $button->modal = true; $button->link = $link; $button->text = Text::_('PLG_EDITORSXTD_PAGEBREAK_BUTTON_PAGEBREAK'); - $button->name = 'copy'; + $button->name = $this->_type . '_' . $this->_name; + $button->icon = 'copy'; $button->iconSVG = ''; diff --git a/plugins/editors-xtd/readmore/readmore.php b/plugins/editors-xtd/readmore/readmore.php index cca42f8dcded5..2bb52f899c803 100644 --- a/plugins/editors-xtd/readmore/readmore.php +++ b/plugins/editors-xtd/readmore/readmore.php @@ -63,7 +63,8 @@ public function onDisplay($name) $button->modal = false; $button->onclick = 'insertReadmore(\'' . $name . '\');return false;'; $button->text = Text::_('PLG_READMORE_BUTTON_READMORE'); - $button->name = 'arrow-down'; + $button->name = $this->_type . '_' . $this->_name; + $button->icon = 'arrow-down'; $button->iconSVG = ''; $button->link = '#'; diff --git a/plugins/editors/tinymce/tinymce.php b/plugins/editors/tinymce/tinymce.php index 2a278893bf104..87c53decd0926 100644 --- a/plugins/editors/tinymce/tinymce.php +++ b/plugins/editors/tinymce/tinymce.php @@ -697,7 +697,7 @@ private function tinyButtons($name, $excluded) // Build the script foreach ($buttons as $i => $button) { - $button->id = $name . '_' . $button->text . 'Modal'; + $button->id = $name . '_' . $button->name . '_modal'; echo LayoutHelper::render('joomla.editors.buttons.modal', $button); @@ -705,9 +705,9 @@ private function tinyButtons($name, $excluded) { // Set some vars $btnName = $button->get('text'); - $modalId = $name . '_' . str_replace(' ', '', $button->get('text')); + $modalId = $name . '_' . $button->name; $onclick = $button->get('onclick') ?: null; - $icon = $button->get('name'); + $icon = $button->get('icon'); if ($button->get('link') !== '#') {