From 451be835c097b66cb6b9523ed74b3e0ce04b0ec2 Mon Sep 17 00:00:00 2001 From: Dave Long <dave@longwaveconsulting.com> Date: Fri, 2 Feb 2024 12:04:21 +0000 Subject: [PATCH] Issue #3417675 by quietone, arunkumark: Correct mymodule, mydriver and anothermodule --- core/core.api.php | 48 ++++++------- core/includes/bootstrap.inc | 2 +- .../Command/GenerateProxyClassCommand.php | 2 +- .../Core/Database/StatementInterface.php | 6 +- core/lib/Drupal/Core/Entity/entity.api.php | 70 +++++++++---------- .../Core/Extension/ModuleHandlerInterface.php | 4 +- core/lib/Drupal/Core/Extension/module.api.php | 69 +++++++++--------- core/lib/Drupal/Core/Flood/FloodInterface.php | 2 +- .../Drupal/Core/Form/FormBuilderInterface.php | 4 +- core/lib/Drupal/Core/Form/form.api.php | 4 +- .../Drupal/Core/Lock/LockBackendInterface.php | 6 +- .../Core/Pager/PagerManagerInterface.php | 12 ++-- .../Core/Plugin/DefaultPluginManager.php | 2 +- .../Core/Render/Element/FormElement.php | 8 +-- core/lib/Drupal/Core/Render/theme.api.php | 10 +-- .../Core/Theme/ThemeManagerInterface.php | 4 +- core/misc/cspell/dictionary.txt | 2 - core/modules/comment/comment.api.php | 4 +- core/modules/field/field.api.php | 8 +-- core/modules/filter/filter.api.php | 2 +- .../help/src/HelpTopicPluginManager.php | 6 +- .../src/HelpTopicPluginManager.php | 4 +- core/modules/image/image.api.php | 2 +- .../src/LanguageNegotiatorInterface.php | 4 +- core/modules/migrate/migrate.api.php | 8 +-- core/modules/node/node.api.php | 4 +- core/modules/rest/rest.api.php | 4 +- core/modules/search/search.module | 2 +- .../system/tests/src/Kernel/Mail/MailTest.php | 4 +- core/modules/tour/tour.api.php | 2 +- core/modules/user/user.api.php | 2 +- .../views/src/Plugin/views/PluginBase.php | 4 +- .../Database/DriverSpecificKernelTestBase.php | 8 +-- .../Core/Extension/ModuleHandlerTest.php | 2 +- 34 files changed, 160 insertions(+), 165 deletions(-) diff --git a/core/core.api.php b/core/core.api.php index bc7547d4112b..209178aec0eb 100644 --- a/core/core.api.php +++ b/core/core.api.php @@ -217,7 +217,7 @@ * * Configuration is divided into individual objects, each of which has a * unique name or key. Some modules will have only one configuration object, - * typically called 'mymodule.settings'; some modules will have many. Within + * typically called 'my_module.settings'; some modules will have many. Within * a configuration object, configuration settings have data types (integer, * string, Boolean, etc.) and settings can also exist in a nested hierarchy, * known as a "mapping". @@ -283,10 +283,10 @@ * The first task in using the simple configuration API is to define the * configuration file structure, file name, and schema of your settings (see * @ref sec_yaml above). Once you have done that, you can retrieve the active - * configuration object that corresponds to configuration file mymodule.foo.yml + * configuration object that corresponds to configuration file my_module.foo.yml * with a call to: * @code - * $config = \Drupal::config('mymodule.foo'); + * $config = \Drupal::config('my_module.foo'); * @endcode * * This will be an object of class \Drupal\Core\Config\Config, which has methods @@ -313,7 +313,7 @@ * you will instead need to get the Config object by making a call to * getEditable() on the config factory: * @code - * $config =\Drupal::service('config.factory')->getEditable('mymodule.foo'); + * $config =\Drupal::service('config.factory')->getEditable('my_module.foo'); * @endcode * * Individual configuration values can be changed or added using the set() @@ -430,7 +430,7 @@ * * Example: * @code - * $cid = 'mymodule_example:' . \Drupal::languageManager()->getCurrentLanguage()->getId(); + * $cid = 'my_module_example:' . \Drupal::languageManager()->getCurrentLanguage()->getId(); * * $data = NULL; * if ($cache = \Drupal::cache()->get($cid)) { @@ -1415,8 +1415,8 @@ * class and the parent (default) plugin manager service to inherit * constructor arguments: * @code - * plugin.manager.mymodule: - * class: Drupal\mymodule\MyPluginManager + * plugin.manager.my_module: + * class: Drupal\my_module\MyPluginManager * parent: default_plugin_manager * @endcode * - If your plugin is configurable, you will also need to define the @@ -1701,7 +1701,7 @@ * * Here is an example of a Form class: * @code - * namespace Drupal\mymodule\Form; + * namespace Drupal\my_module\Form; * * use Drupal\Core\Form\FormBase; * use Drupal\Core\Form\FormStateInterface; @@ -1739,7 +1739,7 @@ * \Drupal::formBuilder()->getForm() should be used to handle retrieving, * processing, and displaying a rendered HTML form. Given the ExampleForm * defined above, - * \Drupal::formBuilder()->getForm('Drupal\mymodule\Form\ExampleForm') would + * \Drupal::formBuilder()->getForm('Drupal\my_module\Form\ExampleForm') would * return the rendered HTML of the form defined by ExampleForm::buildForm(), or * call the validateForm() and submitForm(), methods depending on the current * processing state. @@ -1752,7 +1752,7 @@ * For example: * @code * $extra = '612-123-4567'; - * $form = \Drupal::formBuilder()->getForm('Drupal\mymodule\Form\ExampleForm', $extra); + * $form = \Drupal::formBuilder()->getForm('Drupal\my_module\Form\ExampleForm', $extra); * ... * public function buildForm(array $form, FormStateInterface $form_state, $extra = NULL) * $form['phone_number'] = array( @@ -1774,7 +1774,7 @@ * path: '/example-form' * defaults: * _title: 'Example form' - * _form: '\Drupal\mymodule\Form\ExampleForm' + * _form: '\Drupal\my_module\Form\ExampleForm' * @endcode * * The $form argument to form-related functions is a specialized render array @@ -1925,17 +1925,17 @@ function hook_cron() { // Short-running operation example, not using a queue: // Delete all expired records since the last cron run. - $expires = \Drupal::state()->get('mymodule.last_check', 0); + $expires = \Drupal::state()->get('my_module.last_check', 0); $request_time = \Drupal::time()->getRequestTime(); - \Drupal::database()->delete('mymodule_table') + \Drupal::database()->delete('my_module_table') ->condition('expires', $expires, '>=') ->execute(); - \Drupal::state()->set('mymodule.last_check', $request_time); + \Drupal::state()->set('my_module.last_check', $request_time); // Long-running operation example, leveraging a queue: // Queue news feeds for updates once their refresh interval has elapsed. - $queue = \Drupal::queue('mymodule.feeds'); - $ids = \Drupal::entityTypeManager()->getStorage('mymodule_feed')->getFeedIdsToRefresh(); + $queue = \Drupal::queue('my_module.feeds'); + $ids = \Drupal::entityTypeManager()->getStorage('my_module_feed')->getFeedIdsToRefresh(); foreach (Feed::loadMultiple($ids) as $feed) { if ($queue->createItem($feed)) { // Add timestamp to avoid queueing item more than once. @@ -1943,7 +1943,7 @@ function hook_cron() { $feed->save(); } } - $ids = \Drupal::entityQuery('mymodule_feed') + $ids = \Drupal::entityQuery('my_module_feed') ->accessCheck(FALSE) ->condition('queued', $request_time - (3600 * 6), '<') ->execute(); @@ -1965,7 +1965,7 @@ function hook_cron() { * @see hook_data_type_info() */ function hook_data_type_info_alter(&$data_types) { - $data_types['email']['class'] = '\Drupal\mymodule\Type\Email'; + $data_types['email']['class'] = '\Drupal\my_module\Type\Email'; } /** @@ -1986,7 +1986,7 @@ function hook_data_type_info_alter(&$data_types) { function hook_queue_info_alter(&$queues) { // This site has many feeds so let's spend 90 seconds on each cron run // updating feeds instead of the default 60. - $queues['mymodule_feeds']['cron']['time'] = 90; + $queues['my_module_feeds']['cron']['time'] = 90; } /** @@ -1999,7 +1999,7 @@ function hook_condition_info_alter(array &$definitions) { // Add custom or modify existing condition definitions. if (isset($definitions['node_type']) && $definitions['node_type']['class'] == 'Drupal\node\Plugin\Condition\NodeType') { // If the node_type's class is unaltered, use a custom implementation. - $definitions['node_type']['class'] = 'Drupal\mymodule\Plugin\Condition\NodeType'; + $definitions['node_type']['class'] = 'Drupal\my_module\Plugin\Condition\NodeType'; } } @@ -2302,7 +2302,7 @@ function hook_config_schema_info_alter(&$definitions) { * @see \Drupal\Core\Validation\Annotation\Constraint */ function hook_validation_constraint_alter(array &$definitions) { - $definitions['Null']['class'] = '\Drupal\mymodule\Plugin\Validation\Constraints\MyClass'; + $definitions['Null']['class'] = '\Drupal\my_module\Plugin\Validation\Constraints\MyClass'; } /** @@ -2645,8 +2645,8 @@ function hook_validation_constraint_alter(array &$definitions) { * @code * public function counter(Request $request) { * $session = $request->getSession(); - * $count = $session->get('mymodule.counter', 0) + 1; - * $session->set('mymodule.counter', $count); + * $count = $session->get('my_module.counter', 0) + 1; + * $session->set('my_module.counter', $count); * * return [ * '#markup' => $this->t('Page Views: @count', ['@count' => $count]), @@ -2658,7 +2658,7 @@ function hook_validation_constraint_alter(array &$definitions) { * * public function reset(Request $request) { * $session = $request->getSession(); - * $session->remove('mymodule.counter'); + * $session->remove('my_module.counter'); * } * @endcode * diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 10d835f027c5..53fbb992eaab 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -371,7 +371,7 @@ function drupal_maintenance_theme() { * * Example: * @code - * function mymodule_log_stream_handle($new_handle = NULL) { + * function my_module_log_stream_handle($new_handle = NULL) { * static $handle; * if (isset($new_handle)) { * $handle = $new_handle; diff --git a/core/lib/Drupal/Core/Command/GenerateProxyClassCommand.php b/core/lib/Drupal/Core/Command/GenerateProxyClassCommand.php index c34da7f38d0d..889c828ec5cd 100644 --- a/core/lib/Drupal/Core/Command/GenerateProxyClassCommand.php +++ b/core/lib/Drupal/Core/Command/GenerateProxyClassCommand.php @@ -47,7 +47,7 @@ protected function configure() { ->setDescription('Dumps a generated proxy class into its appropriate namespace.') ->addUsage('\'Drupal\Core\Batch\BatchStorage\' "core/lib/Drupal/Core"') ->addUsage('\'Drupal\block\BlockRepository\' "core/modules/block/src"') - ->addUsage('\'Drupal\mymodule\MyClass\' "modules/contrib/mymodule/src"'); + ->addUsage('\'Drupal\my_module\MyClass\' "modules/contrib/my_module/src"'); } /** diff --git a/core/lib/Drupal/Core/Database/StatementInterface.php b/core/lib/Drupal/Core/Database/StatementInterface.php index 66c53076d50a..ad993fa0e25f 100644 --- a/core/lib/Drupal/Core/Database/StatementInterface.php +++ b/core/lib/Drupal/Core/Database/StatementInterface.php @@ -2,20 +2,18 @@ namespace Drupal\Core\Database; -// cSpell:ignore mydriver - /** * Represents a prepared statement. * * Child implementations should either extend StatementWrapperIterator: * @code - * class Drupal\mymodule\Driver\Database\mydriver\Statement extends Drupal\Core\Database\StatementWrapperIterator {} + * class Drupal\my_module\Driver\Database\my_driver\Statement extends Drupal\Core\Database\StatementWrapperIterator {} * @endcode * or define their own class. If defining their own class, they will also have * to implement either the \Iterator or \IteratorAggregate interface before * Drupal\Core\Database\StatementInterface: * @code - * class Drupal\mymodule\Driver\Database\mydriver\Statement implements Iterator, Drupal\Core\Database\StatementInterface {} + * class Drupal\my_module\Driver\Database\my_driver\Statement implements Iterator, Drupal\Core\Database\StatementInterface {} * @endcode * * @ingroup database diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index 50fc9efcf64d..c6c3ec872b81 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -51,7 +51,7 @@ * - The entity-type-specific hooks are represented in the list below as * hook_ENTITY_TYPE_... (hook_ENTITY_TYPE_create() in this example). To * implement one of these hooks for an entity whose machine name is "foo", - * define a function called mymodule_foo_create(), for instance. Also note + * define a function called my_module_foo_create(), for instance. Also note * that the entity or array of entities that are passed into a specific-type * hook are of the specific entity class, not the generic Entity class, so in * your implementation, you can make the $entity argument something like $node @@ -817,7 +817,7 @@ function hook_entity_type_build(array &$entity_types) { /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */ // Add a form for a custom node form without overriding the default // node form. To override the default node form, use hook_entity_type_alter(). - $entity_types['node']->setFormClass('mymodule_foo', 'Drupal\mymodule\NodeFooForm'); + $entity_types['node']->setFormClass('my_module_foo', 'Drupal\my_module\NodeFooForm'); } /** @@ -846,7 +846,7 @@ function hook_entity_type_alter(array &$entity_types) { /** @var \Drupal\Core\Entity\EntityTypeInterface[] $entity_types */ // Set the controller class for nodes to an alternate implementation of the // Drupal\Core\Entity\EntityStorageInterface interface. - $entity_types['node']->setStorageClass('Drupal\mymodule\MyCustomNodeStorage'); + $entity_types['node']->setStorageClass('Drupal\my_module\MyCustomNodeStorage'); } /** @@ -901,7 +901,7 @@ function hook_entity_bundle_info() { function hook_entity_bundle_info_alter(&$bundles) { $bundles['user']['user']['label'] = t('Full account'); // Override the bundle class for the "article" node type in a custom module. - $bundles['node']['article']['class'] = 'Drupal\mymodule\Entity\Article'; + $bundles['node']['article']['class'] = 'Drupal\my_module\Entity\Article'; } /** @@ -1042,7 +1042,7 @@ function hook_entity_preload(array $ids, $entity_type_id) { $entities = []; foreach ($ids as $id) { - $entities[] = mymodule_swap_revision($id); + $entities[] = my_module_swap_revision($id); } return $entities; @@ -1067,7 +1067,7 @@ function hook_entity_preload(array $ids, $entity_type_id) { */ function hook_entity_load(array $entities, $entity_type_id) { foreach ($entities as $entity) { - $entity->foo = mymodule_add_something($entity); + $entity->foo = my_module_add_something($entity); } } @@ -1082,7 +1082,7 @@ function hook_entity_load(array $entities, $entity_type_id) { */ function hook_ENTITY_TYPE_load($entities) { foreach ($entities as $entity) { - $entity->foo = mymodule_add_something($entity); + $entity->foo = my_module_add_something($entity); } } @@ -1100,7 +1100,7 @@ function hook_ENTITY_TYPE_load($entities) { */ function hook_entity_storage_load(array $entities, $entity_type) { foreach ($entities as $entity) { - $entity->foo = mymodule_add_something_uncached($entity); + $entity->foo = my_module_add_something_uncached($entity); } } @@ -1116,7 +1116,7 @@ function hook_entity_storage_load(array $entities, $entity_type) { */ function hook_ENTITY_TYPE_storage_load(array $entities) { foreach ($entities as $entity) { - $entity->foo = mymodule_add_something_uncached($entity); + $entity->foo = my_module_add_something_uncached($entity); } } @@ -1517,12 +1517,12 @@ function hook_ENTITY_TYPE_revision_delete(\Drupal\Core\Entity\EntityInterface $e */ function hook_entity_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) { // Only do the extra work if the component is configured to be displayed. - // This assumes a 'mymodule_addition' extra field has been defined for the + // This assumes a 'my_module_addition' extra field has been defined for the // entity bundle in hook_entity_extra_field_info(). - if ($display->getComponent('mymodule_addition')) { - $build['mymodule_addition'] = [ - '#markup' => mymodule_addition($entity), - '#theme' => 'mymodule_my_additional_field', + if ($display->getComponent('my_module_addition')) { + $build['my_module_addition'] = [ + '#markup' => my_module_addition($entity), + '#theme' => 'my_module_my_additional_field', ]; } } @@ -1550,12 +1550,12 @@ function hook_entity_view(array &$build, \Drupal\Core\Entity\EntityInterface $en */ function hook_ENTITY_TYPE_view(array &$build, \Drupal\Core\Entity\EntityInterface $entity, \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display, $view_mode) { // Only do the extra work if the component is configured to be displayed. - // This assumes a 'mymodule_addition' extra field has been defined for the + // This assumes a 'my_module_addition' extra field has been defined for the // entity bundle in hook_entity_extra_field_info(). - if ($display->getComponent('mymodule_addition')) { - $build['mymodule_addition'] = [ - '#markup' => mymodule_addition($entity), - '#theme' => 'mymodule_my_additional_field', + if ($display->getComponent('my_module_addition')) { + $build['my_module_addition'] = [ + '#markup' => my_module_addition($entity), + '#theme' => 'my_module_my_additional_field', ]; } } @@ -1660,16 +1660,16 @@ function hook_entity_prepare_view($entity_type_id, array $entities, array $displ // Load a specific node into the user object for later theming. if (!empty($entities) && $entity_type_id == 'user') { // Only do the extra work if the component is configured to be - // displayed. This assumes a 'mymodule_addition' extra field has been + // displayed. This assumes a 'my_module_addition' extra field has been // defined for the entity bundle in hook_entity_extra_field_info(). $ids = []; foreach ($entities as $id => $entity) { - if ($displays[$entity->bundle()]->getComponent('mymodule_addition')) { + if ($displays[$entity->bundle()]->getComponent('my_module_addition')) { $ids[] = $id; } } if ($ids) { - $nodes = mymodule_get_user_nodes($ids); + $nodes = my_module_get_user_nodes($ids); foreach ($ids as $id) { $entities[$id]->user_node = $nodes[$id]; } @@ -1925,11 +1925,11 @@ function hook_entity_form_display_alter(\Drupal\Core\Entity\Display\EntityFormDi function hook_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) { if ($entity_type->id() == 'node') { $fields = []; - $fields['mymodule_text'] = BaseFieldDefinition::create('string') + $fields['my_module_text'] = BaseFieldDefinition::create('string') ->setLabel(t('The text')) - ->setDescription(t('A text property added by mymodule.')) + ->setDescription(t('A text property added by my_module.')) ->setComputed(TRUE) - ->setClass('\Drupal\mymodule\EntityComputedText'); + ->setClass('\Drupal\my_module\EntityComputedText'); return $fields; } @@ -1951,9 +1951,9 @@ function hook_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $en * https://www.drupal.org/node/2346329. */ function hook_entity_base_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type) { - // Alter the mymodule_text field to use a custom class. - if ($entity_type->id() == 'node' && !empty($fields['mymodule_text'])) { - $fields['mymodule_text']->setClass('\Drupal\anothermodule\EntityComputedText'); + // Alter the my_module_text field to use a custom class. + if ($entity_type->id() == 'node' && !empty($fields['my_module_text'])) { + $fields['my_module_text']->setClass('\Drupal\another_module\EntityComputedText'); } } @@ -1990,8 +1990,8 @@ function hook_entity_bundle_field_info(\Drupal\Core\Entity\EntityTypeInterface $ // Add a property only to nodes of the 'article' bundle. if ($entity_type->id() == 'node' && $bundle == 'article') { $fields = []; - $storage_definitions = mymodule_entity_field_storage_info($entity_type); - $fields['mymodule_bundle_field'] = FieldDefinition::createFromFieldStorageDefinition($storage_definitions['mymodule_bundle_field']) + $storage_definitions = my_module_entity_field_storage_info($entity_type); + $fields['my_module_bundle_field'] = FieldDefinition::createFromFieldStorageDefinition($storage_definitions['my_module_bundle_field']) ->setLabel(t('Bundle Field')); return $fields; } @@ -2016,9 +2016,9 @@ function hook_entity_bundle_field_info(\Drupal\Core\Entity\EntityTypeInterface $ * https://www.drupal.org/node/2346347. */ function hook_entity_bundle_field_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) { - if ($entity_type->id() == 'node' && $bundle == 'article' && !empty($fields['mymodule_text'])) { - // Alter the mymodule_text field to use a custom class. - $fields['mymodule_text']->setClass('\Drupal\anothermodule\EntityComputedText'); + if ($entity_type->id() == 'node' && $bundle == 'article' && !empty($fields['my_module_text'])) { + // Alter the my_module_text field to use a custom class. + $fields['my_module_text']->setClass('\Drupal\another_module\EntityComputedText'); } } @@ -2072,8 +2072,8 @@ function hook_entity_field_storage_info(\Drupal\Core\Entity\EntityTypeInterface */ function hook_entity_field_storage_info_alter(&$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type) { // Alter the max_length setting. - if ($entity_type->id() == 'node' && !empty($fields['mymodule_text'])) { - $fields['mymodule_text']->setSetting('max_length', 128); + if ($entity_type->id() == 'node' && !empty($fields['my_module_text'])) { + $fields['my_module_text']->setSetting('max_length', 128); } } diff --git a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php index 34007fa8c3bc..f1fb3e4a869a 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandlerInterface.php @@ -316,7 +316,7 @@ public function invokeAllDeprecated($description, $hook, array $args = []); * 'unalterable' => $unalterable, * 'foo' => 'bar', * ); - * $this->alter('mymodule_data', $alterable1, $alterable2, $context); + * $this->alter('my_module_data', $alterable1, $alterable2, $context); * @endcode * * Note that objects are always passed by reference. If it is absolutely @@ -326,7 +326,7 @@ public function invokeAllDeprecated($description, $hook, array $args = []); * $context = array( * 'unalterable_object' => clone $object, * ); - * $this->alter('mymodule_data', $data, $context); + * $this->alter('my_module_data', $data, $context); * @endcode * * @param string|array $type diff --git a/core/lib/Drupal/Core/Extension/module.api.php b/core/lib/Drupal/Core/Extension/module.api.php index ed735b833928..2fd2a5a19816 100644 --- a/core/lib/Drupal/Core/Extension/module.api.php +++ b/core/lib/Drupal/Core/Extension/module.api.php @@ -40,8 +40,8 @@ * * @section sec_how How to write update code * Update code for a module is put into an implementation of hook_update_N(), - * which goes into file mymodule.install (if your module's machine name is - * mymodule). See the documentation of hook_update_N() and + * which goes into file my_module.install (if your module's machine name is + * my_module). See the documentation of hook_update_N() and * https://www.drupal.org/node/2535316 for details and examples. * * @section sec_test Testing update code @@ -170,7 +170,7 @@ function hook_system_info_alter(array &$info, \Drupal\Core\Extension\Extension $ * do them again. */ function hook_module_preinstall($module, bool $is_syncing) { - mymodule_cache_clear(); + my_module_cache_clear(); } /** @@ -199,10 +199,10 @@ function hook_module_preinstall($module, bool $is_syncing) { */ function hook_modules_installed($modules, $is_syncing) { if (in_array('lousy_module', $modules)) { - \Drupal::state()->set('mymodule.lousy_module_compatibility', TRUE); + \Drupal::state()->set('my_module.lousy_module_compatibility', TRUE); } if (!$is_syncing) { - \Drupal::service('mymodule.service')->doSomething($modules); + \Drupal::service('my_module.service')->doSomething($modules); } } @@ -251,7 +251,7 @@ function hook_modules_installed($modules, $is_syncing) { */ function hook_install($is_syncing) { // Set general module variables. - \Drupal::state()->set('mymodule.foo', 'bar'); + \Drupal::state()->set('my_module.foo', 'bar'); } /** @@ -267,7 +267,7 @@ function hook_install($is_syncing) { * do them again. */ function hook_module_preuninstall($module, bool $is_syncing) { - mymodule_cache_clear(); + my_module_cache_clear(); } /** @@ -293,11 +293,11 @@ function hook_module_preuninstall($module, bool $is_syncing) { */ function hook_modules_uninstalled($modules, $is_syncing) { if (in_array('lousy_module', $modules)) { - \Drupal::state()->delete('mymodule.lousy_module_compatibility'); + \Drupal::state()->delete('my_module.lousy_module_compatibility'); } - mymodule_cache_rebuild(); + my_module_cache_rebuild(); if (!$is_syncing) { - \Drupal::service('mymodule.service')->doSomething($modules); + \Drupal::service('my_module.service')->doSomething($modules); } } @@ -335,7 +335,7 @@ function hook_modules_uninstalled($modules, $is_syncing) { */ function hook_uninstall($is_syncing) { // Delete remaining general module variables. - \Drupal::state()->delete('mymodule.foo'); + \Drupal::state()->delete('my_module.foo'); } /** @@ -536,8 +536,9 @@ function hook_install_tasks_alter(&$tasks, $install_state) { * @section sec_naming Naming and documenting your function * For each change in a module that requires one or more actions to be performed * when updating a site, add a new implementation of hook_update_N() to your - * mymodule.install file (assuming mymodule is the machine name of your module). - * Implementations of hook_update_N() are named (module name)_update_(number). + * my_module.install file (assuming my_module is the machine name of your + * module). Implementations of hook_update_N() are named (module + * name)_update_(number). * * The number (N) must be higher than hook_update_last_removed(). * @@ -574,15 +575,15 @@ function hook_install_tasks_alter(&$tasks, $install_state) { * Drupal Core node module. * - node_update_81001(): The first update for the Drupal 8.10.x version of the * Drupal Core node module. - * - mymodule_update_8101(): The first update for your custom or contributed + * - my_module_update_8101(): The first update for your custom or contributed * module's 8.x-1.x versions. - * - mymodule_update_8201(): The first update for the 8.x-2.x versions. - * - mymodule_update_80201(): Alternate five-digit format for the first update + * - my_module_update_8201(): The first update for the 8.x-2.x versions. + * - my_module_update_80201(): Alternate five-digit format for the first update * for the 8.x-2.x versions. Subsequent update hooks must always be five * digits and higher than 80201. - * - mymodule_update_8201(): The first update for the custom or contributed + * - my_module_update_8201(): The first update for the custom or contributed * module's 2.0.x versions, which are compatible with Drupal 8 and 9. - * - mymodule_update_91001(): The first update for the custom or contributed + * - my_module_update_91001(): The first update for the custom or contributed * module's 10.0.x versions, which are compatible with Drupal 9. * * Never renumber update functions. The numeric part of the hook implementation @@ -829,9 +830,9 @@ function hook_post_update_NAME(&$sandbox) { */ function hook_removed_post_updates() { return [ - 'mymodule_post_update_foo' => '8.x-2.0', - 'mymodule_post_update_bar' => '8.x-3.0', - 'mymodule_post_update_baz' => '8.x-3.0', + 'my_module_post_update_foo' => '8.x-2.0', + 'my_module_post_update_bar' => '8.x-3.0', + 'my_module_post_update_baz' => '8.x-3.0', ]; } @@ -843,8 +844,8 @@ function hook_removed_post_updates() { * system to determine the appropriate order in which updates should be run, as * well as to search for missing dependencies. * - * Implementations of this hook should be placed in a mymodule.install file in - * the same directory as mymodule.module. + * Implementations of this hook should be placed in a my_module.install file in + * the same directory as my_module.module. * * @return array * A multidimensional array containing information about the module update @@ -863,21 +864,21 @@ function hook_removed_post_updates() { * @see hook_update_N() */ function hook_update_dependencies() { - // Indicate that the mymodule_update_8001() function provided by this module + // Indicate that the my_module_update_8001() function provided by this module // must run after the another_module_update_8003() function provided by the // 'another_module' module. - $dependencies['mymodule'][8001] = [ + $dependencies['my_module'][8001] = [ 'another_module' => 8003, ]; - // Indicate that the mymodule_update_8002() function provided by this module + // Indicate that the my_module_update_8002() function provided by this module // must run before the yet_another_module_update_8005() function provided by // the 'yet_another_module' module. (Note that declaring dependencies in this // direction should be done only in rare situations, since it can lead to the // following problem: If a site has already run the yet_another_module // module's database updates before it updates its codebase to pick up the - // newest mymodule code, then the dependency declared here will be ignored.) + // newest my_module code, then the dependency declared here will be ignored.) $dependencies['yet_another_module'][8005] = [ - 'mymodule' => 8002, + 'my_module' => 8002, ]; return $dependencies; } @@ -885,24 +886,24 @@ function hook_update_dependencies() { /** * Return a number which is no longer available as hook_update_N(). * - * If you remove some update functions from your mymodule.install file, you + * If you remove some update functions from your my_module.install file, you * should notify Drupal of those missing functions. This way, Drupal can * ensure that no update is accidentally skipped. * - * Implementations of this hook should be placed in a mymodule.install file in - * the same directory as mymodule.module. + * Implementations of this hook should be placed in a my_module.install file in + * the same directory as my_module.module. * * @return int * An integer, corresponding to hook_update_N() which has been removed from - * mymodule.install. + * my_module.install. * * @ingroup update_api * * @see hook_update_N() */ function hook_update_last_removed() { - // We've removed the 8.x-1.x version of mymodule, including database updates. - // The next update function is mymodule_update_8200(). + // We've removed the 8.x-1.x version of my_module, including database updates. + // The next update function is my_module_update_8200(). return 8103; } diff --git a/core/lib/Drupal/Core/Flood/FloodInterface.php b/core/lib/Drupal/Core/Flood/FloodInterface.php index 2c5e0afe36ec..4f51f0858308 100644 --- a/core/lib/Drupal/Core/Flood/FloodInterface.php +++ b/core/lib/Drupal/Core/Flood/FloodInterface.php @@ -13,7 +13,7 @@ interface FloodInterface { * @param string $name * The name of an event. To prevent unintended name clashes, it is recommended * to use the module name first in the event name, optionally followed by - * a dot and the actual event name (e.g. "mymodule.my_event"). + * a dot and the actual event name (e.g. "my_module.my_event"). * @param int $window * (optional) Number of seconds before this event expires. Defaults to 3600 * (1 hour). Typically uses the same value as the isAllowed() $window diff --git a/core/lib/Drupal/Core/Form/FormBuilderInterface.php b/core/lib/Drupal/Core/Form/FormBuilderInterface.php index b5e51a5826da..a98650c23eb7 100644 --- a/core/lib/Drupal/Core/Form/FormBuilderInterface.php +++ b/core/lib/Drupal/Core/Form/FormBuilderInterface.php @@ -176,14 +176,14 @@ public function rebuildForm($form_id, FormStateInterface &$form_state, $old_form * $form_state build info array so that the reference can be preserved. For * example, a form builder function with the following signature: * @code - * function mymodule_form($form, FormStateInterface &$form_state, &$object) { + * function my_module_form($form, FormStateInterface &$form_state, &$object) { * } * @endcode * would be called via self::submitForm() as follows: * @code * $form_state->setValues($my_form_values); * $form_state->addBuildInfo('args', [&$object]); - * \Drupal::formBuilder()->submitForm('mymodule_form', $form_state); + * \Drupal::formBuilder()->submitForm('my_module_form', $form_state); * @endcode * phpcs:enable */ diff --git a/core/lib/Drupal/Core/Form/form.api.php b/core/lib/Drupal/Core/Form/form.api.php index 3fb1ca909a45..572f22003fd1 100644 --- a/core/lib/Drupal/Core/Form/form.api.php +++ b/core/lib/Drupal/Core/Form/form.api.php @@ -203,7 +203,7 @@ function hook_ajax_render_alter(array &$data) { */ function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { if (isset($form['type']) && $form['type']['#value'] . '_node_settings' == $form_id) { - $upload_enabled_types = \Drupal::config('mymodule.settings')->get('upload_enabled_types'); + $upload_enabled_types = \Drupal::config('my_module.settings')->get('upload_enabled_types'); $form['workflow']['upload_' . $form['type']['#value']] = [ '#type' => 'radios', '#title' => t('Attachments'), @@ -211,7 +211,7 @@ function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_stat '#options' => [t('Disabled'), t('Enabled')], ]; // Add a custom submit handler to save the array of types back to the config file. - $form['actions']['submit']['#submit'][] = 'mymodule_upload_enabled_types_submit'; + $form['actions']['submit']['#submit'][] = 'my_module_upload_enabled_types_submit'; } } diff --git a/core/lib/Drupal/Core/Lock/LockBackendInterface.php b/core/lib/Drupal/Core/Lock/LockBackendInterface.php index 5f74cdda9c04..aa8707478695 100644 --- a/core/lib/Drupal/Core/Lock/LockBackendInterface.php +++ b/core/lib/Drupal/Core/Lock/LockBackendInterface.php @@ -24,12 +24,12 @@ * To use this API, pick a unique name for the lock. A sensible choice is the * name of the function performing the operation. Here is a simple example: * @code - * function mymodule_long_operation() { + * function my_module_long_operation() { * $lock = \Drupal::lock(); - * if ($lock->acquire('mymodule_long_operation')) { + * if ($lock->acquire('my_module_long_operation')) { * // Do the long operation here. * // ... - * $lock->release('mymodule_long_operation'); + * $lock->release('my_module_long_operation'); * } * } * @endcode diff --git a/core/lib/Drupal/Core/Pager/PagerManagerInterface.php b/core/lib/Drupal/Core/Pager/PagerManagerInterface.php index 113fcb843025..21feb4857728 100644 --- a/core/lib/Drupal/Core/Pager/PagerManagerInterface.php +++ b/core/lib/Drupal/Core/Pager/PagerManagerInterface.php @@ -43,18 +43,18 @@ interface PagerManagerInterface { * that invokes an external datastore with an SQL-like syntax: * @code * // First find the total number of items and initialize the pager. - * $total = mymodule_select("SELECT COUNT(*) FROM data WHERE status = 1")->result(); - * $num_per_page = \Drupal::config('mymodule.settings')->get('num_per_page'); + * $total = my_module_select("SELECT COUNT(*) FROM data WHERE status = 1")->result(); + * $num_per_page = \Drupal::config('my_module.settings')->get('num_per_page'); * $pager = \Drupal::service('pager.manager')->createPager($total, $num_per_page); * $page = $pager->getCurrentPage(); * * // Next, retrieve the items for the current page and put them into a * // render array. * $offset = $num_per_page * $page; - * $result = mymodule_select("SELECT * FROM data " . $where . " LIMIT %d, %d", $offset, $num_per_page)->fetchAll(); + * $result = my_module_select("SELECT * FROM data " . $where . " LIMIT %d, %d", $offset, $num_per_page)->fetchAll(); * $render = []; * $render[] = [ - * '#theme' => 'mymodule_results', + * '#theme' => 'my_module_results', * '#result' => $result, * ]; * @@ -76,9 +76,9 @@ interface PagerManagerInterface { * // page of results that will exist within the set. * $pager_manager = \Drupal::service('pager.manager'); * $page = $pager_manager->findPage(); - * $num_per_page = \Drupal::config('mymodule.settings')->get('num_per_page'); + * $num_per_page = \Drupal::config('my_module.settings')->get('num_per_page'); * $offset = $num_per_page * $page; - * $result = mymodule_remote_search($keywords, $offset, $num_per_page); + * $result = my_module_remote_search($keywords, $offset, $num_per_page); * * // Now that we have the total number of results, initialize the pager. * $pager_manager = \Drupal::service('pager.manager'); diff --git a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php index b166f580f87d..3b9036e66337 100644 --- a/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php +++ b/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php @@ -190,7 +190,7 @@ public function setCacheBackend(CacheBackendInterface $cache_backend, $cache_key * * @param string $alter_hook * Name of the alter hook; for example, to invoke - * hook_mymodule_data_alter() pass in "mymodule_data". + * hook_my_module_data_alter() pass in "my_module_data". */ protected function alterInfo($alter_hook) { $this->alterHook = $alter_hook; diff --git a/core/lib/Drupal/Core/Render/Element/FormElement.php b/core/lib/Drupal/Core/Render/Element/FormElement.php index d0b0f0ff4de9..5a99c475760a 100644 --- a/core/lib/Drupal/Core/Render/Element/FormElement.php +++ b/core/lib/Drupal/Core/Render/Element/FormElement.php @@ -160,15 +160,15 @@ public static function validatePattern(&$element, FormStateInterface $form_state * and #autocomplete_query_parameters properties if present. * * For example, suppose your autocomplete route name is - * 'mymodule.autocomplete' and its path is - * '/mymodule/autocomplete/{a}/{b}'. In a form array, you would create a text + * 'my_module.autocomplete' and its path is + * '/my_module/autocomplete/{a}/{b}'. In a form array, you would create a text * field with properties: * @code - * '#autocomplete_route_name' => 'mymodule.autocomplete', + * '#autocomplete_route_name' => 'my_module.autocomplete', * '#autocomplete_route_parameters' => array('a' => $some_key, 'b' => $some_id), * @endcode * If the user types "keywords" in that field, the full path called would be: - * 'mymodule_autocomplete/$some_key/$some_id?q=keywords' + * 'my_module_autocomplete/$some_key/$some_id?q=keywords' * * @param array $element * The form element to process. Properties used: diff --git a/core/lib/Drupal/Core/Render/theme.api.php b/core/lib/Drupal/Core/Render/theme.api.php index e0706ab6d7d4..c78cd706c3a2 100644 --- a/core/lib/Drupal/Core/Render/theme.api.php +++ b/core/lib/Drupal/Core/Render/theme.api.php @@ -687,7 +687,7 @@ function hook_theme_suggestions_HOOK(array $variables) { * node and taxonomy term templates based on the user being logged in. * * @code - * function MYMODULE_theme_suggestions_alter(array &$suggestions, array &$variables, $hook) { + * function MY_MODULE_theme_suggestions_alter(array &$suggestions, array &$variables, $hook) { * if (\Drupal::currentUser()->isAuthenticated() && in_array($hook, array('node', 'taxonomy_term'))) { * $suggestions[] = $hook . '__' . 'logged_in'; * } @@ -741,7 +741,7 @@ function hook_theme_suggestions_alter(array &$suggestions, array &$variables, $h * In the following example, we provide an alternative template suggestion to * node templates based on the user being logged in. * @code - * function MYMODULE_theme_suggestions_node_alter(array &$suggestions, array $variables) { + * function MY_MODULE_theme_suggestions_node_alter(array &$suggestions, array $variables) { * if (\Drupal::currentUser()->isAuthenticated()) { * $suggestions[] = 'node__logged_in'; * } @@ -869,7 +869,7 @@ function hook_element_info_alter(array &$info) { */ function hook_element_plugin_alter(array &$definitions) { // Use a custom class for the LayoutBuilder element. - $definitions['layout_builder']['class'] = '\Drupal\mymodule\Element\MyLayoutBuilderElement'; + $definitions['layout_builder']['class'] = '\Drupal\my_module\Element\MyLayoutBuilderElement'; } /** @@ -1133,7 +1133,7 @@ function hook_page_attachments_alter(array &$attachments) { * A renderable array representing the top of the page. */ function hook_page_top(array &$page_top) { - $page_top['mymodule'] = ['#markup' => 'This is the top.']; + $page_top['my_module'] = ['#markup' => 'This is the top.']; } /** @@ -1143,7 +1143,7 @@ function hook_page_top(array &$page_top) { * A renderable array representing the bottom of the page. */ function hook_page_bottom(array &$page_bottom) { - $page_bottom['mymodule'] = ['#markup' => 'This is the bottom.']; + $page_bottom['my_module'] = ['#markup' => 'This is the bottom.']; } /** diff --git a/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php b/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php index 61fa161e83ec..7b240cebb968 100644 --- a/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php +++ b/core/lib/Drupal/Core/Theme/ThemeManagerInterface.php @@ -91,7 +91,7 @@ public function setActiveTheme(ActiveTheme $active_theme); * 'unalterable' => $unalterable, * 'foo' => 'bar', * ); - * $this->alter('mymodule_data', $alterable1, $alterable2, $context); + * $this->alter('my_module_data', $alterable1, $alterable2, $context); * @endcode * * Note that objects are always passed by reference. If it is absolutely @@ -101,7 +101,7 @@ public function setActiveTheme(ActiveTheme $active_theme); * $context = array( * 'unalterable_object' => clone $object, * ); - * $this->alter('mymodule_data', $data, $context); + * $this->alter('my_module_data', $data, $context); * @endcode * * @param string|array $type diff --git a/core/misc/cspell/dictionary.txt b/core/misc/cspell/dictionary.txt index c10740041070..b02f18a8422d 100644 --- a/core/misc/cspell/dictionary.txt +++ b/core/misc/cspell/dictionary.txt @@ -17,7 +17,6 @@ alternatif amphibius ampm anonyme -anothermodule antilop anyall applix @@ -498,7 +497,6 @@ multivalue multivalued muuuh myclabs -mymodule mysqladmin mysqldump mystarterkit diff --git a/core/modules/comment/comment.api.php b/core/modules/comment/comment.api.php index ec6b4ce8ef1d..adb7c586302e 100644 --- a/core/modules/comment/comment.api.php +++ b/core/modules/comment/comment.api.php @@ -31,8 +31,8 @@ * @see \Drupal\comment\CommentViewBuilder::buildLinks() */ function hook_comment_links_alter(array &$links, CommentInterface $entity, array &$context) { - $links['mymodule'] = [ - '#theme' => 'links__comment__mymodule', + $links['my_module'] = [ + '#theme' => 'links__comment__my_module', '#attributes' => ['class' => ['links', 'inline']], '#links' => [ 'comment-report' => [ diff --git a/core/modules/field/field.api.php b/core/modules/field/field.api.php index ac963a3952c2..dd41dff20144 100644 --- a/core/modules/field/field.api.php +++ b/core/modules/field/field.api.php @@ -53,7 +53,7 @@ function hook_field_info_alter(&$info) { // Change the default widget for fields of type 'foo'. if (isset($info['foo'])) { - $info['foo']['default_widget'] = 'mymodule_widget'; + $info['foo']['default_widget'] = 'my_module_widget'; } } @@ -249,9 +249,9 @@ function hook_field_widget_single_element_form_alter(array &$element, \Drupal\Co */ function hook_field_widget_single_element_WIDGET_TYPE_form_alter(array &$element, \Drupal\Core\Form\FormStateInterface $form_state, array $context) { // Code here will only act on widgets of type WIDGET_TYPE. For example, - // hook_field_widget_single_element_mymodule_autocomplete_form_alter() will - // only act on widgets of type 'mymodule_autocomplete'. - $element['#autocomplete_route_name'] = 'mymodule.autocomplete_route'; + // hook_field_widget_single_element_my_module_autocomplete_form_alter() will + // only act on widgets of type 'my_module_autocomplete'. + $element['#autocomplete_route_name'] = 'my_module.autocomplete_route'; } /** diff --git a/core/modules/filter/filter.api.php b/core/modules/filter/filter.api.php index bf4c52e83d29..ab8edffafbba 100644 --- a/core/modules/filter/filter.api.php +++ b/core/modules/filter/filter.api.php @@ -52,7 +52,7 @@ function hook_filter_secure_image_alter(&$image) { * The format object of the format being disabled. */ function hook_filter_format_disable($format) { - mymodule_cache_rebuild(); + my_module_cache_rebuild(); } /** diff --git a/core/modules/help/src/HelpTopicPluginManager.php b/core/modules/help/src/HelpTopicPluginManager.php index fb0a5676cf20..12aef2382e33 100644 --- a/core/modules/help/src/HelpTopicPluginManager.php +++ b/core/modules/help/src/HelpTopicPluginManager.php @@ -48,8 +48,8 @@ * derived plugins, and a 'deriver' property giving the name of a class * implementing \Drupal\Component\Plugin\Derivative\DeriverInterface. Example: * @code - * mymodule_prefix: - * deriver: 'Drupal\mymodule\Plugin\Deriver\HelpTopicDeriver' + * my_module_prefix: + * deriver: 'Drupal\my_module\Plugin\Deriver\HelpTopicDeriver' * @endcode * * @ingroup help_docs @@ -123,7 +123,7 @@ protected function getDiscovery() { $discovery = new HelpTopicDiscovery($all_directories); // Also allow modules/profiles to extend help topic discovery to their - // own plugins and derivers, in mymodule.help_topics.yml files. + // own plugins and derivers, in my_module.help_topics.yml files. $discovery = new YamlDiscoveryDecorator($discovery, 'help_topics', $module_directories); $discovery = new ContainerDerivativeDiscoveryDecorator($discovery); $this->discovery = $discovery; diff --git a/core/modules/help_topics/src/HelpTopicPluginManager.php b/core/modules/help_topics/src/HelpTopicPluginManager.php index fccb4bbb16c9..87531a664a88 100644 --- a/core/modules/help_topics/src/HelpTopicPluginManager.php +++ b/core/modules/help_topics/src/HelpTopicPluginManager.php @@ -43,8 +43,8 @@ * derived plugins, and a 'deriver' property giving the name of a class * implementing \Drupal\Component\Plugin\Derivative\DeriverInterface. Example: * @code - * mymodule_prefix: - * deriver: 'Drupal\mymodule\Plugin\Deriver\HelpTopicDeriver' + * my_module_prefix: + * deriver: 'Drupal\my_module\Plugin\Deriver\HelpTopicDeriver' * @endcode * * @ingroup help_docs diff --git a/core/modules/image/image.api.php b/core/modules/image/image.api.php index 2f786fc318c8..8c7138992933 100644 --- a/core/modules/image/image.api.php +++ b/core/modules/image/image.api.php @@ -38,7 +38,7 @@ function hook_image_effect_info_alter(&$effects) { */ function hook_image_style_flush($style, $path = NULL) { // Empty cached data that contains information about the style. - \Drupal::cache('mymodule')->deleteAll(); + \Drupal::cache('my_module')->deleteAll(); } /** diff --git a/core/modules/language/src/LanguageNegotiatorInterface.php b/core/modules/language/src/LanguageNegotiatorInterface.php index 2702c8767ab0..d27d790e0ca1 100644 --- a/core/modules/language/src/LanguageNegotiatorInterface.php +++ b/core/modules/language/src/LanguageNegotiatorInterface.php @@ -34,7 +34,7 @@ * language (which by default inherits the interface language's values) * configurable: * @code - * function mymodule_language_types_info_alter(&$language_types) { + * function my_module_language_types_info_alter(&$language_types) { * unset($language_types[LanguageInterface::TYPE_CONTENT]['fixed']); * } * @endcode @@ -69,7 +69,7 @@ * hook_language_negotiation_info_alter(). Here is an example snippet that lets * path prefixes be ignored for administrative paths: * @code - * function mymodule_language_negotiation_info_alter(&$negotiation_info) { + * function my_module_language_negotiation_info_alter(&$negotiation_info) { * // Replace the original plugin with our own implementation. * $method_id = \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::METHOD_ID; * $negotiation_info[$method_id]['class'] = 'Drupal\my_module\Plugin\LanguageNegotiation\MyLanguageNegotiationUrl'; diff --git a/core/modules/migrate/migrate.api.php b/core/modules/migrate/migrate.api.php index 47a146ed1f9c..0339475ff0f7 100644 --- a/core/modules/migrate/migrate.api.php +++ b/core/modules/migrate/migrate.api.php @@ -155,9 +155,9 @@ */ function hook_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) { if ($migration->id() == 'd6_filter_formats') { - $value = $source->getDatabase()->query('SELECT [value] FROM {variable} WHERE [name] = :name', [':name' => 'mymodule_filter_foo_' . $row->getSourceProperty('format')])->fetchField(); + $value = $source->getDatabase()->query('SELECT [value] FROM {variable} WHERE [name] = :name', [':name' => 'my_module_filter_foo_' . $row->getSourceProperty('format')])->fetchField(); if ($value) { - $row->setSourceProperty('settings:mymodule:foo', unserialize($value)); + $row->setSourceProperty('settings:my_module:foo', unserialize($value)); } } } @@ -178,9 +178,9 @@ function hook_migrate_prepare_row(Row $row, MigrateSourceInterface $source, Migr * @ingroup migration */ function hook_migrate_MIGRATION_ID_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) { - $value = $source->getDatabase()->query('SELECT [value] FROM {variable} WHERE [name] = :name', [':name' => 'mymodule_filter_foo_' . $row->getSourceProperty('format')])->fetchField(); + $value = $source->getDatabase()->query('SELECT [value] FROM {variable} WHERE [name] = :name', [':name' => 'my_module_filter_foo_' . $row->getSourceProperty('format')])->fetchField(); if ($value) { - $row->setSourceProperty('settings:mymodule:foo', unserialize($value)); + $row->setSourceProperty('settings:my_module:foo', unserialize($value)); } } diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php index adaad9682e4c..01b29092a704 100644 --- a/core/modules/node/node.api.php +++ b/core/modules/node/node.api.php @@ -413,8 +413,8 @@ function hook_ranking() { * @see entity_crud */ function hook_node_links_alter(array &$links, NodeInterface $entity, array &$context) { - $links['mymodule'] = [ - '#theme' => 'links__node__mymodule', + $links['my_module'] = [ + '#theme' => 'links__node__my_module', '#attributes' => ['class' => ['links', 'inline']], '#links' => [ 'node-report' => [ diff --git a/core/modules/rest/rest.api.php b/core/modules/rest/rest.api.php index 2f3f6ee2c0d8..d5d1b429f129 100644 --- a/core/modules/rest/rest.api.php +++ b/core/modules/rest/rest.api.php @@ -20,9 +20,9 @@ function hook_rest_resource_alter(&$definitions) { if (isset($definitions['entity:node'])) { // We want to handle REST requests regarding nodes with our own plugin // class. - $definitions['entity:node']['class'] = 'Drupal\mymodule\Plugin\rest\resource\NodeResource'; + $definitions['entity:node']['class'] = 'Drupal\my_module\Plugin\rest\resource\NodeResource'; // Serialized nodes should be expanded to my specific node class. - $definitions['entity:node']['serialization_class'] = 'Drupal\mymodule\Entity\MyNode'; + $definitions['entity:node']['serialization_class'] = 'Drupal\my_module\Entity\MyNode'; } // We don't want Views to show up in the array of plugins at all. unset($definitions['entity:view']); diff --git a/core/modules/search/search.module b/core/modules/search/search.module index 84feabfed826..b571a01aad07 100644 --- a/core/modules/search/search.module +++ b/core/modules/search/search.module @@ -108,7 +108,7 @@ function search_cron() { * * If your module needs to provide a more complicated search form, then you * need to implement it yourself. In that case, you may wish to define it as a - * local task (tab) under the /search page (e.g. /search/mymodule) so that users + * local task (tab) under the /search page (e.g. /search/my_module) so that users * can easily find it. * * @see plugin_api diff --git a/core/modules/system/tests/src/Kernel/Mail/MailTest.php b/core/modules/system/tests/src/Kernel/Mail/MailTest.php index 3b99732d6971..d40d3c3d259a 100644 --- a/core/modules/system/tests/src/Kernel/Mail/MailTest.php +++ b/core/modules/system/tests/src/Kernel/Mail/MailTest.php @@ -64,10 +64,10 @@ public function testPluggableFramework() { $this->assertInstanceOf(TestPhpMailFailure::class, $mail_backend); // Add a module-specific mail backend. - $this->config('system.mail')->set('interface.mymodule_testkey', 'test_mail_collector')->save(); + $this->config('system.mail')->set('interface.my_module_testkey', 'test_mail_collector')->save(); // Get the added MailInterface class instance. - $mail_backend = \Drupal::service('plugin.manager.mail')->getInstance(['module' => 'mymodule', 'key' => 'testkey']); + $mail_backend = \Drupal::service('plugin.manager.mail')->getInstance(['module' => 'my_module', 'key' => 'testkey']); // Assert whether the added mail backend is an instance of the expected // class. diff --git a/core/modules/tour/tour.api.php b/core/modules/tour/tour.api.php index e0c06a15cd59..9c582c025a0b 100644 --- a/core/modules/tour/tour.api.php +++ b/core/modules/tour/tour.api.php @@ -52,7 +52,7 @@ function hook_tour_tips_alter(array &$tour_tips, \Drupal\Core\Entity\EntityInter function hook_tour_tips_info_alter(&$info) { // Swap out the class used for this tip plugin. if (isset($info['text'])) { - $info['class'] = 'Drupal\mymodule\Plugin\tour\tip\MyCustomTipPlugin'; + $info['class'] = 'Drupal\my_module\Plugin\tour\tip\MyCustomTipPlugin'; } } diff --git a/core/modules/user/user.api.php b/core/modules/user/user.api.php index b0b639afbfe4..f4a05ae499f5 100644 --- a/core/modules/user/user.api.php +++ b/core/modules/user/user.api.php @@ -99,7 +99,7 @@ function hook_user_cancel_methods_alter(&$methods) { unset($methods['user_cancel_reassign']); // Add a custom zero-out method. - $methods['mymodule_zero_out'] = [ + $methods['my_module_zero_out'] = [ 'title' => t('Delete the account and remove all content.'), 'description' => t('All your content will be replaced by empty strings.'), // access should be used for administrative methods only. diff --git a/core/modules/views/src/Plugin/views/PluginBase.php b/core/modules/views/src/Plugin/views/PluginBase.php index e478e9130104..cba59b7a2c34 100644 --- a/core/modules/views/src/Plugin/views/PluginBase.php +++ b/core/modules/views/src/Plugin/views/PluginBase.php @@ -24,8 +24,8 @@ * - theme: the theme implementation to use in the plugin. This must be the * name of the template file (without template engine extension). The file * has to be placed in the module's templates folder. - * Example: theme = "mymodule_row" of module "mymodule" will implement - * mymodule-row.html.twig in the [..]/modules/mymodule/templates folder. + * Example: theme = "my_module_row" of module "my_module" will implement + * my_module-row.html.twig in the [..]/modules/my_module/templates folder. * - register_theme: (optional) When set to TRUE (default) the theme is * registered automatically. When set to FALSE the plugin reuses an existing * theme implementation, defined by another module or views plugin. diff --git a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificKernelTestBase.php b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificKernelTestBase.php index 9be2cbe0a8d5..e81e44a34a7e 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificKernelTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Database/DriverSpecificKernelTestBase.php @@ -6,15 +6,13 @@ use Drupal\Core\Database\Database; use Drupal\KernelTests\KernelTestBase; -// cSpell:ignore mymodule mydriver - /** * Base class for driver specific kernel tests. * * Driver specific tests should be created in the - * \Drupal\Tests\mymodule\Kernel\mydriver namespace, and their execution will - * only occur when the database driver of the SUT is provided by 'mymodule' and - * named 'mydriver'. + * \Drupal\Tests\my_module\Kernel\my_driver namespace, and their execution will + * only occur when the database driver of the SUT is provided by 'my_module' and + * named 'my_driver'. */ abstract class DriverSpecificKernelTestBase extends KernelTestBase { diff --git a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php index 0fcad71f6357..456cd998b08d 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php @@ -340,7 +340,7 @@ public function testHasImplementations() { ->with('hook') ->willReturnOnConsecutiveCalls( [], - ['mymodule' => FALSE], + ['my_module' => FALSE], ); // ModuleHandler::buildImplementationInfo mock returns no implementations. -- GitLab