You are here

function type_style_moderation_get_style in Type Style 8

Helper function to grab a plugin style for a given workflow.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: A workflow entity, or an entity which has a workflow.

string $plugin: The name of the workflow plugin (i.e. transitions/states).

string $plugin_id: The workflow plugin ID (i.e. draft).

string $name: The name of the style you want to get (i.e. color, icon).

mixed $default: A default value in case the style is not set. Defaults to FALSE.

Return value

mixed The style if set, or the default. This value is safe to use.

1 call to type_style_moderation_get_style()
TypeStyleModeration::render in modules/type_style_moderation/src/Plugin/views/field/TypeStyleModeration.php
Renders the field.

File

modules/type_style_moderation/type_style_moderation.module, line 97
Hook implementations for the Type Style Moderation module.

Code

function type_style_moderation_get_style(EntityInterface $entity, $plugin, $plugin_id, $name, $default = FALSE) {
  $styles = type_style_moderation_get_styles($entity, $plugin, $plugin_id);
  return isset($styles[$name]) ? $styles[$name] : $default;
}