Same name in other branches
- 8.x-2.x color_field.module \color_field_token_info()
Implements hook_token_info().
File
-
./
color_field.module, line 84
Code
function color_field_token_info() : array {
$tokens = [];
$tokens['color_field']['hex'] = [
'name' => t('HEX'),
'description' => t("Hex style color values."),
'type' => 'hex',
];
$tokens['hex']['with_opacity'] = [
'name' => t('With Opacity'),
'description' => t('HEX style color with opacity'),
];
$tokens['color_field']['rgb'] = [
'name' => t('RGB'),
'description' => t("RGB style color values."),
'type' => 'rgb',
];
$tokens['rgb']['rgba'] = [
'name' => t('RGBA'),
'description' => t("Color value expressed as rgba(xx,xx,xx,x.x)."),
];
$tokens['rgb']['red'] = [
'name' => t('Red'),
'description' => t("RGB Color value for red only expressed as an int."),
];
$tokens['rgb']['blue'] = [
'name' => t('Blue'),
'description' => t("RGB Color value for blue only expressed as an int."),
];
$tokens['rgb']['green'] = [
'name' => t('Green'),
'description' => t("RGB Color value for green only expressed as an int."),
];
$tokens['rgb']['opacity'] = [
'name' => t('Opacity'),
'description' => t("RGB Color value for opacity only expressed as a float."),
];
return [
'types' => [
'color_field' => [
'name' => t('Color Field'),
'description' => t('Values from a specific color field item.'),
'needs-data' => 'color_field',
],
'rgb' => [
'name' => t('RGB'),
'description' => t('RGB Values from a specific color field item.'),
'needs-data' => 'color_field',
],
'hex' => [
'name' => t('HEX'),
'description' => t('HEX values from a specific color field item'),
'needs-data' => 'color_field',
],
],
'tokens' => $tokens,
];
}