Skip to content
Snippets Groups Projects

add the PHPCS Fixes.

Open Prem Suthar requested to merge issue/vuejs-3488599:3488599-general-cleanup-phpcs into 3.x
1 file
+ 32
27
Compare changes
  • Side-by-side
  • Inline
+ 32
27
@@ -45,12 +45,12 @@ final class SettingsForm extends ConfigFormBase {
ConfigFactoryInterface $config_factory,
LibraryDiscoveryInterface $library_discovery,
ClientInterface $http_client,
?TypedConfigManagerInterface $typed_config_manager = null
?TypedConfigManagerInterface $typed_config_manager = NULL,
) {
$this->libraryDiscovery = $library_discovery;
$this->httpClient = $http_client;
if (version_compare(\Drupal::VERSION, '10.2.0', '>=')) {
// @todo: Once we require ^10.3
// @todo Fix problem once we require ^10.3 here.
parent::__construct($config_factory, $typed_config_manager);
}
else {
@@ -88,7 +88,8 @@ final class SettingsForm extends ConfigFormBase {
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state): array {
$registered_libraries = $this->libraryDiscovery->getLibrariesByExtension('vuejs');
// $registered_libraries =
// $this->libraryDiscovery->getLibrariesByExtension('vuejs');
$libraries = $this->config('vuejs.settings')->get('libraries');
$form['vue'] = [
@@ -111,11 +112,11 @@ final class SettingsForm extends ConfigFormBase {
$form['vue']['development'] = [
'#type' => 'checkbox',
'#title' => $this->t('Use Development Version'),
'#default_value' => $libraries['vue']['development'] ?? FALSE,
'#default_value' => $libraries['vue']['development'] ?? FALSE,
'#desctiption' => $this->t('This will use the non-minified version of the library. Only available with local installation.'),
'#states' => [
'visible' => [
'select[name="vue[installation]"]' => ['value' => 'local']
'select[name="vue[installation]"]' => ['value' => 'local'],
],
],
];
@@ -124,14 +125,14 @@ final class SettingsForm extends ConfigFormBase {
'#type' => 'select',
'#title' => $this->t('Select a CDN provider'),
'#options' => [
'unpkg' => 'UNPKG',
'cdnjs' => 'cdnjs',
'jsdelivr' => 'jsDelivr',
'unpkg' => $this->t('UNPKG'),
'cdnjs' => $this->t('cdnjs'),
'jsdelivr' => $this->t('jsDelivr'),
],
'#default_value' => $libraries['vue']['cdn'] ?? 'unpkg',
'#states' => [
'visible' => [
'select[name="vue[installation]"]' => [ 'value' => 'cdn'],
'select[name="vue[installation]"]' => ['value' => 'cdn'],
],
],
];
@@ -143,9 +144,9 @@ final class SettingsForm extends ConfigFormBase {
'#default_value' => $libraries['vue']['version'] ?? '3.2.37',
'#states' => [
'invisible' => [
'select[name="vue[installation]"]' => ['value' => 'local']
],
'select[name="vue[installation]"]' => ['value' => 'local'],
],
],
];
$form['petitevue'] = [
@@ -167,13 +168,13 @@ final class SettingsForm extends ConfigFormBase {
$form['petitevue']['defer'] = [
'#type' => 'checkbox',
'#title' => $this->t('Defer loading'),
'#default_value' => $libraries['petitevue']['defer'] ?? FALSE,
'#default_value' => $libraries['petitevue']['defer'] ?? FALSE,
'#desctiption' => $this->t('This will defer the loading of the library until the page has finished loading.'),
];
$form['petitevue']['init'] = [
'#type' => 'checkbox',
'#title' => $this->t('Initialize'),
'#default_value' => $libraries['petitevue']['init'] ?? FALSE,
'#default_value' => $libraries['petitevue']['init'] ?? FALSE,
'#desctiption' => $this->t('This will initialize PetiteVue instances on the page automatically.'),
];
@@ -181,10 +182,10 @@ final class SettingsForm extends ConfigFormBase {
'#type' => 'checkbox',
'#title' => $this->t('Use Development Version'),
'#desctiption' => $this->t('This will use the non-minified version of the library. Only available with local installation.'),
'#default_value' => $libraries['petitevue']['development'] ?? FALSE,
'#default_value' => $libraries['petitevue']['development'] ?? FALSE,
'#states' => [
'visible' => [
'select[name="petitevue[installation]"]' => ['value' => 'local']
'select[name="petitevue[installation]"]' => ['value' => 'local'],
],
],
];
@@ -193,14 +194,14 @@ final class SettingsForm extends ConfigFormBase {
'#type' => 'select',
'#title' => $this->t('Select a CDN provider'),
'#options' => [
'unpkg' => 'UNPKG',
'cdnjs' => 'cdnjs',
'jsdelivr' => 'jsDelivr',
'unpkg' => $this->t('UNPKG'),
'cdnjs' => $this->t('cdnjs'),
'jsdelivr' => $this->t('jsDelivr'),
],
'#default_value' => $libraries['petitevue']['cdn'] ?? 'unpkg',
'#states' => [
'visible' => [
'select[name="petitevue[installation]"]' => [ 'value' => 'cdn'],
'select[name="petitevue[installation]"]' => ['value' => 'cdn'],
],
],
];
@@ -212,9 +213,9 @@ final class SettingsForm extends ConfigFormBase {
'#default_value' => $libraries['petitevue']['version'] ?? '0.4.1',
'#states' => [
'invisible' => [
'select[name="petitevue[installation]"]' => ['value' => 'local']
],
'select[name="petitevue[installation]"]' => ['value' => 'local'],
],
],
];
return parent::buildForm($form, $form_state);
@@ -254,14 +255,16 @@ final class SettingsForm extends ConfigFormBase {
if ($vueSettings['installation'] == 'cdn') {
switch ($vueSettings['cdn']) {
case 'jsdelivr':
$vueSettings['path'] = '//cdn.jsdelivr.net/npm/vue@' . $vueSettings['version'] .'/dist/' . $vueRuntimeFilename;
$vueSettings['path'] = '//cdn.jsdelivr.net/npm/vue@' . $vueSettings['version'] . '/dist/' . $vueRuntimeFilename;
break;
case 'cdnjs':
$vueSettings['path'] = '//cdnjs.cloudflare.com/ajax/libs/vue/' . $vueSettings['version'] .'/' . $vueRuntimeFilename;
$vueSettings['path'] = '//cdnjs.cloudflare.com/ajax/libs/vue/' . $vueSettings['version'] . '/' . $vueRuntimeFilename;
break;
case 'unpkg':
default:
$vueSettings['path'] = '//unpkg.com/vue@' . $vueSettings['version'] .'/dist/' . $vueRuntimeFilename;
$vueSettings['path'] = '//unpkg.com/vue@' . $vueSettings['version'] . '/dist/' . $vueRuntimeFilename;
}
}
@@ -275,14 +278,16 @@ final class SettingsForm extends ConfigFormBase {
if ($petitieVueSettings['installation'] == 'cdn') {
switch ($petitieVueSettings['cdn']) {
case 'jsdelivr':
$petitieVueSettings['path'] = '//cdn.jsdelivr.net/npm/petite-vue@' . $petitieVueSettings['version'] .'/dist/' . $petiteVueRuntimeFilename;
$petitieVueSettings['path'] = '//cdn.jsdelivr.net/npm/petite-vue@' . $petitieVueSettings['version'] . '/dist/' . $petiteVueRuntimeFilename;
break;
case 'cdnjs':
$petitieVueSettings['path'] = '//cdnjs.cloudflare.com/ajax/libs/petite-vue/' . $petitieVueSettings['version'] .'/' . $petiteVueRuntimeFilename;
$petitieVueSettings['path'] = '//cdnjs.cloudflare.com/ajax/libs/petite-vue/' . $petitieVueSettings['version'] . '/' . $petiteVueRuntimeFilename;
break;
case 'unpkg':
default:
$petitieVueSettings['path'] = '//unpkg.com/petite-vue@' . $petitieVueSettings['version'] .'/dist/' . $petiteVueRuntimeFilename;
$petitieVueSettings['path'] = '//unpkg.com/petite-vue@' . $petitieVueSettings['version'] . '/dist/' . $petiteVueRuntimeFilename;
}
}
Loading