Skip to content

Commit

Permalink
Issue 6302: CSpell: Change mymodule to my_module in all of core.
Browse files Browse the repository at this point in the history
  • Loading branch information
klonos committed Feb 15, 2024
1 parent 74bfbda commit 7ef898e
Show file tree
Hide file tree
Showing 24 changed files with 233 additions and 225 deletions.
20 changes: 10 additions & 10 deletions core/includes/form.inc
Expand Up @@ -709,25 +709,25 @@ function form_load_include(&$form_state, $type, $module, $name = NULL) {
* 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, &$form_state, &$object) {
* function my_module_form($form, &$form_state, &$object) {
* }
* @endcode
* would be called via backdrop_form_submit() as follows:
* @code
* $form_state['values'] = $my_form_values;
* $form_state['build_info']['args'] = array(&$object);
* backdrop_form_submit('mymodule_form', $form_state);
* backdrop_form_submit('my_module_form', $form_state);
* @endcode
* For example:
* @code
* // register a new user
* $form_state = array();
* $form_state['values']['name'] = 'new-user';
* $form_state['values']['mail'] = 'new.user@example.com';
* $form_state['values']['pass']['pass1'] = 'password';
* $form_state['values']['pass']['pass2'] = 'password';
* $form_state['values']['op'] = t('Create new account');
* backdrop_form_submit('user_register_form', $form_state);
* // Register a new user.
* $form_state = array();
* $form_state['values']['name'] = 'new-user';
* $form_state['values']['mail'] = 'new.user@example.com';
* $form_state['values']['pass']['pass1'] = 'password';
* $form_state['values']['pass']['pass2'] = 'password';
* $form_state['values']['op'] = t('Create new account');
* backdrop_form_submit('user_register_form', $form_state);
* @endcode
*/
function backdrop_form_submit($form_id, &$form_state) {
Expand Down
10 changes: 5 additions & 5 deletions core/includes/language.inc
Expand Up @@ -44,7 +44,7 @@ define('LANGUAGE_NEGOTIATION_DEFAULT', 'language-default');
* 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[LANGUAGE_TYPE_CONTENT]['fixed']);
* }
* @endcode
Expand Down Expand Up @@ -74,13 +74,13 @@ define('LANGUAGE_NEGOTIATION_DEFAULT', 'language-default');
* 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 core function with our own function.
* $negotiation_info[LANGUAGE_NEGOTIATION_URL]['callbacks']['language'] = 'mymodule_from_url';
* $negotiation_info[LANGUAGE_NEGOTIATION_URL]['file'] = backdrop_get_path('module', 'mymodule') . '/mymodule.module';
* $negotiation_info[LANGUAGE_NEGOTIATION_URL]['callbacks']['language'] = 'my_module_from_url';
* $negotiation_info[LANGUAGE_NEGOTIATION_URL]['file'] = backdrop_get_path('module', 'my_module') . '/my_module.module';
* }
*
* function mymodule_from_url($languages) {
* function my_module_from_url($languages) {
* // Use the core URL language negotiation provider to get a valid language
* // code.
* $langcode = locale_language_from_url($languages);
Expand Down
6 changes: 3 additions & 3 deletions core/includes/lock.inc
Expand Up @@ -26,11 +26,11 @@
* name of the function performing the operation. A very simple example use of
* this API:
* @code
* function mymodule_long_operation() {
* if (lock_acquire('mymodule_long_operation')) {
* function my_module_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
Expand Down
4 changes: 2 additions & 2 deletions core/includes/module.inc
Expand Up @@ -1049,7 +1049,7 @@ function backdrop_required_modules() {
* 'unalterable' => $unalterable,
* 'foo' => 'bar',
* );
* backdrop_alter('mymodule_data', $alterable1, $alterable2, $context);
* backdrop_alter('my_module_data', $alterable1, $alterable2, $context);
* @endcode
*
* Note that objects are always passed by reference in PHP5. If it is absolutely
Expand All @@ -1059,7 +1059,7 @@ function backdrop_required_modules() {
* $context = array(
* 'unalterable_object' => clone $object,
* );
* backdrop_alter('mymodule_data', $data, $context);
* backdrop_alter('my_module_data', $data, $context);
* @endcode
*
* @param $type
Expand Down
12 changes: 6 additions & 6 deletions core/includes/pager.inc
Expand Up @@ -55,14 +55,14 @@ function pager_find_page($element = 0) {
* @code
* // First find the total number of items and initialize the pager.
* $where = "status = 1";
* $total = mymodule_select("SELECT COUNT(*) FROM data " . $where)->result();
* $num_per_page = config_get('mymodule.settings', 'num_per_page');
* $total = my_module_select("SELECT COUNT(*) FROM data " . $where)->result();
* $num_per_page = config_get('my_module.settings', 'num_per_page');
* $page = pager_default_initialize($total, $num_per_page);
*
* // Next, retrieve and display the items for the current page.
* $offset = $num_per_page * $page;
* $result = mymodule_select("SELECT * FROM data " . $where . " LIMIT %d, %d", $offset, $num_per_page)->fetchAll();
* $output = theme('mymodule_results', array('result' => $result));
* $result = my_module_select("SELECT * FROM data " . $where . " LIMIT %d, %d", $offset, $num_per_page)->fetchAll();
* $output = theme('my_module_results', array('result' => $result));
*
* // Finally, display the pager controls, and return.
* $output .= theme('pager');
Expand All @@ -80,9 +80,9 @@ function pager_find_page($element = 0) {
* // parameter corresponds to an actual page of results that will exist
* // within the set.
* $page = pager_find_page();
* $num_per_page = config_get('mymodule.settings', 'num_per_page');
* $num_per_page = config_get('my_module.settings', '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_default_initialize($result->total, $num_per_page);
Expand Down
Binary file added core/modules/.DS_Store
Binary file not shown.
4 changes: 2 additions & 2 deletions core/modules/admin_bar/admin_bar.api.php
Expand Up @@ -75,8 +75,8 @@ function hook_admin_bar_output_build(&$content) {
$content['menu']['menu']['myitem'] = array(
'#title' => t('My item'),
// #attributes are used for list items (LI).
'#attributes' => array('class' => array('mymodule-myitem')),
'#href' => 'mymodule/path',
'#attributes' => array('class' => array('my_module-myitem')),
'#href' => 'my_module/path',
// #options are passed to l().
'#options' => array(
'query' => backdrop_get_destination(),
Expand Down
10 changes: 5 additions & 5 deletions core/modules/ckeditor/ckeditor.api.php
Expand Up @@ -80,10 +80,10 @@
*/
function hook_ckeditor_plugins() {
$plugins['myplugin'] = array(
'path' => backdrop_get_path('module', 'mymodule') . '/js/myplugin',
'path' => backdrop_get_path('module', 'my_module') . '/js/myplugin',
'file' => 'plugin.js',
'css' => array(backdrop_get_path('module', 'mymodule') . '/css/myplugin.css'),
'enabled callback' => 'mymodule_myplugin_plugin_check',
'css' => array(backdrop_get_path('module', 'my_module') . '/css/myplugin.css'),
'enabled callback' => 'my_module_myplugin_plugin_check',
'buttons' => array(
'MyPlugin' => array(
'label' => t('My custom button'),
Expand Down Expand Up @@ -113,7 +113,7 @@ function hook_ckeditor_plugins() {
* @see hook_ckeditor_plugins()
*/
function hook_ckeditor_plugins_alter(array &$plugins) {
$plugins['someplugin']['enabled callback'] = 'mymodule_someplugin_enabled_callback';
$plugins['someplugin']['enabled callback'] = 'my_module_someplugin_enabled_callback';
}

/**
Expand Down Expand Up @@ -143,7 +143,7 @@ function hook_ckeditor_plugins_alter(array &$plugins) {
* @see _ckeditor_theme_css()
*/
function hook_ckeditor_css_alter(array &$css, $format) {
$css[] = backdrop_get_path('module', 'mymodule') . '/css/mymodule-ckeditor.css';
$css[] = backdrop_get_path('module', 'my_module') . '/css/my_module-ckeditor.css';
}

/**
Expand Down
10 changes: 5 additions & 5 deletions core/modules/ckeditor5/ckeditor5.api.php
Expand Up @@ -72,9 +72,9 @@
*/
function hook_ckeditor5_plugins() {
$plugins['myPlugin.MyPlugin'] = array(
'library' => array('mymodule', 'mymodule.ckeditor5.myplugin'),
'css' => array(backdrop_get_path('module', 'mymodule') . '/css/myplugin.css'),
'enabled_callback' => 'mymodule_myplugin_plugin_check',
'library' => array('my_module', 'my_module.ckeditor5.myplugin'),
'css' => array(backdrop_get_path('module', 'my_module') . '/css/myplugin.css'),
'enabled_callback' => 'my_module_myplugin_plugin_check',
'buttons' => array(
'myButton' => array(
'library' => array('my_module', 'my-module-ckeditor5-plugin'),
Expand All @@ -101,7 +101,7 @@ function hook_ckeditor5_plugins() {
* @see hook_ckeditor5_plugins()
*/
function hook_ckeditor5_plugins_alter(array &$plugins) {
$plugins['someplugin']['enabled callback'] = 'mymodule_someplugin_enabled_callback';
$plugins['someplugin']['enabled callback'] = 'my_module_someplugin_enabled_callback';
}

/**
Expand Down Expand Up @@ -139,7 +139,7 @@ function hook_ckeditor5_plugins_alter(array &$plugins) {
* @see _ckeditor5_theme_css()
*/
function hook_ckeditor5_css_alter(array &$css) {
$css[] = backdrop_get_path('module', 'mymodule') . '/css/mymodule-ckeditor5.css';
$css[] = backdrop_get_path('module', 'my_module') . '/css/my_module-ckeditor5.css';
}

/**
Expand Down
24 changes: 14 additions & 10 deletions core/modules/config/config.api.php
Expand Up @@ -62,7 +62,7 @@ function hook_config_info() {
* @throws ConfigValidateException
*/
function hook_config_data_validate(Config $config, array $config_info) {
if ($config->getName() === 'mymodule.settings') {
if ($config->getName() === 'my_module.settings') {
if (!module_exists($config->get('module'))) {
throw new ConfigValidateException(t('The configuration "@file" could not be imported because the module "@module" is not enabled.', array('@file' => $config->getName(), '@module' => $config->get('module'))));
}
Expand All @@ -87,7 +87,7 @@ function hook_config_data_validate(Config $config, array $config_info) {
* @throws ConfigValidateException
*/
function hook_config_create_validate(Config $staging_config, $all_changes) {
if ($staging_config->getName() === 'mymodule.settings') {
if ($staging_config->getName() === 'my_module.settings') {
// Ensure that the name key is no longer than 64 characters.
if (strlen($staging_config->get('name')) > 64) {
throw new ConfigValidateException(t('The configuration "@file" must have a "name" attribute less than 64 characters.', array('@file' => $staging_config->getName())));
Expand Down Expand Up @@ -115,7 +115,7 @@ function hook_config_create_validate(Config $staging_config, $all_changes) {
* @throws ConfigValidateException
*/
function hook_config_update_validate(Config $staging_config, Config $active_config, $all_changes) {
if ($staging_config->getName() === 'mymodule.settings') {
if ($staging_config->getName() === 'my_module.settings') {
// Ensure that the name key is no longer than 64 characters.
if (strlen($staging_config->get('name')) > 64) {
throw new ConfigValidateException(t('The configuration "@file" must have a "name" attribute less than 64 characters.', array('@file' => $staging_config->getName())));
Expand Down Expand Up @@ -143,11 +143,15 @@ function hook_config_update_validate(Config $staging_config, Config $active_conf
function hook_config_delete_validate(Config $active_config, $all_changes) {
if (strpos($active_config->getName(), 'image.style') === 0) {
// Check if another configuration depends on this configuration.
if (!isset($all_changes['mymodule.settings']) || $all_changes['mymodule.settings'] !== 'delete') {
$my_config = config('mymodule.settings');
if (!isset($all_changes['my_module.settings']) || $all_changes['my_module.settings'] !== 'delete') {
$my_config = config('my_module.settings');
$image_style_name = $active_config->get('name');
if ($my_config->get('image_style') === $image_style_name) {
throw new ConfigValidateException(t('The configuration "@file" cannot be deleted because the image style "@style" is in use by "@mymodule".', array('@file' => $active_config->getName(), '@style' => $image_style_name, '@mymodule' => $my_config->getName())));
throw new ConfigValidateException(t('The configuration "@file" cannot be deleted because the image style "@style" is in use by "@my_module".', array(
'@file' => $active_config->getName(),
'@style' => $image_style_name,
'@my_module' => $my_config->getName(),
)));
}
}
}
Expand All @@ -172,9 +176,9 @@ function hook_config_create(Config $staging_config) {
* Respond to configuration updates.
*
* @param Config $staging_config
* The configuration object for the settings about to be saved. This object
* is always passed by reference and may be modified to adjust the settings
* that are saved.
* The configuration object for the settings about to be saved. This object is
* always passed by reference and may be modified to adjust the settings that
* are saved.
* @param Config $active_config
* The configuration object for the settings being replaced.
*/
Expand All @@ -199,7 +203,7 @@ function hook_config_update(Config $staging_config, Config $active_config) {
function hook_config_delete(Config $active_config) {
if (strpos($active_config->getName(), 'image.style') === 0) {
$image_style_name = $active_config->get('name');
config('mymodule.image_style_addons.' . $image_style_name)->delete();
config('my_module.image_style_addons.' . $image_style_name)->delete();
}
}

Expand Down
6 changes: 3 additions & 3 deletions core/modules/entity/entity.api.php
Expand Up @@ -219,7 +219,7 @@ function hook_entity_info_alter(&$entity_info) {
*/
function hook_entity_load($entities, $type) {
foreach ($entities as $entity) {
$entity->foo = mymodule_add_something($entity, $type);
$entity->foo = my_module_add_something($entity, $type);
}
}

Expand Down Expand Up @@ -379,7 +379,7 @@ function hook_entity_view($entity, $type, $view_mode, $langcode) {
$entity->content['my_additional_field'] = array(
'#markup' => $additional_field,
'#weight' => 10,
'#theme' => 'mymodule_my_additional_field',
'#theme' => 'my_module_my_additional_field',
);
}

Expand Down Expand Up @@ -431,7 +431,7 @@ function hook_entity_view_alter(&$build, $type) {
function hook_entity_prepare_view($entities, $type) {
// Load a specific node into the user object to theme later.
if ($type == 'user') {
$nodes = mymodule_get_user_nodes(array_keys($entities));
$nodes = my_module_get_user_nodes(array_keys($entities));
foreach ($entities as $uid => $entity) {
$entity->user_node = $nodes[$uid];
}
Expand Down
22 changes: 11 additions & 11 deletions core/modules/field/field.api.php
Expand Up @@ -187,13 +187,13 @@ function hook_field_info_alter(&$info) {
// Add a setting to all field types.
foreach ($info as $field_type => $field_type_info) {
$info[$field_type]['settings'] += array(
'mymodule_additional_setting' => 'default value',
'my_module_additional_setting' => 'default value',
);
}

// 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';
}
}

Expand Down Expand Up @@ -817,7 +817,7 @@ function hook_field_widget_info() {
function hook_field_widget_info_alter(&$info) {
// Add a setting to a widget type.
$info['text_textfield']['settings'] += array(
'mymodule_additional_setting' => 'default value',
'my_module_additional_setting' => 'default value',
);

// Let a new field type re-use an existing widget.
Expand Down Expand Up @@ -966,9 +966,9 @@ function hook_field_widget_form_alter(&$element, &$form_state, $context) {
*/
function hook_field_widget_WIDGET_TYPE_form_alter(&$element, &$form_state, $context) {
// Code here will only act on widgets of type WIDGET_TYPE. For example,
// hook_field_widget_mymodule_autocomplete_form_alter() will only act on
// widgets of type 'mymodule_autocomplete'.
$element['#autocomplete_path'] = 'mymodule/autocomplete_path';
// hook_field_widget_my_module_autocomplete_form_alter() will only act on
// widgets of type 'my_module_autocomplete'.
$element['#autocomplete_path'] = 'my_module/autocomplete_path';
}

/**
Expand Down Expand Up @@ -1115,7 +1115,7 @@ function hook_field_formatter_info() {
function hook_field_formatter_info_alter(&$info) {
// Add a setting to a formatter type.
$info['text_default']['settings'] += array(
'mymodule_additional_setting' => 'default value',
'my_module_additional_setting' => 'default value',
);

// Let a new field type re-use an existing formatter.
Expand Down Expand Up @@ -1241,7 +1241,7 @@ function hook_field_formatter_view($entity_type, $entity, $field, $instance, $la
// customization.
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#theme' => 'mymodule_theme_sample_field_formatter_themeable',
'#theme' => 'my_module_theme_sample_field_formatter_themeable',
'#data' => $item['value'],
'#some_setting' => $settings['some_setting'],
);
Expand Down Expand Up @@ -1530,9 +1530,9 @@ function hook_field_attach_delete_revision($entity_type, $entity) {
* @see field_purge_data()
*/
function hook_field_attach_purge($entity_type, $entity, $field, $instance) {
// find the corresponding data in mymodule and purge it
// Find the corresponding data in my_module and purge it.
if ($entity_type == 'node' && $field->field_name == 'my_field_name') {
mymodule_remove_mydata($entity->nid);
my_module_remove_mydata($entity->nid);
}
}

Expand Down Expand Up @@ -1732,7 +1732,7 @@ function hook_field_storage_info() {
function hook_field_storage_info_alter(&$info) {
// Add a setting to a storage type.
$info['field_sql_storage']['settings'] += array(
'mymodule_additional_setting' => 'default value',
'my_module_additional_setting' => 'default value',
);
}

Expand Down

0 comments on commit 7ef898e

Please sign in to comment.