Skip to content

Commit

Permalink
Custom Admin menu item edit: Display Title, Parent Item and Ordering …
Browse files Browse the repository at this point in the history
…translations (joomla#19916)

* Admin menu item edit: Display Title, Parent Item and Ordering
translations

* Modifs suggested by izharaazmi

* cs

* display translated title only when item exists

* Correcting label alignment

* Cosmetic changes
  • Loading branch information
infograf768 authored and mbabker committed Mar 17, 2018
1 parent 5a2b1c1 commit c784a6a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
24 changes: 22 additions & 2 deletions administrator/components/com_menus/views/item/tmpl/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
$('#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')) {
Expand Down Expand Up @@ -114,13 +114,33 @@
$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);
}
?>
<form action="<?php echo JRoute::_('index.php?option=com_menus&view=item&client_id=' . $clientId . '&layout=' . $layout . $tmpl . '&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="item-form" class="form-validate">

<?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>

<div class="form-horizontal">
<?php // Add the translation of the menu item title when client is administrator ?>
<?php if ($clientId === 1 && $this->item->id != 0) : ?>
<div class="form-inline form-inline-header">
<div class="control-group">
<div class="control-label">
<label><?php echo JText::sprintf('COM_MENUS_TITLE_TRANSLATION', $lang); ?></label>
</div>
<div class="controls">
<input class="input-xlarge" value="<?php echo JText::_($this->item->title); ?>" readonly="readonly" type="text">
</div>
</div>
</div>
<?php endif; ?>

<div class="form-horizontal">
<?php echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'details')); ?>

<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'details', JText::_('COM_MENUS_ITEM_DETAILS')); ?>
Expand Down
1 change: 1 addition & 0 deletions administrator/language/en-GB/en-GB.com_menus.ini
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ COM_MENUS_SUCCESS_REORDERED="Menu item reordered."
COM_MENUS_TIP_ALIAS_LABEL="<strong>Warning!</strong><br />Leave the alias field empty if the menu item alias and the menu item linked to by the alias have the same parent."
COM_MENUS_TIP_ASSOCIATION="Associated menu items"
COM_MENUS_TITLE_EDIT_ITEM="Menu Manager: Title Edit Item"
COM_MENUS_TITLE_TRANSLATION="Title (%s)"
COM_MENUS_TOOLBAR_SET_HOME="Home"
COM_MENUS_TYPE_ALIAS="Menu Item Alias"
COM_MENUS_TYPE_ALIAS_DESC="Create an alias to another menu item."
Expand Down

0 comments on commit c784a6a

Please sign in to comment.