function _bootstrap_icon

8.x-3.x deprecated.php _bootstrap_icon($name, $default = NULL, array $attributes = [])
7.x-3.x common.inc _bootstrap_icon($name, $default = NULL, array $attributes = array())

Returns a specific Bootstrap Glyphicon as rendered HTML markup.

  // Before.
  $icon = _bootstrap_icon($name, $default, $attributes);

  // After.
  use Drupal\bootstrap\Bootstrap;
  use Drupal\bootstrap\Utility\Element;
  $icon = Bootstrap::glyphicon($name, ['#markup' => $default]);
  $icon_attributes = isset($icon['#attributes']) ? $icon['#attributes'] : [];
  unset($icon['#attributes']);
  $icon = (string) Element::createStandalone($icon)->setAttributes($attributes)->setAttributes($icon_attributes)->renderPlain();

Parameters

string $name: The icon name, minus the "glyphicon-" prefix.

string $default: (Optional) The default value to return.

array $attributes: (Optional) Additional attributes to merge onto the icon.

Return value

string The HTML markup containing the icon defined by $name, $default value if icon does not exist or returns empty output for whatever reason.

Deprecated

Will be removed in a future release.

Source ./deprecated.php (line 477)

function _bootstrap_icon($name, $default = NULL, array $attributes = []) {
  Bootstrap::deprecated();
  $icon = Bootstrap::glyphicon($name, ['#markup' => $default]);
  $icon_attributes = isset($icon['#attributes']) ? $icon['#attributes'] : [];
  unset($icon['#attributes']);
  return (string) Element::createStandalone($icon)->setAttributes($attributes)->setAttributes($icon_attributes)->renderPlain();
}