Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] com_menu - Change Featured Icon to Home Icon in #29016

Merged
merged 5 commits into from
May 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion administrator/components/com_menus/tmpl/items/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
<td class="text-center d-none d-md-table-cell">
<?php if ($item->type == 'component') : ?>
<?php if ($item->language == '*' || $item->home == '0') : ?>
<?php echo HTMLHelper::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange && !$item->protected); ?>
<?php echo HTMLHelper::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange && !$item->protected, 'cb', null, 'home', 'circle'); ?>
<?php elseif ($canChange) : ?>
<a href="<?php echo Route::_('index.php?option=com_menus&task=items.unsetDefault&cid[]=' . $item->id . '&' . Session::getFormToken() . '=1'); ?>">
<?php if ($item->language_image) : ?>
Expand Down
2 changes: 1 addition & 1 deletion administrator/modules/mod_menu/tmpl/default_submenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
{
if (substr($iconImage, 0, 6) == 'class:' && substr($iconImage, 6) == 'icon-home')
{
$iconImage = '<span class="home-image fas fa-star" aria-hidden="true"></span>';
$iconImage = '<span class="home-image fas fa-home" aria-hidden="true"></span>';
$iconImage .= '<span class="sr-only">' . Text::_('JDEFAULT') . '</span>';
}
elseif (substr($iconImage, 0, 6) == 'image:')
Expand Down
2 changes: 1 addition & 1 deletion administrator/modules/mod_submenu/src/Menu/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static function preprocess($parent)
{
if (substr($iconImage, 0, 6) === 'class:' && substr($iconImage, 6) === 'icon-home')
{
$iconImage = '<span class="home-image fas fa-star" aria-hidden="true"></span>';
$iconImage = '<span class="home-image fas fa-home" aria-hidden="true"></span>';
$iconImage .= '<span class="sr-only">' . Text::_('JDEFAULT') . '</span>';
}
elseif (substr($iconImage, 0, 6) === 'image:')
Expand Down
10 changes: 10 additions & 0 deletions administrator/templates/atum/scss/blocks/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@
color: var(--atum-text-dark);
border: 0;
}

&.home-disabled {
opacity: 1;
cursor: not-allowed;
}

&.disabled .icon-home {
color: $state-warning-bg;
border-color: $state-warning-bg;
}
}

.icon-joomla::before {
Expand Down
22 changes: 12 additions & 10 deletions libraries/src/HTML/Helpers/JGrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static function action($i, $task, $prefix = '', $active_title = '', $inac
}
else
{
$html[] = '<a class="tbody-icon disabled jgrid"';
$html[] = '<a class="tbody-icon ' . $active_class . '-disabled disabled jgrid"';
$html[] = $tip ? ' aria-labelledby="' . $ariaid . '"' : '';
$html[] = '>';

Expand Down Expand Up @@ -258,19 +258,21 @@ public static function published($value, $i, $prefix = '', $enabled = true, $che
/**
* Returns an isDefault state on a grid
*
* @param integer $value The state value.
* @param integer $i The row index
* @param string|array $prefix An optional task prefix or an array of options
* @param boolean $enabled An optional setting for access control on the action.
* @param string $checkbox An optional prefix for checkboxes.
* @param string $formId An optional form selector.
* @param integer $value The state value.
* @param integer $i The row index
* @param string|array $prefix An optional task prefix or an array of options
* @param boolean $enabled An optional setting for access control on the action.
* @param string $checkbox An optional prefix for checkboxes.
* @param string $formId An optional form selector.
* @param string $active_class The class for active items.
* @param string $inactive_class The class for inactive items.
*
* @return string The HTML markup
*
* @see JHtmlJGrid::state()
* @since 1.6
*/
public static function isdefault($value, $i, $prefix = '', $enabled = true, $checkbox = 'cb', $formId = null)
public static function isdefault($value, $i, $prefix = '', $enabled = true, $checkbox = 'cb', $formId = null, $active_class = 'featured', $inactive_class = 'unfeatured')
{
if (is_array($prefix))
{
Expand All @@ -281,8 +283,8 @@ public static function isdefault($value, $i, $prefix = '', $enabled = true, $che
}

$states = array(
0 => array('setDefault', '', 'JLIB_HTML_SETDEFAULT_ITEM', '', 1, 'unfeatured', 'unfeatured'),
1 => array('unsetDefault', 'JDEFAULT', 'JLIB_HTML_UNSETDEFAULT_ITEM', 'JDEFAULT', 1, 'featured', 'featured'),
0 => array('setDefault', '', 'JLIB_HTML_SETDEFAULT_ITEM', '', 1, $inactive_class, $inactive_class),
1 => array('unsetDefault', 'JDEFAULT', 'JLIB_HTML_UNSETDEFAULT_ITEM', 'JDEFAULT', 1, $active_class, $active_class),
);

return static::state($states, $value, $i, $prefix, $enabled, true, $checkbox, $formId);
Expand Down