You are here

public function Manager::getFlags in Message Subscribe 8

Get email subscribe-related flags.

Return Flag ids related to email subscriptions.

The flag name should start with "email_".

Retrieve available email flags.

Return value

\Drupal\flag\FlagInterface[] An array of flags, keyed by the flag ID.

File

message_subscribe_email/src/Manager.php, line 52

Class

Manager
Utility functions for the Message Subscribe Email module.

Namespace

Drupal\message_subscribe_email

Code

public function getFlags() {
  $email_flags = [];
  foreach ($this->flagService
    ->getAllFlags() as $flag_name => $flag) {

    // Check that the flag is using name convention.
    if (strpos($flag_name, $this->config
      ->get('flag_prefix')) === 0) {
      $email_flags[$flag_name] = $flag;
    }
  }
  return $email_flags;
}