You are here

public function SettingTrait::get_labels in Fasttoggle 8.2

Get labels (fallback function if a template is used (eg roles)

return array A list of attributes that can be modified with this setting.

File

src/Plugin/Setting/SettingTrait.php, line 87
Fasttoggle Object List of Values Setting

Class

SettingTrait
Abstract interface for settings.

Namespace

Drupal\fasttoggle\Plugin\Setting

Code

public function get_labels() {
  $attributes = [];
  $template_array = $this->label_template;
  foreach ($this->attributes as $value => $display) {
    $attributes[$value] = [];
    foreach ($template_array as $label_type => $labels) {
      $attributes[$value][$label_type] = [];
      foreach ($labels as $state => $template) {
        $attributes[$value][$label_type][$state] = sprintf($template, $display);
      }
    }
  }
  return $attributes;
}