X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FAction.php;h=2211d6cdb6eedc9c105a0c01e8fa0ceb4bf6e8c9;hb=78d5fd73ab8c57ddf7df04e4d92ce56732797202;hp=f1475076020c2c74c22a86799107120ccb391a78;hpb=52465a830795bd700893f12610914505b9417f0c;p=civicrm-core.git diff --git a/CRM/Core/Action.php b/CRM/Core/Action.php index f147507602..2211d6cdb6 100644 --- a/CRM/Core/Action.php +++ b/CRM/Core/Action.php @@ -178,6 +178,12 @@ class CRM_Core_Action { * @param null $op * @param null $objectName * @param int $objectId + * @param string $iconMode + * - `text`: even if `icon` is set for a link, display the `name` + * - `icon`: display only the `icon` for each link if it's available, and + * don't tuck anything under "more >" + * - `both`: if `icon` is available, display it next to the `name` for each + * link * * @return string * the html string @@ -190,7 +196,8 @@ class CRM_Core_Action { $enclosedAllInSingleUL = FALSE, $op = NULL, $objectName = NULL, - $objectId = NULL + $objectId = NULL, + $iconMode = 'text' ) { if (empty($links)) { return NULL; @@ -243,11 +250,22 @@ class CRM_Core_Action { if (strpos($urlPath, '/delete') || strpos($urlPath, 'action=delete')) { $classes .= " small-popup"; } + + $linkContent = $link['name']; + if (!empty($link['icon'])) { + if ($iconMode == 'icon') { + $linkContent = CRM_Core_Page::crmIcon($link['icon'], $link['name'], TRUE, ['title' => '']); + } + elseif ($iconMode == 'both') { + $linkContent = CRM_Core_Page::crmIcon($link['icon']) . ' ' . $linkContent; + } + } + $url[] = sprintf('%s', $urlPath, $classes, !empty($link['title']) ? "title='{$link['title']}' " : '', - empty($link['icon']) ? $link['name'] : CRM_Core_Page::crmIcon($link['icon'], $link['name'], TRUE, ['title' => '']) + $linkContent ); } } @@ -261,11 +279,13 @@ class CRM_Core_Action { } else { $extra = ''; - $extraLinks = array_splice($url, 2); - if (count($extraLinks) > 1) { - $mainLinks = array_slice($url, 0, 2); - CRM_Utils_String::append($extra, '
  • ', $extraLinks); - $extra = "{$extraULName}"; + if ($iconMode != 'icon') { + $extraLinks = array_splice($url, 2); + if (count($extraLinks) > 1) { + $mainLinks = array_slice($url, 0, 2); + CRM_Utils_String::append($extra, '
  • ', $extraLinks); + $extra = "{$extraULName}"; + } } $resultLinks = ''; CRM_Utils_String::append($resultLinks, '', $mainLinks);