Same filename and directory in other branches
  1. 8.x-1.x src/ActivationCheck.php 1 comment

Namespace

Drupal\colorbox

File

src/ActivationCheck.php

View source
<?php

namespace Drupal\colorbox;

use Drupal\Core\Config\ConfigFactoryInterface;
use Symfony\Component\HttpFoundation\RequestStack;

/**
 * Implementation of ActivationCheckInterface.
 */
class ActivationCheck implements ActivationCheckInterface {
    
    /**
     * The colorbox settings.
     *
     * @var \Drupal\Core\Config\ImmutableConfig
     */
    protected $settings;
    
    /**
     * The request stack.
     *
     * @var \Symfony\Component\HttpFoundation\Request
     */
    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';
    }

}

Classes

Title Deprecated Summary
ActivationCheck Implementation of ActivationCheckInterface.