You are here

public function CacheflushApi::createTabOptions in CacheFlush 8

Create option array for preset.

Return value

array Preset options.

1 call to CacheflushApi::createTabOptions()
CacheflushApi::getOptionList in src/Controller/CacheflushApi.php
Return a list of cache options to be cleared.

File

src/Controller/CacheflushApi.php, line 132

Class

CacheflushApi
Returns responses for Cacheflush routes.

Namespace

Drupal\cacheflush\Controller

Code

public function createTabOptions() {
  $core = array_flip($this
    ->coreBinMapping());
  foreach ($this->container
    ->getParameter('cache_bins') as $service_id => $bin) {
    $options[$bin] = [
      'description' => $this
        ->t('Storage for the cache API.'),
      'category' => isset($core[$bin]) ? 'vertical_tabs_core' : 'vertical_tabs_custom',
      'functions' => [
        '0' => [
          '#name' => '\\Drupal\\cacheflush\\Controller\\CacheflushApi::clearBinCache',
          '#params' => [
            $service_id,
          ],
        ],
      ],
    ];
  }
  return isset($options) ? $options : [];
}