You are here

public function OperationsForm::incrementCounter in Advanced CSS/JS Aggregation 8.3

Same name and namespace in other branches
  1. 8.4 src/Form/OperationsForm.php \Drupal\advagg\Form\OperationsForm::incrementCounter()
  2. 8.2 src/Form/OperationsForm.php \Drupal\advagg\Form\OperationsForm::incrementCounter()

Increment the global counter. Also full cache clear.

File

src/Form/OperationsForm.php, line 296

Class

OperationsForm
Configure advagg settings for this site.

Namespace

Drupal\advagg\Form

Code

public function incrementCounter() {

  // Clear out the cache and delete aggregates.
  $this
    ->clearAggregates();

  // Increment counter.
  $new_value = $this
    ->config('advagg.settings')
    ->get('global_counter') + 1;
  $this
    ->config('advagg.settings')
    ->set('global_counter', $new_value)
    ->save();
  $this->messenger
    ->addMessage($this
    ->t('Global counter is now set to %new_value', [
    '%new_value' => $new_value,
  ]));
}