Skip to content

Commit 541ec54

Browse files
committed
Merge branch 'develop'
2 parents a32facc + f531cc4 commit 541ec54

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

Dashboard.module

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,13 +490,33 @@ class Dashboard extends Process implements Module
490490
/**
491491
* Render icon as markup.
492492
*
493-
* @param string $icon
493+
* @param string|array $icons Icon or icon array, in order of preference
494494
*
495495
* @return string Icon markup
496496
*/
497-
public function renderIcon($icon)
497+
public function renderIcon($icons)
498498
{
499-
return $icon ? wireIconMarkup($icon, 'fw') : '';
499+
$class = '';
500+
501+
if (empty($icons)) {
502+
$icons = [];
503+
} elseif (is_string($icons)) {
504+
$icons = [$icons];
505+
}
506+
if (is_array($icons)) {
507+
$classes = array_map(function ($icon) {
508+
if (strpos($icon, 'icon-') === 0) {
509+
$icon = str_replace('icon-', 'fa-', $icon);
510+
}
511+
if (strpos($icon, 'fa-') !== 0) {
512+
$icon = "fa-{$icon}";
513+
}
514+
return $icon;
515+
}, $icons);
516+
$class = implode(' ', $classes);
517+
}
518+
519+
return "<i class='fa fa-fw {$class}'></i>";
500520
}
501521

502522
/**

DashboardPanelCollection.module

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ class DashboardPanelCollection extends DashboardPanel
455455
$links['edit'] = [
456456
'href' => $page->editUrl,
457457
'label' => $this->_('Edit'),
458-
'icon' => 'pen-to-square',
458+
'icon' => ['pen', 'pen-to-square'],
459459
'mode' => $this->editMode,
460460
'reload' => true,
461461
'disabled' => !$page->editable,
@@ -474,7 +474,7 @@ class DashboardPanelCollection extends DashboardPanel
474474
$links['trash'] = [
475475
'href' => '#',
476476
'label' => $this->_('Trash'),
477-
'icon' => 'trash-can',
477+
'icon' => ['trash', 'trash-can'],
478478
// 'disabled' => $page->isTrash() || !$page->trashable,
479479
'attributes' => [
480480
'data-action' => "[trash][{$page}]",

0 commit comments

Comments
 (0)