'); option.text(val.title).val(val.id); $('#jform_parent_id').append(option); }); $('#jform_parent_id').trigger('liszt:updated'); }); }); // Menu type Login Form specific $('#item-form').on('submit', function() { if ($('#jform_params_login_redirect_url') && $('#jform_params_logout_redirect_url')) { // Login if ($('#jform_params_login_redirect_url').closest('.control-group').css('display') === 'block') { $('#jform_params_login_redirect_menuitem_id').val(''); } if ($('#jform_params_login_redirect_menuitem_name').closest('.control-group').css('display') === 'block') { $('#jform_params_login_redirect_url').val(''); } // Logout if ($('#jform_params_logout_redirect_url').closest('.control-group').css('display') === 'block') { $('#jform_params_logout_redirect_menuitem_id').val(''); } if ($('#jform_params_logout_redirect_menuitem_id').closest('.control-group').css('display') === 'block') { $('#jform_params_logout_redirect_url').val(''); } } }); }); Joomla.submitbutton = function(task, type){ if (task == 'item.setType' || task == 'item.setMenuType') { if (task == 'item.setType') { jQuery('#item-form input[name=\"jform[type]\"]').val(type); jQuery('#fieldtype').val('type'); } else { jQuery('#item-form input[name=\"jform[menutype]\"]').val(type); } Joomla.submitform('item.setType', document.getElementById('item-form')); } else if (task == 'item.cancel' || document.formvalidator.isValid(document.getElementById('item-form'))) { Joomla.submitform(task, document.getElementById('item-form')); // @deprecated 4.0 The following js is not needed since 3.7.0. if (task !== 'item.apply') { window.parent.jQuery('#menuEdit" . (int) $this->item->id . "Modal').modal('hide'); } } else { // special case for modal popups validation response jQuery('#item-form .modal-value.invalid').each(function(){ var field = jQuery(this), idReversed = field.attr('id').split('').reverse().join(''), separatorLocation = idReversed.indexOf('_'), nameId = '#' + idReversed.substr(separatorLocation).split('').reverse().join('') + 'name'; jQuery(nameId).addClass('invalid'); }); } }; "; $input = JFactory::getApplication()->input; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration($script); // In case of modal $isModal = $input->get('layout') == 'modal' ? true : false; $layout = $isModal ? 'modal' : 'edit'; $tmpl = $isModal || $input->get('tmpl', '', 'cmd') === 'component' ? '&tmpl=component' : ''; $clientId = $this->state->get('item.client_id', 0); $lang = JFactory::getLanguage()->getTag(); // Load mod_menu.ini file when client is administrator if ($clientId === 1) { JFactory::getLanguage()->load('mod_menu', JPATH_ADMINISTRATOR, null, false, true); } ?>