-
-
Notifications
You must be signed in to change notification settings - Fork 825
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardize event feed stacked icons
- Loading branch information
Showing
4 changed files
with
81 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC. All rights reserved. | | ||
| | | ||
| This work is published under the GNU AGPLv3 license with some | | ||
| permitted exceptions and without any warranty. For full license | | ||
| and copyright information, see https://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* | ||
* @package CRM | ||
* @author Andrew Hunt, AGH Strategies | ||
* $Id$ | ||
* | ||
*/ | ||
|
||
/** | ||
* Display an icon stacked on a calendar icon, with some alternative text. | ||
* | ||
* @param $params | ||
* - icon: the icon class to display on top of fa-calendar-o | ||
* - stack: any classes to add to the stack | ||
* | ||
* @param $text | ||
* The translated text to include in the icon's title and screen-reader text. | ||
* | ||
* @param $smarty | ||
* | ||
* @return string | ||
*/ | ||
function smarty_block_calIcon($params, $text, &$smarty) { | ||
if (empty($params['icon'])) { | ||
return ''; | ||
} | ||
$stack = ['fa-stack']; | ||
if (!empty($params['stack'])) { | ||
$stack = array_unique(array_merge($stack, explode(' ', trim($params['stack'])))); | ||
} | ||
$stack = implode(' ', $stack); | ||
if ($text === NULL || $text === '') { | ||
$title = $sr = ''; | ||
} | ||
else { | ||
$text = htmlspecialchars($text); | ||
$title = " title=\"$text\""; | ||
$sr = "<span class=\"sr-only\">$text</span>"; | ||
} | ||
return <<<HEREDOC | ||
<span class="$stack"$title> | ||
<i class="crm-i fa-calendar-o fa-stack-2x"></i> | ||
<i style="top: 15%;" class="crm-i {$params['icon']} fa-stack-1x"></i> | ||
</span>$sr | ||
HEREDOC; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters