You are here

class ActivationCheck in Colorbox 8

Implementation of ActivationCheckInterface.

Hierarchy

Expanded class hierarchy of ActivationCheck

1 string reference to 'ActivationCheck'
colorbox.services.yml in ./colorbox.services.yml
colorbox.services.yml
1 service uses ActivationCheck
colorbox.activation_check in ./colorbox.services.yml
Drupal\colorbox\ActivationCheck

File

src/ActivationCheck.php, line 11

Namespace

Drupal\colorbox
View source
class ActivationCheck implements ActivationCheckInterface {

  /**
   * The colorbox settings.
   *
   * @var \Drupal\Core\Config\ImmutableConfig
   */
  protected $settings;

  /**
   * The request stack.
   *
   * @var \Symfony\Component\HttpFoundation\RequestStack
   */
  protected $request;

  /**
   * Create an instace of ActivationCheck.
   */
  public function __construct(ConfigFactoryInterface $config, RequestStack $request) {
    $this->settings = $config
      ->get('colorbox.settings');
    $this->request = $request
      ->getCurrentRequest();
  }

  /**
   * {@inheritdoc}
   */
  public function isActive() {
    return $this->request
      ->get('colorbox') !== 'no';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ActivationCheck::$request protected property The request stack.
ActivationCheck::$settings protected property The colorbox settings.
ActivationCheck::isActive public function Check if colorbox should be activated for the current page. Overrides ActivationCheckInterface::isActive
ActivationCheck::__construct public function Create an instace of ActivationCheck.