You are here

public function GroupType::summary in Group 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/Condition/GroupType.php \Drupal\group\Plugin\Condition\GroupType::summary()

Provides a human readable summary of the condition's configuration.

Overrides ConditionInterface::summary

File

src/Plugin/Condition/GroupType.php, line 98

Class

GroupType
Provides a 'Group Type' condition.

Namespace

Drupal\group\Plugin\Condition

Code

public function summary() {
  $group_types = $this->configuration['group_types'];

  // Format a pretty string if multiple group types were selected.
  if (count($group_types) > 1) {
    $last = array_pop($group_types);
    $group_types = implode(', ', $group_types);
    return $this
      ->t('The group type is @group_types or @last', [
      '@group_types' => $group_types,
      '@last' => $last,
    ]);
  }

  // If just one was selected, return a simpler string.
  return $this
    ->t('The group type is @group_type', [
    '@group_type' => reset($group_types),
  ]);
}