You are here

public function IpRule::summary in Access Filter 8

Gets summary text for the rule.

Return value

string A summary string.

Overrides RuleInterface::summary

File

src/Plugin/AccessFilter/Rule/IpRule.php, line 42

Class

IpRule
Filter rule using IP address.

Namespace

Drupal\access_filter\Plugin\AccessFilter\Rule

Code

public function summary() {
  $action = $this->configuration['action'];
  if ($action == 'allow') {
    return $this
      ->t('Allow from @ip', [
      '@ip' => $this->configuration['address'],
    ]);
  }
  elseif ($action == 'deny') {
    return $this
      ->t('Deny from @ip', [
      '@ip' => $this->configuration['address'],
    ]);
  }
  else {
    return $this
      ->t('Invalid configuration.');
  }
}