You are here

public function ResetAccessRules::getTitle in RNG - Events and Registrations 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/Menu/LocalAction/ResetAccessRules.php \Drupal\rng\Plugin\Menu\LocalAction\ResetAccessRules::getTitle()
  2. 3.x src/Plugin/Menu/LocalAction/ResetAccessRules.php \Drupal\rng\Plugin\Menu\LocalAction\ResetAccessRules::getTitle()

Returns the localized title to be shown for this action.

Subclasses may add optional arguments like NodeInterface $node = NULL that will be supplied by the ControllerResolver.

Return value

string The title to be shown for this action.

Overrides LocalActionDefault::getTitle

See also

\Drupal\Core\Menu\LocalActionManager::getTitle()

File

src/Plugin/Menu/LocalAction/ResetAccessRules.php, line 74

Class

ResetAccessRules
Modifies the reset access rules action.

Namespace

Drupal\rng\Plugin\Menu\LocalAction

Code

public function getTitle(Request $request = NULL) {
  $route = $this->routeProvider
    ->getRouteByName($this
    ->getRouteName());
  $param = $route
    ->getDefault('event');
  if ($event = $this->currentRoute
    ->getParameter($param)) {
    if ($this->eventManager
      ->getMeta($event)
      ->isDefaultRules('rng_event.register')) {
      return $this
        ->t('Customize access rules');
    }
    else {
      return $this
        ->t('Reset access rules to site default');
    }
  }
}