diff --git a/administrator/components/com_content/views/articles/tmpl/modal.php b/administrator/components/com_content/views/articles/tmpl/modal.php index 9365c667e98e6..89dcbc54824da 100644 --- a/administrator/components/com_content/views/articles/tmpl/modal.php +++ b/administrator/components/com_content/views/articles/tmpl/modal.php @@ -29,9 +29,41 @@ $searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter'); JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom')); -$function = $app->input->getCmd('function', 'jSelectArticle'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); +$editor = $app->input->getCmd('editor', ''); +$function = $app->input->getCmd('function', 'jSelectArticle'); + +if ($function === 'jSelectArticle') +{ + /** + * The function jSelectArticle is used on XTD Article + * Javascript to insert the link + * View element calls jSelectArticle when an article is clicked + * jSelectArticle creates the link tag, sends it to the editor, + * and closes the select frame. + */ + JFactory::getDocument()->addScriptDeclaration( + " + function jSelectArticle(id, title, catid, object, link, lang) { + var hreflang = ''; + if (lang !== '') { + var hreflang = ' hreflang = \"' + lang + '\"'; + } + var tag = '' + title + ''; + window.parent.jInsertEditorText(tag, '" . $editor . "'); + window.parent.jModalClose(); + } + " + ); +} +else +{ + /** + * This case is used in administrator component menus + */ + $function ='if (window.parent) window.parent.' . $function; +} ?>
@@ -111,7 +143,7 @@ - + escape($item->title); ?>
escape($item->category_title); ?> diff --git a/administrator/templates/hathor/html/com_content/articles/modal.php b/administrator/templates/hathor/html/com_content/articles/modal.php index 7a03a43a507ba..7255d1e2e946d 100644 --- a/administrator/templates/hathor/html/com_content/articles/modal.php +++ b/administrator/templates/hathor/html/com_content/articles/modal.php @@ -20,11 +20,44 @@ JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -$function = $app->input->getCmd('function', 'jSelectArticle'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); +$editor = $app->input->getCmd('editor', ''); +$function = $app->input->getCmd('function', 'jSelectArticle'); + +if ($function === 'jSelectArticle') +{ + /** + * The function jSelectArticle is used on XTD Article + * Javascript to insert the link + * View element calls jSelectArticle when an article is clicked + * jSelectArticle creates the link tag, sends it to the editor, + * and closes the select frame. + */ + JFactory::getDocument()->addScriptDeclaration( + " + function jSelectArticle(id, title, catid, object, link, lang) { + var hreflang = ''; + if (lang !== '') { + var hreflang = ' hreflang = \"' + lang + '\"'; + } + var tag = '' + title + ''; + window.parent.jInsertEditorText(tag, '" . $editor . "'); + window.parent.jModalClose(); + } + " + ); +} +else +{ + /** + * This case is used in administrator component menus + */ + $function ='if (window.parent) window.parent.' . $function; +} ?> -
+