diff --git a/administrator/components/com_categories/models/fields/categoryedit.php b/administrator/components/com_categories/models/fields/categoryedit.php
index f1db512ea4448..5b7fc7ce90dfb 100644
--- a/administrator/components/com_categories/models/fields/categoryedit.php
+++ b/administrator/components/com_categories/models/fields/categoryedit.php
@@ -161,7 +161,15 @@ protected function getOptions()
// Filter language
if (!empty($this->element['language']))
{
- $subQuery->where('language = ' . $db->quote($this->element['language']));
+ if (strpos($this->element['language'], ',') !== false)
+ {
+ $language = implode(',', $db->quote(explode(',', $this->element['language'])));
+ }
+ else
+ {
+ $language = $db->quote($this->element['language']);
+ }
+ $subQuery->where($db->quoteName('language') . ' IN (' . $language . ')');
}
// Filter on the published state
diff --git a/administrator/components/com_content/models/article.php b/administrator/components/com_content/models/article.php
index e062ed0d586c2..e2d4ce55d9c76 100644
--- a/administrator/components/com_content/models/article.php
+++ b/administrator/components/com_content/models/article.php
@@ -765,6 +765,8 @@ protected function preprocessForm(JForm $form, $data, $group = 'content')
$field->addAttribute('language', $tag);
$field->addAttribute('label', $language->title);
$field->addAttribute('translate_label', 'false');
+ $field->addAttribute('select', 'true');
+ $field->addAttribute('new', 'true');
$field->addAttribute('edit', 'true');
$field->addAttribute('clear', 'true');
}
diff --git a/administrator/components/com_content/models/fields/modal/article.php b/administrator/components/com_content/models/fields/modal/article.php
index e65c08b24b5f2..499d15acf4d2d 100644
--- a/administrator/components/com_content/models/fields/modal/article.php
+++ b/administrator/components/com_content/models/fields/modal/article.php
@@ -33,8 +33,10 @@ class JFormFieldModal_Article extends JFormField
*/
protected function getInput()
{
- $allowEdit = ((string) $this->element['edit'] == 'true') ? true : false;
- $allowClear = ((string) $this->element['clear'] != 'false') ? true : false;
+ $allowNew = ((string) $this->element['new'] == 'true');
+ $allowEdit = ((string) $this->element['edit'] == 'true');
+ $allowClear = ((string) $this->element['clear'] != 'false');
+ $allowSelect = ((string) $this->element['select'] != 'false');
// Load language
JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR);
@@ -42,74 +44,38 @@ protected function getInput()
// The active article id field.
$value = (int) $this->value > 0 ? (int) $this->value : '';
- // Build the script.
- $script = array();
+ // Create the modal id.
+ $modalId = 'Article_' . $this->id;
- // Select button script
- $script[] = ' function jSelectArticle_' . $this->id . '(id, title, catid, object) {';
- $script[] = ' document.getElementById("' . $this->id . '_id").value = id;';
- $script[] = ' document.getElementById("' . $this->id . '_name").value = title;';
+ // Add the modal field script to the document head.
+ JHtml::_('jquery.framework');
+ JHtml::_('script', 'system/modal-fields.js', false, true);
- if ($allowEdit)
- {
- $script[] = ' if (id == "' . $value . '") {';
- $script[] = ' jQuery("#' . $this->id . '_edit").removeClass("hidden");';
- $script[] = ' } else {';
- $script[] = ' jQuery("#' . $this->id . '_edit").addClass("hidden");';
- $script[] = ' }';
- }
-
- if ($allowClear)
+ // Script to proxy the select modal function to the modal-fields.js file.
+ if ($allowSelect)
{
- $script[] = ' jQuery("#' . $this->id . '_clear").removeClass("hidden");';
- }
-
- $script[] = ' jQuery("#articleSelect' . $this->id . 'Modal").modal("hide");';
-
- if ($this->required)
- {
- $script[] = ' document.formvalidator.validate(document.getElementById("' . $this->id . '_id"));';
- $script[] = ' document.formvalidator.validate(document.getElementById("' . $this->id . '_name"));';
- }
-
- $script[] = ' }';
+ static $scriptSelect = null;
- // Edit button script
- $script[] = ' function jEditArticle_' . $value . '(title) {';
- $script[] = ' document.getElementById("' . $this->id . '_name").value = title;';
- $script[] = ' }';
-
- // Clear button script
- static $scriptClear;
+ if (is_null($scriptSelect))
+ {
+ $scriptSelect = array();
+ }
- if ($allowClear && !$scriptClear)
- {
- $scriptClear = true;
+ if (!isset($scriptSelect[$this->id]))
+ {
+ JFactory::getDocument()->addScriptDeclaration("
+ function jSelectArticle_" . $this->id . "(id, title, catid, object, url, language) {
+ window.processModalSelect('Article', '" . $this->id . "', id, title, catid, object, url, language);
+ }
+ ");
- $script[] = ' function jClearArticle(id) {';
- $script[] = ' document.getElementById(id + "_id").value = "";';
- $script[] = ' document.getElementById(id + "_name").value = "' .
- htmlspecialchars(JText::_('COM_CONTENT_SELECT_AN_ARTICLE', true), ENT_COMPAT, 'UTF-8') . '";';
- $script[] = ' jQuery("#"+id + "_clear").addClass("hidden");';
- $script[] = ' if (document.getElementById(id + "_edit")) {';
- $script[] = ' jQuery("#"+id + "_edit").addClass("hidden");';
- $script[] = ' }';
- $script[] = ' return false;';
- $script[] = ' }';
+ $scriptSelect[$this->id] = true;
+ }
}
- // Add the script to the document head.
- JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));
-
// Setup variables for display.
- $html = array();
-
- $linkArticles = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component'
- . '&function=jSelectArticle_' . $this->id;
-
- $linkArticle = 'index.php?option=com_content&view=article&layout=modal&tmpl=component'
- . '&task=article.edit'
- . '&function=jEditArticle_' . $value;
+ $linkArticles = 'index.php?option=com_content&view=articles&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1';
+ $linkArticle = 'index.php?option=com_content&view=article&layout=modal&tmpl=component&' . JSession::getFormToken() . '=1';
if (isset($this->element['language']))
{
@@ -122,8 +88,9 @@ protected function getInput()
$modalTitle = JText::_('COM_CONTENT_CHANGE_ARTICLE');
}
- $urlSelect = $linkArticles . '&' . JSession::getFormToken() . '=1';
- $urlEdit = $linkArticle . '&id=' . $value . '&' . JSession::getFormToken() . '=1';
+ $urlSelect = $linkArticles . '&function=jSelectArticle_' . $this->id;
+ $urlEdit = $linkArticle . '&task=article.edit&id=\' + document.getElementById("' . $this->id . '_id").value + \'';
+ $urlNew = $linkArticle . '&task=article.add';
if ($value)
{
@@ -144,36 +111,49 @@ protected function getInput()
}
}
- if (empty($title))
- {
- $title = JText::_('COM_CONTENT_SELECT_AN_ARTICLE');
- }
-
- $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
+ $title = empty($title) ? JText::_('COM_CONTENT_SELECT_AN_ARTICLE') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
// The current article display field.
- $html[] = '';
- $html[] = '';
+ $html = '';
+ $html .= '';
// Select article button
- $html[] = ''
- . ' ' . JText::_('JSELECT')
- . '';
+ if ($allowSelect)
+ {
+ $html .= ''
+ . ' ' . JText::_('JSELECT')
+ . '';
+ }
+
+ // New article button
+ if ($allowNew)
+ {
+ $html .= ''
+ . ' ' . JText::_('JACTION_CREATE')
+ . '';
+ }
// Edit article button
if ($allowEdit)
{
- $html[] = ''
. ' ' . JText::_('JACTION_EDIT')
. '';
@@ -182,64 +162,100 @@ protected function getInput()
// Clear article button
if ($allowClear)
{
- $html[] = '';
+ . '';
}
- $html[] = '';
+ $html .= '';
// Select article modal
- $html[] = JHtml::_(
- 'bootstrap.renderModal',
- 'articleSelect' . $this->id . 'Modal',
- array(
- 'title' => $modalTitle,
- 'url' => $urlSelect,
- 'height' => '400px',
- 'width' => '800px',
- 'bodyHeight' => '70',
- 'modalWidth' => '80',
- 'footer' => ''
- . JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '',
- )
- );
+ if ($allowSelect)
+ {
+ $html .= JHtml::_(
+ 'bootstrap.renderModal',
+ 'ModalSelect' . $modalId,
+ array(
+ 'title' => $modalTitle,
+ 'url' => $urlSelect,
+ 'height' => '400px',
+ 'width' => '800px',
+ 'bodyHeight' => '70',
+ 'modalWidth' => '80',
+ 'footer' => '' . JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . '',
+ )
+ );
+ }
+
+ // New article modal
+ if ($allowNew)
+ {
+ $html .= JHtml::_(
+ 'bootstrap.renderModal',
+ 'ModalNew' . $modalId,
+ array(
+ 'title' => JText::_('COM_CONTENT_NEW_ARTICLE'),
+ 'backdrop' => 'static',
+ 'keyboard' => false,
+ 'closeButton' => false,
+ 'url' => $urlNew,
+ 'height' => '400px',
+ 'width' => '800px',
+ 'bodyHeight' => '70',
+ 'modalWidth' => '80',
+ 'footer' => ''
+ . JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . ''
+ . ''
+ . JText::_("JSAVE") . ''
+ . ''
+ . JText::_("JAPPLY") . '',
+ )
+ );
+ }
// Edit article modal
- $html[] = JHtml::_(
- 'bootstrap.renderModal',
- 'articleEdit' . $value . 'Modal',
- array(
- 'title' => JText::_('COM_CONTENT_EDIT_ARTICLE'),
- 'backdrop' => 'static',
- 'keyboard' => false,
- 'closeButton' => false,
- 'url' => $urlEdit,
- 'height' => '400px',
- 'width' => '800px',
- 'bodyHeight' => '70',
- 'modalWidth' => '80',
- 'footer' => ''
- . JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . ''
- . ''
- . '',
- )
- );
+ if ($allowEdit)
+ {
+ $html .= JHtml::_(
+ 'bootstrap.renderModal',
+ 'ModalEdit' . $modalId,
+ array(
+ 'title' => JText::_('COM_CONTENT_EDIT_ARTICLE'),
+ 'backdrop' => 'static',
+ 'keyboard' => false,
+ 'closeButton' => false,
+ 'url' => $urlEdit,
+ 'height' => '400px',
+ 'width' => '800px',
+ 'bodyHeight' => '70',
+ 'modalWidth' => '80',
+ 'footer' => ''
+ . JText::_("JLIB_HTML_BEHAVIOR_CLOSE") . ''
+ . ''
+ . JText::_("JSAVE") . ''
+ . ''
+ . JText::_("JAPPLY") . '',
+ )
+ );
+ }
// Note: class='required' for client side validation.
$class = $this->required ? ' class="required modal-value"' : '';
- $html[] = '';
+ $html .= '';
- return implode("\n", $html);
+ return $html;
}
/**
diff --git a/administrator/components/com_content/views/article/tmpl/edit.php b/administrator/components/com_content/views/article/tmpl/edit.php
index ee47b36fed8b3..5b88d8dd4da7a 100644
--- a/administrator/components/com_content/views/article/tmpl/edit.php
+++ b/administrator/components/com_content/views/article/tmpl/edit.php
@@ -70,6 +70,7 @@
' . $this->form->getField('articletext')->save() . '
Joomla.submitform(task, document.getElementById("item-form"));
+ // @deprecated 4.0 The following js is not needed since __DEPLOY_VERSION__.
if (task !== "article.apply")
{
window.parent.jQuery("#articleEdit' . (int) $this->item->id . 'Modal").modal("hide");
@@ -165,6 +166,7 @@
+
diff --git a/administrator/components/com_content/views/article/tmpl/modal.php b/administrator/components/com_content/views/article/tmpl/modal.php
index 2352299cea96e..c1a1448d6feda 100644
--- a/administrator/components/com_content/views/article/tmpl/modal.php
+++ b/administrator/components/com_content/views/article/tmpl/modal.php
@@ -11,6 +11,7 @@
JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom'));
+// @deprecated 4.0 the function parameter, the inline js and the buttons are not needed since __DEPLOY_VERSION__.
$function = JFactory::getApplication()->input->getCmd('function', 'jEditArticle_' . (int) $this->item->id);
// Function to update input title when changed
diff --git a/administrator/components/com_content/views/article/view.html.php b/administrator/components/com_content/views/article/view.html.php
index 64983e04babfa..99ca55b2672bc 100644
--- a/administrator/components/com_content/views/article/view.html.php
+++ b/administrator/components/com_content/views/article/view.html.php
@@ -59,9 +59,25 @@ public function display($tpl = null)
}
if ($this->getLayout() == 'modal')
+ {
+ // If we are forcing a language in modal (used for associations).
+ if ($forcedLanguage = JFactory::getApplication()->input->get('forcedLanguage', '', 'cmd'))
+ {
+ // Set the language field to the forcedLanguage and disable changing it.
+ $this->form->setValue('language', null, $forcedLanguage);
+ $this->form->setFieldAttribute('language', 'readonly', 'true');
+
+ // Only allow to select categories with All language or with the forced language.
+ $this->form->setFieldAttribute('catid', 'language', '*,' . $forcedLanguage);
+
+ // Only allow to select tags with All language or with the forced language.
+ $this->form->setFieldAttribute('tags', 'language', '*,' . $forcedLanguage);
+ }
+ }
+ // If not in associations modal, block the language change if in edit modal, language not All and associations enabled.
+ elseif ($this->item->id && $this->form->getValue('language', null, '*') != '*' && JLanguageAssociations::isEnabled())
{
$this->form->setFieldAttribute('language', 'readonly', 'true');
- $this->form->setFieldAttribute('catid', 'readonly', 'true');
}
$this->addToolbar();
diff --git a/components/com_content/views/article/tmpl/default.xml b/components/com_content/views/article/tmpl/default.xml
index 4f4e9763c6428..9fdf8ac2dc7e8 100644
--- a/components/com_content/views/article/tmpl/default.xml
+++ b/components/com_content/views/article/tmpl/default.xml
@@ -17,8 +17,10 @@
diff --git a/libraries/cms/form/field/tag.php b/libraries/cms/form/field/tag.php
index 4a79e6b7f9db7..3ebf582c04a13 100644
--- a/libraries/cms/form/field/tag.php
+++ b/libraries/cms/form/field/tag.php
@@ -121,7 +121,16 @@ protected function getOptions()
// Filter language
if (!empty($this->element['language']))
{
- $query->where('a.language = ' . $db->q($this->element['language']));
+ if (strpos($this->element['language'], ',') !== false)
+ {
+ $language = implode(',', $db->quote(explode(',', $this->element['language'])));
+ }
+ else
+ {
+ $language = $db->quote($this->element['language']);
+ }
+
+ $query->where($db->quoteName('a.language') . ' IN (' . $language . ')');
}
$query->where($db->qn('a.lft') . ' > 0');
diff --git a/libraries/legacy/controller/form.php b/libraries/legacy/controller/form.php
index 76f929bee4476..08a5689d381a0 100644
--- a/libraries/legacy/controller/form.php
+++ b/libraries/legacy/controller/form.php
@@ -462,21 +462,24 @@ public function getModel($name = '', $prefix = '', $config = array('ignore_reque
*/
protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
{
- $tmpl = $this->input->get('tmpl');
- $layout = $this->input->get('layout', 'edit', 'string');
$append = '';
// Setup redirect info.
- if ($tmpl)
+ if ($tmpl = $this->input->get('tmpl', '', 'string'))
{
$append .= '&tmpl=' . $tmpl;
}
- if ($layout)
+ if ($layout = $this->input->get('layout', 'edit', 'string'))
{
$append .= '&layout=' . $layout;
}
+ if ($forcedLanguage = $this->input->get('forcedLanguage', '', 'cmd'))
+ {
+ $append .= '&forcedLanguage=' . $forcedLanguage;
+ }
+
if ($recordId)
{
$append .= '&' . $urlVar . '=' . $recordId;
@@ -494,15 +497,19 @@ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id')
*/
protected function getRedirectToListAppend()
{
- $tmpl = $this->input->get('tmpl');
$append = '';
// Setup redirect info.
- if ($tmpl)
+ if ($tmpl = $this->input->get('tmpl', '', 'string'))
{
$append .= '&tmpl=' . $tmpl;
}
+ if ($forcedLanguage = $this->input->get('forcedLanguage', '', 'cmd'))
+ {
+ $append .= '&forcedLanguage=' . $forcedLanguage;
+ }
+
return $append;
}
diff --git a/media/system/js/modal-fields-uncompressed.js b/media/system/js/modal-fields-uncompressed.js
new file mode 100644
index 0000000000000..e2e61b44c1bb2
--- /dev/null
+++ b/media/system/js/modal-fields-uncompressed.js
@@ -0,0 +1,192 @@
+/**
+ * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
+ * @license GNU General Public License version 2 or later; see LICENSE.txt
+ */
+
+(function() {
+ "use strict";
+
+ /**
+ * Process modal fields in parent.
+ *
+ * @param string fieldPrefix The fields to be updated prefix.
+ * @param string id The new id for the item.
+ * @param string title The new title for the item.
+ * @param string catid Future usage.
+ * @param object object Future usage.
+ * @param string url Future usage.
+ * @param string language Future usage.
+ *
+ * @return boolean
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ window.processModalParent = function (fieldPrefix, id, title, catid, url, language, object)
+ {
+ var fieldId = document.getElementById(fieldPrefix + '_id'), fieldTitle = document.getElementById(fieldPrefix + '_name');
+
+ // Default values.
+ id = id || '';
+ title = title || '';
+ catid = catid || '';
+ object = object || '';
+ url = url || '';
+ language = language || '';
+
+ if (id)
+ {
+ fieldId.value = id;
+ fieldTitle.value = title;
+
+ if (document.getElementById(fieldPrefix + '_select'))
+ {
+ jQuery('#' + fieldPrefix + '_select').addClass('hidden');
+ }
+ if (document.getElementById(fieldPrefix + '_new'))
+ {
+ jQuery('#' + fieldPrefix + '_new').addClass('hidden');
+ }
+ if (document.getElementById(fieldPrefix + '_edit'))
+ {
+ jQuery('#' + fieldPrefix + '_edit').removeClass('hidden');
+ }
+ if (document.getElementById(fieldPrefix + '_clear'))
+ {
+ jQuery('#' + fieldPrefix + '_clear').removeClass('hidden');
+ }
+ }
+ else
+ {
+ fieldId.value = '';
+ fieldTitle.value = fieldId.getAttribute('data-text');
+
+ if (document.getElementById(fieldPrefix + '_select'))
+ {
+ jQuery('#' + fieldPrefix + '_select').removeClass('hidden');
+ }
+ if (document.getElementById(fieldPrefix + '_new'))
+ {
+ jQuery('#' + fieldPrefix + '_new').removeClass('hidden');
+ }
+ if (document.getElementById(fieldPrefix + '_edit'))
+ {
+ jQuery('#' + fieldPrefix + '_edit').addClass('hidden');
+ }
+ if (document.getElementById(fieldPrefix + '_clear'))
+ {
+ jQuery('#' + fieldPrefix + '_clear').addClass('hidden');
+ }
+ }
+
+ if (fieldId.getAttribute('data-required') == '1')
+ {
+ document.formvalidator.validate(fieldId);
+ document.formvalidator.validate(fieldTitle);
+ }
+
+ return false;
+ }
+
+ /**
+ * Process new/edit modal fields in child.
+ *
+ * @param object element The modal footer button element.
+ * @param string fieldPrefix The fields to be updated prefix.
+ * @param string action Modal action (add, edit).
+ * @param string itemType The item type (Article, Contact, etc).
+ * @param string task Task to be done (apply, save, cancel).
+ * @param string formId Id of the form field (defaults to itemtype-form).
+ * @param string idFieldId Id of the id field (defaults to jform_id).
+ * @param string titleFieldId Id of the title field (defaults to jform_title).
+ *
+ * @return boolean
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ window.processModalEdit = function (element, fieldPrefix, action, itemType, task, formId, idFieldId, titleFieldId)
+ {
+ formId = formId || itemType.toLowerCase() + '-form';
+ idFieldId = idFieldId || 'jform_id';
+ titleFieldId = titleFieldId || 'jform_title';
+
+ var modalId = element.parentNode.parentNode.id, submittedTask = task;
+
+ // Set frame id.
+ jQuery('#' + modalId + ' iframe').get(0).id = 'Frame_' + modalId;
+
+ var iframeDocument = jQuery('#Frame_' + modalId).contents().get(0);
+
+ // If Close (cancel task), close the modal.
+ if (task === 'cancel')
+ {
+ // Submit button on child iframe so we can check out.
+ document.getElementById('Frame_' + modalId).contentWindow.Joomla.submitbutton(itemType.toLowerCase() + '.' + task);
+
+ jQuery('#' + modalId).modal('hide');
+ }
+ // For Save (apply task) and Save & Close (save task).
+ else
+ {
+ // Attach onload event to the iframe.
+ jQuery('#Frame_' + modalId).on('load', function()
+ {
+ // Reload iframe document var value.
+ iframeDocument = jQuery(this).contents().get(0);
+
+ // Validate the child form and update parent form.
+ if (iframeDocument.getElementById(idFieldId) && iframeDocument.getElementById(idFieldId).value != '0')
+ {
+ window.processModalParent(fieldPrefix, iframeDocument.getElementById(idFieldId).value, iframeDocument.getElementById(titleFieldId).value);
+
+ // If Save & Close (save task), submit the edit close action (so we don't have checked out items).
+ if (task === 'save')
+ {
+ window.processModalEdit(element, fieldPrefix, 'edit', itemType, 'cancel', formId, idFieldId, titleFieldId);
+ }
+ }
+
+ // Show the iframe again for future modals or in case of error.
+ jQuery('#' + modalId + ' iframe').removeClass('hidden');
+ });
+
+ // Submit button on child iframe.
+ if (iframeDocument.formvalidator.isValid(iframeDocument.getElementById(formId)))
+ {
+ // For Save & Close (save task) when creating we need to replace the task as apply because of redirects after submit and hide the iframe.
+ if (task === 'save')
+ {
+ submittedTask = 'apply';
+ jQuery('#' + modalId + ' iframe').addClass('hidden');
+ }
+
+ document.getElementById('Frame_' + modalId).contentWindow.Joomla.submitbutton(itemType.toLowerCase() + '.' + submittedTask);
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Process select modal fields in child.
+ *
+ * @param string itemType The item type (Article, Contact, etc).
+ * @param string fieldPrefix The fields to be updated prefix.
+ * @param string id The new id for the item.
+ * @param string title The new title for the item.
+ * @param string catid Future usage.
+ * @param object object Future usage.
+ * @param string url Future usage.
+ * @param string language Future usage.
+ *
+ * @return boolean
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ window.processModalSelect = function(itemType, fieldPrefix, id, title, catid, object, url, language) {
+ window.processModalParent(fieldPrefix, id, title, catid, url, language, object);
+ jQuery('#ModalSelect' + itemType + '_' + fieldPrefix).modal('hide');
+
+ return false;
+ }
+
+}());
diff --git a/media/system/js/modal-fields.js b/media/system/js/modal-fields.js
new file mode 100644
index 0000000000000..816920dc033ee
--- /dev/null
+++ b/media/system/js/modal-fields.js
@@ -0,0 +1 @@
+!function(){"use strict";window.processModalParent=function(e,t,d,n,a,o,r){var l=document.getElementById(e+"_id"),m=document.getElementById(e+"_name");return t=t||"",d=d||"",n=n||"",r=r||"",a=a||"",o=o||"",t?(l.value=t,m.value=d,document.getElementById(e+"_select")&&jQuery("#"+e+"_select").addClass("hidden"),document.getElementById(e+"_new")&&jQuery("#"+e+"_new").addClass("hidden"),document.getElementById(e+"_edit")&&jQuery("#"+e+"_edit").removeClass("hidden"),document.getElementById(e+"_clear")&&jQuery("#"+e+"_clear").removeClass("hidden")):(l.value="",m.value=l.getAttribute("data-text"),document.getElementById(e+"_select")&&jQuery("#"+e+"_select").removeClass("hidden"),document.getElementById(e+"_new")&&jQuery("#"+e+"_new").removeClass("hidden"),document.getElementById(e+"_edit")&&jQuery("#"+e+"_edit").addClass("hidden"),document.getElementById(e+"_clear")&&jQuery("#"+e+"_clear").addClass("hidden")),"1"==l.getAttribute("data-required")&&(document.formvalidator.validate(l),document.formvalidator.validate(m)),!1},window.processModalEdit=function(e,t,d,n,a,o,r,l){o=o||n.toLowerCase()+"-form",r=r||"jform_id",l=l||"jform_title";var m=e.parentNode.parentNode.id,i=a;jQuery("#"+m+" iframe").get(0).id="Frame_"+m;var u=jQuery("#Frame_"+m).contents().get(0);return"cancel"===a?(document.getElementById("Frame_"+m).contentWindow.Joomla.submitbutton(n.toLowerCase()+"."+a),jQuery("#"+m).modal("hide")):(jQuery("#Frame_"+m).on("load",function(){u=jQuery(this).contents().get(0),u.getElementById(r)&&"0"!=u.getElementById(r).value&&(window.processModalParent(t,u.getElementById(r).value,u.getElementById(l).value),"save"===a&&window.processModalEdit(e,t,"edit",n,"cancel",o,r,l)),jQuery("#"+m+" iframe").removeClass("hidden")}),u.formvalidator.isValid(u.getElementById(o))&&("save"===a&&(i="apply",jQuery("#"+m+" iframe").addClass("hidden")),document.getElementById("Frame_"+m).contentWindow.Joomla.submitbutton(n.toLowerCase()+"."+i))),!1},window.processModalSelect=function(e,t,d,n,a,o,r,l){return window.processModalParent(t,d,n,a,r,l,o),jQuery("#ModalSelect"+e+"_"+t).modal("hide"),!1}}();
diff --git a/plugins/user/profile/profile.xml b/plugins/user/profile/profile.xml
index 04a82921ac33c..a7b8757880993 100644
--- a/plugins/user/profile/profile.xml
+++ b/plugins/user/profile/profile.xml
@@ -154,6 +154,10 @@
type="modal_article"
label="PLG_USER_PROFILE_FIELD_TOS_ARTICLE_LABEL"
description="PLG_USER_PROFILE_FIELD_TOS_ARTICLE_DESC"
+ select="true"
+ new="true"
+ edit="true"
+ clear="true"
/>