Skip to content
This repository was archived by the owner on Apr 13, 2020. It is now read-only.

Commit e8b58ed

Browse files
committed
Reordered admin form fields
1 parent bc6a79f commit e8b58ed

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

src/Form/PhpFastCacheAdminSettingsForm.php

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use Drupal\phpfastcache\Cache\PhpFastCacheBackendFactory;
99
use phpFastCache\CacheManager;
1010
use phpFastCache\Exceptions\phpFastCacheDriverCheckException;
11-
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
1211

1312
/**
1413
* Configure phpfastcache settings for this site.
@@ -104,6 +103,30 @@ public function buildForm(array $form, FormStateInterface $form_state) {
104103
'#type' => 'textfield',
105104
];
106105

106+
107+
$binDescCallback = function($binName, $binDesc = '')
108+
{
109+
return '<span>' . t(ucfirst($binName)) . '</span>' . ($binDesc ? '&nbsp;-&nbsp;<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+
107130
$driversOption = [];
108131
foreach (CacheManager::getStaticSystemDrivers() as $systemDriver) {
109132
$driversOption[ strtolower($systemDriver) ] = t(ucfirst($systemDriver));
@@ -140,30 +163,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
140163
],
141164
];
142165

143-
144-
$binDescCallback = function($binName, $binDesc = '')
145-
{
146-
return '<span>' . t(ucfirst($binName)) . '</span>' . ($binDesc ? '&nbsp;-&nbsp;<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-
167166
/***********************
168167
*
169168
* Drivers settings wrapper

0 commit comments

Comments
 (0)