You are here

public function AccessController::access in Social media share 8

Check if email option is enabled, if not do not allow this path.

Return value

\Drupal\Core\Access\AccessResultInterface Return allowed if the social media email is enabled.

1 string reference to 'AccessController::access'
social_media.routing.yml in ./social_media.routing.yml
social_media.routing.yml

File

src/Controller/AccessController.php, line 21

Class

AccessController
Class AccessController.

Namespace

Drupal\social_media\Controller

Code

public function access() {
  $config = $this
    ->config('social_media.settings');
  if ($config
    ->get('social_media.email.enable') && $config
    ->get('social_media.email.enable_forward')) {
    return AccessResult::allowed()
      ->addCacheableDependency($config);
  }
  return AccessResult::forbidden()
    ->addCacheableDependency($config);
}