|
8 | 8 | use Drupal\phpfastcache\Cache\PhpFastCacheBackendFactory;
|
9 | 9 | use phpFastCache\CacheManager;
|
10 | 10 | use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
|
11 |
| -use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException; |
12 | 11 |
|
13 | 12 | /**
|
14 | 13 | * Configure phpfastcache settings for this site.
|
@@ -104,6 +103,30 @@ public function buildForm(array $form, FormStateInterface $form_state) {
|
104 | 103 | '#type' => 'textfield',
|
105 | 104 | ];
|
106 | 105 |
|
| 106 | + |
| 107 | + $binDescCallback = function($binName, $binDesc = '') |
| 108 | + { |
| 109 | + return '<span>' . t(ucfirst($binName)) . '</span>' . ($binDesc ? ' - <small>' . t($binDesc) . '</small>' : ''); |
| 110 | + }; |
| 111 | + |
| 112 | + $form[ 'general' ][ 'phpfastcache_settings_wrapper' ][ 'phpfastcache_bins' ] = [ |
| 113 | + '#default_value' => (array) $config->get('phpfastcache_bins'), |
| 114 | + '#description' => 'See /core/core.services.yml for more information about bin uses', |
| 115 | + '#required' => false, |
| 116 | + '#options' => [ |
| 117 | + 'default' => $binDescCallback('default', 'Default bin if not specified by modules/core'), |
| 118 | + 'menu' => $binDescCallback('menu', 'Menu tree/items'), |
| 119 | + 'bootstrap' => $binDescCallback('bootstrap', 'Drupal bootstrap/core initialization'), |
| 120 | + 'render' => $binDescCallback('render', 'You must expect the cache size to grow up quickly, make sure that the driver you choose have enough memory/disk space.'), |
| 121 | + 'config' => $binDescCallback('config', 'You will have to purge the cache after each settings changes'), |
| 122 | + 'dynamic_page_cache' => $binDescCallback('dynamic page cache', ''), |
| 123 | + 'entity' => $binDescCallback('entity', 'You will have to purge the cache after each entity changes'), |
| 124 | + 'discovery' => $binDescCallback('discovery', 'Used for plugin manager, entity type manager, field manager, etc.'), |
| 125 | + ], |
| 126 | + '#title' => $this->t('Bins handled by PhpFastCache'), |
| 127 | + '#type' => 'checkboxes', |
| 128 | + ]; |
| 129 | + |
107 | 130 | $driversOption = [];
|
108 | 131 | foreach (CacheManager::getStaticSystemDrivers() as $systemDriver) {
|
109 | 132 | $driversOption[ strtolower($systemDriver) ] = t(ucfirst($systemDriver));
|
@@ -140,30 +163,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
|
140 | 163 | ],
|
141 | 164 | ];
|
142 | 165 |
|
143 |
| - |
144 |
| - $binDescCallback = function($binName, $binDesc = '') |
145 |
| - { |
146 |
| - return '<span>' . t(ucfirst($binName)) . '</span>' . ($binDesc ? ' - <small>' . t($binDesc) . '</small>' : ''); |
147 |
| - }; |
148 |
| - |
149 |
| - $form[ 'general' ][ 'phpfastcache_settings_wrapper' ][ 'phpfastcache_bins' ] = [ |
150 |
| - '#default_value' => (array) $config->get('phpfastcache_bins'), |
151 |
| - '#description' => 'See /core/core.services.yml for more information about bin uses', |
152 |
| - '#required' => false, |
153 |
| - '#options' => [ |
154 |
| - 'default' => $binDescCallback('default', 'Default bin if not specified by modules/core'), |
155 |
| - 'menu' => $binDescCallback('menu', 'Menu tree/items'), |
156 |
| - 'bootstrap' => $binDescCallback('bootstrap', 'Drupal bootstrap/core initialization'), |
157 |
| - 'render' => $binDescCallback('render', 'You must expect the cache size to grow up quickly, make sure that the driver you choose have enough memory/disk space.'), |
158 |
| - 'config' => $binDescCallback('config', 'You will have to purge the cache after each settings changes'), |
159 |
| - 'dynamic_page_cache' => $binDescCallback('dynamic page cache', ''), |
160 |
| - 'entity' => $binDescCallback('entity', 'You will have to purge the cache after each entity changes'), |
161 |
| - 'discovery' => $binDescCallback('discovery', 'Used for plugin manager, entity type manager, field manager, etc.'), |
162 |
| - ], |
163 |
| - '#title' => $this->t('Bins handled by PhpFastCache'), |
164 |
| - '#type' => 'checkboxes', |
165 |
| - ]; |
166 |
| - |
167 | 166 | /***********************
|
168 | 167 | *
|
169 | 168 | * Drivers settings wrapper
|
|
0 commit comments