You are here

protected function MessageBannerSettingsForm::getBannerColors in Message Banner 8

Gets the available colors for the message banner.

Return value

array An array of background colors.

See also

hook_message_banner_colors_alter()

1 call to MessageBannerSettingsForm::getBannerColors()
MessageBannerSettingsForm::buildForm in src/Form/MessageBannerSettingsForm.php
Form constructor.

File

src/Form/MessageBannerSettingsForm.php, line 166

Class

MessageBannerSettingsForm
The message banner settings form.

Namespace

Drupal\message_banner\Form

Code

protected function getBannerColors() : array {
  $colors = [
    'default--red' => $this
      ->t('Red'),
    'default--amber' => $this
      ->t('Amber'),
    'default--green' => $this
      ->t('Green'),
    'default--black' => $this
      ->t('Black'),
    'default--gray' => $this
      ->t('Gray'),
    'default--white' => $this
      ->t('White'),
  ];

  // Allow other developers to add extra colors, such as brand colors.
  $this->moduleHandler
    ->alter('message_banner_colors', $colors);
  return $colors;
}