3 namespace Drupal\advagg\Form;
5 use Drupal\Core\Config\ConfigFactoryInterface;
6 use Drupal\Core\Form\ConfigFormBase;
7 use Drupal\Core\Form\FormBuilderInterface;
8 use Drupal\Core\State\StateInterface;
9 use Symfony\Component\DependencyInjection\ContainerInterface;
10 use Symfony\Component\HttpFoundation\RequestStack;
13 * View AdvAgg information for this site.
15 abstract class AdvaggFormBase extends ConfigFormBase {
18 * The AdvAgg file status state information storage service.
20 * @var \Drupal\Core\State\StateInterface
22 protected $advaggFiles;
25 * The AdvAgg aggregates state information storage service.
27 * @var \Drupal\Core\State\StateInterface
29 protected $advaggAggregates;
34 * @var \Symfony\Component\HttpFoundation\RequestStack
36 protected $requestStack;
39 * Constructs a SettingsForm object.
41 * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
42 * The factory for configuration objects.
43 * @param \Drupal\Core\State\StateInterface $advagg_files
44 * The AdvAgg file status state information storage service.
45 * @param \Drupal\Core\State\StateInterface $advagg_aggregates
46 * The AdvAgg aggregate state information storage service.
47 * @param \Symfony\Component\HttpFoundation\RequestStack $request_stack
50 public function __construct(ConfigFactoryInterface $config_factory, StateInterface $advagg_files, StateInterface $advagg_aggregates, RequestStack $request_stack) {
51 parent::__construct($config_factory);
52 $this->advaggFiles = $advagg_files;
53 $this->advaggAggregates = $advagg_aggregates;
54 $this->requestStack = $request_stack;
60 public static function create(ContainerInterface $container) {
62 $container->get('config.factory'),
63 $container->get('state.advagg.files'),
64 $container->get('state.advagg.aggregates'),
65 $container->get('request_stack')
70 * Checks if the form was submitted by AJAX.
73 * TRUE if the form was submitted via AJAX, otherwise FALSE.
75 protected function isAjax() {
76 $request = $this->requestStack->getCurrentRequest();
77 if ($request->query->has(FormBuilderInterface::AJAX_FORM_REQUEST)) {