diff --git a/clientside_validation.info.yml b/clientside_validation.info.yml index e0952443757cb12d14a3235c52a7f4b0548854e8..bd5d3b7a2357350defb5e247fed75b6742868515 100644 --- a/clientside_validation.info.yml +++ b/clientside_validation.info.yml @@ -2,7 +2,7 @@ type: module name: Clientside Validation description: 'Add client side validation to forms.' package: Clientside Validation -core: 8.x +core_version_requirement: ^8.7.7 || ^9 test_dependencies: - clientside_validation:clientside_validation_demo diff --git a/clientside_validation_jquery/clientside_validation_jquery.drush.inc b/clientside_validation_jquery/clientside_validation_jquery.drush.inc deleted file mode 100644 index d3ab8f6153d4538ccef71f48df555848c37bdddf..0000000000000000000000000000000000000000 --- a/clientside_validation_jquery/clientside_validation_jquery.drush.inc +++ /dev/null @@ -1,128 +0,0 @@ -<?php - -/** - * @file - * Clientside Validation jQuery module drush commands. - */ - -use Drupal\Core\Serialization\Yaml; - -/** - * Implements hook_drush_command(). - */ -function clientside_validation_jquery_drush_command() { - $items = []; - - $items['clientside-validation-jquery-libraries-status'] = [ - 'description' => 'Show the status of library required by clientside validation jQuery module.', - 'core' => ['8+'], - 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT, - 'examples' => [ - 'cvjls' => 'Show the status of library required by clientside validation jQuery module.', - ], - 'aliases' => ['cvjls'], - ]; - - $items['clientside-validation-jquery-libraries-download'] = [ - 'description' => 'Download third party libraries required by clientside validation jQuery module.', - 'core' => ['8+'], - 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT, - 'examples' => [ - 'cvjld' => 'Download third party libraries required by the clientside validation jQuery module.', - ], - 'aliases' => ['cvjld'], - ]; - - $items['clientside-validation-jquery-libraries-remove'] = [ - 'description' => 'Remove third party libraries required by clientside validation jQuery module.', - 'core' => ['8+'], - 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT, - 'examples' => [ - 'cvjlr' => 'Remove third party libraries required by the clientside validation jQuery module.', - ], - 'aliases' => ['cvjlr'], - ]; - - return $items; -} - -/** - * Implements drush_hook_COMMAND(). - */ -function drush_clientside_validation_jquery_libraries_status() { - $installed = file_exists(DRUPAL_ROOT . '/libraries/jquery-validation/dist/jquery.validate.js'); - $message = $installed ? 'installed' : 'not installed'; - drush_print(dt('Library required for clientside validation jQuery is @message', [ - '@message' => $message, - ])); -} - -/** - * Implements drush_hook_COMMAND(). - */ -function drush_clientside_validation_jquery_libraries_download() { - // Remove all existing libraries. - if (drush_clientside_validation_jquery_libraries_remove(FALSE)) { - drush_print(dt('Removing existing libraries...')); - } - - // Create the makefile. - $makefile = file_directory_temp() . '/clientside_validation_jquery.libraries.make.yml'; - file_put_contents($makefile, _drush_clientside_validation_jquery_libraries_make()); - - // Download libraries using `drush make`. - $commandline_args = [$makefile, DRUPAL_ROOT]; - $commandline_options = ['no-core' => 'no-core']; - drush_invoke_process('@self', 'make', $commandline_args, $commandline_options); - - drupal_flush_all_caches(); - - // Remove the makefile. - \Drupal::service('file_system')->delete($makefile); -} - -/** - * Implements drush_hook_COMMAND(). - */ -function drush_clientside_validation_jquery_libraries_remove($status = TRUE) { - if ($status) { - drush_print(dt('Beginning to remove libraries...')); - } - $removed = FALSE; - - $library_exists = (file_exists(DRUPAL_ROOT . '/libraries/jquery-validation')) ? TRUE : FALSE; - if ($library_exists) { - drush_print('jQuery Validation library removed'); - drush_delete_dir(DRUPAL_ROOT . '/libraries/jquery-validation', TRUE); - drupal_flush_all_caches(); - $removed = TRUE; - } - - return $removed; -} - -/** - * Generate drush make as YAML. - * - * @return string - * Drush make as YAML - */ -function _drush_clientside_validation_jquery_libraries_make() { - $data = [ - 'core' => '8.x', - 'api' => 2, - 'libraries' => [], - ]; - - $url = 'https://github.com/jquery-validation/jquery-validation/archive/1.17.0.zip'; - $data['libraries']['jquery-validation'] = [ - 'directory_name' => 'jquery-validation', - 'destination' => 'libraries', - 'download' => [ - 'type' => 'get', - 'url' => $url, - ], - ]; - - return Yaml::encode($data); -} diff --git a/composer.json b/composer.json index 0ba8602c8fd18a60cd370bbf6e068422fd5094b7..6a6604c459a5c1fbbb79f3b7dd68613ca0722011 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,6 @@ "license": "GPL-2.0+", "minimum-stability": "dev", "require": { - "php": ">=7.0.0" + "php": ">=7.2.0" } }