protected function MiconIconizeTrait::micon in Micon 2.x
Same name and namespace in other branches
- 8 src/MiconIconizeTrait.php \Drupal\micon\MiconIconizeTrait::micon()
Transforms a string into an icon + string.
This can be used interchangeably with the \Drupal\Core\StringTranslation\StringTranslationTrait.
Parameters
string $string: A string containing the English text to translate.
array $args: (optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details.
array $options: (optional) An associative array of additional options, with the following elements:
- 'langcode' (defaults to the current language): A language code, to translate to a language other than what is used to display the page.
- 'context' (defaults to the empty context): The context the source string belongs to.
Return value
\Drupal\Core\Render\Markup An object that, when cast to a string, returns the icon markup and translated string.
See also
\Drupal\Core\StringTranslation\StringTranslationTrait::t()
2 calls to MiconIconizeTrait::micon()
- MiconListBuilder::buildHeader in src/
MiconListBuilder.php - Builds the header row for the entity listing.
- MiconListBuilder::buildRow in src/
MiconListBuilder.php - Builds a row for an entity in the entity listing.
File
- src/
MiconIconizeTrait.php, line 42
Class
- MiconIconizeTrait
- Wrapper methods for \Drupal\micon\MiconIconize.
Namespace
Drupal\miconCode
protected function micon($string, array $args = [], array $options = []) {
return new MiconIconize($string, $args, $options, $this
->getStringTranslation());
}