Quantcast
Channel: Issues for Drupal core
Viewing all 296726 articles
Browse latest View live

[warning] Undefined array key "langcode" DrupalKernel.php

$
0
0

Problem/Motivation

Post update system_post_update_add_langcode_to_all_translatable_config(&$sandbox = NULL) is clearing langcode from config system.site

     // If this config contains any elements (at any level of nesting) which
    // are translatable, but the config hasn't got a langcode, assign one. But
    // if nothing in the config structure is translatable, the config shouldn't
    // have a langcode at all.
    if ($typed_config->hasTranslatableElements()) {
      if ($config->get('langcode')) {
        continue;
      }
      $config->set('langcode', $default_langcode);
    }
    else {
      if (!array_key_exists('langcode', $config->get())) {
        continue;
      }
      $config->clear('langcode');
    }
    $config->save();

But below code is trying to fetch langcode from system.site config which conflicting with above post update.

     // Store the default language values on the container. This is so that the
    // default language can be configured using the configuration factory. This
    // avoids the circular dependencies that would created by
    // \Drupal\language\LanguageServiceProvider::alter() and allows the default
    // language to not be English in the installer.
    $default_language_values = Language::$defaultValues;
    if ($system = $this->getConfigStorage()->read('system.site')) {
      if ($default_language_values['id'] != $system['langcode']) {
        $default_language_values = ['id' => $system['langcode']];
      }
    }

[warning] Undefined array key "langcode" DrupalKernel.php:1395
[warning] Undefined array key "langcode" DrupalKernel.php:1396

Steps to reproduce

  • Upgrade Drupal core from 10.2.3 to 10.3.10
  • Execute database updates
  • Run any drush command ex: drush cr and observe warning Undefined array key "langcode" DrupalKernel.php

Proposed resolution

Check if langcode is present in system.site config in DrupalKernel.php

(or)

Clean up the code which is fetching langcode if not required.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet


Allow restriction of available User Cancellation Methods on deletion confirmation form

$
0
0

Problem/Motivation

Because of the issues #2977362: Revision user incorrectly appears as anonymous user when node author is canceled and #3089747: Content moderation can wrongly set old revisions as default when they're resaved and our necessity of restrict the cancel options to disable the user instead of delete, it is a good moment to add the ability to choose which options show when cancel an account.
There is the contrib module https://www.drupal.org/project/prevent_user_delete_reassign but is only for the option of deleting and reassigning to anonymous.

Steps to reproduce

Delete a user from /user/[UID]/cancel

Proposed resolution

Add the ability to restrict the options cancel user account from the account settings /admin/config/people/accounts

Account settings:
Account settings

Account cancel page:
Account user cancel page

File entity update is allowed only for user who has uploaded the file

$
0
0

Problem/Motivation

FileAccessControlHandler does not check permission in case of update using the standard permissions of "edit any files" and "edit own files". Instead it's hardcoded to check for the user who has uploaded the file.

Steps to reproduce

Proposed resolution

The FileAccessControlHandler should check for file edit permissions in the standard way.

Remaining tasks

1. Create new permissions "edit any files" and "edit own files"
2. Adjust the FileAccessControlHandler to respect the assigned permission.
3. Adjust relevant test cases.

User interface changes

API changes

Data model changes

Release notes snippet

Mark hook_install_tasks and hook_install_tasks_alter as procedural only

$
0
0

Problem/Motivation

875: $function = $install_state['parameters']['profile'] . '_install_tasks';
900: $function = $install_state['parameters']['profile'] . '_install_tasks_alter';

These are magic names, they need to be added to the docs in *api.php
And added here: /var/www/development/moduleDevelopment/drupal/core/lib/Drupal/Core/Hook/HookCollectorPass.php checkForProceduralOnlyHooks

I have updated https://www.drupal.org/node/3442349

Steps to reproduce

N/A

Proposed resolution

Update docs and check for procedural only

Remaining tasks

MR
Create CR
Update OOP CR

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Clean up how ModuleInstaller invokes hooks around installing other modules.

$
0
0

Problem/Motivation

ModuleInstaller currently loops over every module and calls invoke for each hook, so this tries invoking hooks on modules that have not implemented them.
This in turn calls legacyInvoke which is not performant.

It is better to call invokeAll and let ModuleHandler do the work. This is more performant and more future proof.

Steps to reproduce

N/A

Proposed resolution

Change from a foreach loop to modulehander invokeall

Remaining tasks

N/A

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

Max length for Image widget field alt text

$
0
0

Max length for Image widget field alt text set to 255.

The Content overview page filters out unpublished nodes when a node access module is enabled

$
0
0

Problem/Motivation

The Content overview Views view filters out unpublished nodes that the given user otherwise would have access based on node access.

This issue were already reported in Drupal 7 (#1264482: Cause and work around of user not seeing own unpublished content in views) and the content moderation issue (#2971902: Unpublished content is not visible in views to users with the 'view own unpublished content' permission when used in combination with node grants) is also (partially ?) about this problem.

The root cause of the problem is \Drupal\node\Plugin\views\filter\Status that adds additional filter criteria to the query - this is the reason why ppl are suggesting disabling SQL rewriting in the content moderation thread - that filters out the result based on user permission. (See \node_views_query_substitutions())

The original code logic originates from Drupal, but I could not figure out from git history why this borned... https://git.drupalcode.org/project/views/-/commits/7.x-3.x/modules/node/...

PS.: \Drupal\node\Plugin\views\filter\Status is not the only one in Drupal core that implements the same trick, there is \Drupal\media\Plugin\views\filter\Status also.

Steps to reproduce

(See failing test in MR8156)

  1. Create a "content viewer" user with only the following permission: access content overview. Node admin permissions MUST NOT BE granted, see \node_views_query_substitutions().
  2. .

  3. Create unpublished contents with another user.
  4. .

  5. Enabled a node access solution that would grant access to unpublished nodes to "content viewer" user.
  6. .

  7. Check the node view page of an unpublished node with the "content viewer" user. Expected: HTTP 200
  8. .

  9. Check the admin/content page with the "content viewer" user. Expected: unpublished nodes by other users are visible. Actual: they are missing.

Proposed resolution

Disable query altering when there is any node access module active on a site.

Remaining tasks

Title update
Review of new text

User interface changes

Before

After


API changes

None.

Data model changes

None.

Release notes snippet

Unpublished nodes are no longer hidden on Content overview page when a node access module is enabled

The Content overview page now respects the access granted in a node access module. If your site is using such a module then site administrators may see different results on the Content over page. Sites should check the behavior of the views that display nodes.

FileFieldItemList's postsave didn't check if entity->original is empty

$
0
0

Problem/Motivation

When save an commerce order inside state machine events subscriber cause the error:

The website encountered an unexpected error. Please try again later.
Error: Call to a member function hasTranslation() on null in Drupal\file\Plugin\Field\FieldType\FileFieldItemList->postSave() (line 54 of core/modules/file/src/Plugin/Field/FieldType/FileFieldItemList.php).
Drupal\file\Plugin\Field\FieldType\FileFieldItemList->postSave(1)
call_user_func_array(Array, Array) (Line: 938)
Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod('postSave', Object, 1) (Line: 970)
Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldPostSave(Object, 1) (Line: 896)
Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 56)
Drupal\commerce\CommerceContentEntityStorage->invokeHook('update', Object) (Line: 64)
Drupal\commerce_order\OrderStorage->invokeHook('update', Object) (Line: 598)
Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 781)
Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 523)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 804)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 339)
Drupal\Core\Entity\EntityBase->save() (Line: 429)
Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase->submitForm(Array, Object) (Line: 614)
Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
Drupal\Core\Form\FormBuilder->processForm('commerce_checkout_flow_multistep_default', Array, Object) (Line: 325)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 224)
Drupal\Core\Form\FormBuilder->getForm(Object, 'review') (Line: 143)
Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 38)
Drupal\webprofiler\StackMiddleware\WebprofilerMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

The postsave() will be execute 2 times after the order save inside the eventsubscriber.
first postsave will unset the entity's original, so on the second postsave of the FileFieldItemList.php the original is empty
But FileFieldItemList didn't check it.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Wrong link to test results in settings form

$
0
0

Text in settings form says ''The results can then be viewed at admin/config/development/testing/[test_id]", but link is wrong. Right link "admin/config/development/testing/results/[test_id]"

Password hashing tests do not cover all options

$
0
0

The security fix for 7.34 included a test to ensure that hashed passwords would be created from a source with characters under 512 bytes.

While we cover most eventualities, there's an omission in one part of the existing test which means we don't cover everything.

drupal_var_export() passes a third argument to itself, when it uses just two parameters

$
0
0

var_export($var, $prefix = '') contains the following code.

foreach ($var as $key => $value) {
  $output .= '' . ($export_keys ? drupal_var_export($key) . ' => ' : '') . drupal_var_export($value, '', FALSE) . ",\n";
}

The last argument in drupal_var_export($value, '', FALSE) is not used from the function and it can be removed.

Correct a comment in drupal_settings_initialize()

$
0
0

drupal_settings_initialize() contains the following comment.

// HTTP_HOST can be modified by a visitor, but we already sanitized it
// in drupal_settings_initialize().

$_SERVER['HTTP_HOST'] is sanitized in drupal_environment_initialize(), not drupal_settings_initialize(). The correct comment would be:

// HTTP_HOST can be modified by a visitor, but we already sanitized it
// in drupal_environment_initialize().

drupal_var_export() initializes a variable that is never used

$
0
0

drupal_var_export() contains the following code.

$line_safe_var = str_replace("\n", '\n', $var);
if (strpos($var, "\n") !== FALSE || strpos($var, "'") !== FALSE) {
  // If the string contains a line break or a single quote, use the
  // double quote export mode. Encode backslash and double quotes and
  // transform some common control characters.
  $var = str_replace(array('\\', '"', "\n", "\r", "\t"), array('\\\\', '\"', '\n', '\r', '\t'), $var);
  $output = '"' . $var . '"';
}
else {
  $output = "'" . $var . "'";
}

$line_safe_var is initialized, but it is never used.

Given that "\n" is replaced with '\n' from the following code, the line initializing $line_safe_var can be removed.

  // If the string contains a line break or a single quote, use the
  // double quote export mode. Encode backslash and double quotes and
  // transform some common control characters.
  $var = str_replace(array('\\', '"', "\n", "\r", "\t"), array('\\\\', '\"', '\n', '\r', '\t'), $var);

Updatedb fails on taxonomy_update_10100

$
0
0

Problem/Motivation

I have been running drupal 10.3.10 on PopOs (an Ubuntu derivative) with a localhost Apache server for some time now.
Recently when performing a database-update (after updating modules), it fails with this message:
> [notice] Update started: taxonomy_update_10100
> [error] Call to a member function get() on null
> [error] Update failed: taxonomy_update_10100

Steps to reproduce

composer update
followed by either
drush updatedb
or
run the database update through the website admin pages

PHP is not my strong-point, but when trying to run drush through a debugger I think the update fails at web/core/modules/taxonomy/taxonomy.install line 26 because line 25 does not return a value into $definition when looking for getEntityType('taxonomy_term')

The source for the failing function is given here:
https://api.drupal.org/api/drupal/core%21modules%21taxonomy%21taxonomy.i...

I am aware of this issue:
https://www.drupal.org/forum/support/upgrading-drupal/2024-08-26/databas...
But I'm not upgrading from v9, and I've not (knowingly) done anything with composer Groups so can't tell how it might apply here.
Have I missed installing another module / core option? How would I go about doing it while I have 15 other database updates pending? Any help would be appreciated.

Output from "drush status":

Drupal version   : 10.3.10                                                   
Site URI         : http://default                                            
DB driver        : pgsql                                                     
DB hostname      : localhost                                                 
DB port          : 5432                                                      
DB username      : xxxx                                                    
DB name          : drupal_sim                                        
Database         : Connected                                                 
Drupal bootstrap : Successful                                                
Default theme    : custom_barrio_sim                                         
Admin theme      : claro                                                     
PHP binary       : /usr/bin/php8.1                                           
PHP config       : /etc/php/8.1/cli/php.ini                                  
PHP OS           : Linux                                                     
PHP version      : 8.1.2-1ubuntu2.19                                         
Drush script     : /drupal_base_dir/vendor/drush/drush/drush     
Drush version    : 12.5.3.0                                                  
Drush temp       : /tmp                                                      
Drush configs    : /drupal_base_dir/vendor/drush/drush/drush.yml 
Install profile  : minimal                                                   
Drupal root      : /drupal_base_dir/web                          
Site path        : sites/default                                             
Files, Public    : sites/default/files                                       
Files, Private   : /external_drupal_dir/private_files/                      
Files, Temp      : /tmp

On preexisting site, enabling workspaces leads to

$
0
0

Problem/Motivation

On a preexisting site, I enabled Workspaces and wanted to see if I could easily edit content while in a Workspace. I immediately ran into white-screen-of-death errors upon saving. The error I received was:

"This content can only be saved in the default workspace"

I did some debugging and was able to see that it was specifically the menu_link_content entity type that was having trouble. I also noticed the WorkspaceInformation compiled a list of entity types that it determined had proper workspace support. That code evaluated menu_link_content along with 9 other entity types computed the support level for each.

There are way more than 9 entity types in Drupal.

I then discovered that after flushing the plugin cache with drush cc > choose plugin I could edit content and debugging showed that 74 entity types were in the supported list. menu_link_content's support level flipped from false to true

I'm not exactly sure what all of this means, except that perhaps it would be good to include a plugin cache flush when workspaces is enabled.

Steps to reproduce

1. With Drupal 10.3.9, enable workspaces on a preexisting site.
2. Switch to Stage workspace.
3. Modify and save existing content. Ideally the content should define it's own menu link or have paragraphs.
4. Observe a white screen of death error that reads "This content can only be saved in the default workspace."

Proposed resolution

Flush plugin cache

Then repeat the steps:
1. Edit the same content, the same way.
2. Success

Remaining tasks

Validate that this error occurs for more people other than just me.
Determine if flushing the plugin cache is a viable solution.

Release notes snippet

Improve workspaces for preexisting sites.


Deprecate functions using ModuleHandler::add

$
0
0

Problem/Motivation

After the introduction of ModuleInstaller::invoke() the ModuleHandler::add* method family likely belongs to ModuleInstaller. In the current state it's a total lie: it picks up procedural implementations only because OOP implementations would need a container rebuild. Likely it's loaded only so hook_install can call helper functions in .module. This somehow should be deprecated in favor of static methods in classes.

ModuleHandler::add is protected, it is called by ModuleHandler::addProfile and ModuelHandler::addModule

These two in turn are only called here:
install.core.inc

// Override the module list with a minimal set of modules.
  $module_handler = \Drupal::moduleHandler();
  if (!$module_handler->moduleExists('system')) {
    $module_handler->addModule('system', 'core/modules/system');
  }
  if ($profile && !$module_handler->moduleExists($profile)) {
    $module_handler->addProfile($profile, $install_state['profiles'][$profile]->getPath());
  }

Also in authorize.php

// We have to enable the user and system modules, even to check access and
// display errors via the maintenance theme.
\Drupal::moduleHandler()->addModule('system', 'core/modules/system');
\Drupal::moduleHandler()->addModule('user', 'core/modules/user');
\Drupal::moduleHandler()->load('system');
\Drupal::moduleHandler()->load('user');

// Initialize the maintenance theme for this administrative script.
drupal_maintenance_theme();

It is called in several tests:

  • core/tests/Drupal/KernelTests/KernelTestBase.php
  • core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php
  • core/tests/Drupal/Tests/UpdatePathTestTrait.php

Steps to reproduce

Proposed resolution

  1. Copy ::add* over to ModuleInstaller, deprecate them in ModuleHandler
  2. Investigate how it would be possible to deprecate all calls to procedural functions and as such deprecate add*.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Second level menu items can't be reached if they have children

$
0
0

Problem/Motivation

It is not possible to navigate to level 1 menu items (secondary items) if they have children (level 1 is referring to the code level which is 0 indexed, 0 being the top level). The user must navigate to the level 2 menu item first (tertiary item) then back up a level via the breadcrumb.

Examples

Contrib: Simple Blocks
The Simple Blocks menu item is a child of Structure > Block Layout. Thus the Block Layout page can't be reached anymore!

Contrib: Paragraphs
Paragraphs module adds the menu items Structure > Paragraphs > Add paragraph type, where the menu item Paragraphs leads to the paragraphs overview page which now can't be reached anymore.

screenshot of second level menu item block layout with child item simple blocks

Steps to reproduce

  1. Install drupal 11.x (via simplytestme)
  2. Login as admin
  3. Enable navigation
  4. Try to click on Structure > Display modes, which does not bring you to its menu item link /admin/structure/display-modes

Proposed resolution

When a secondary menu link has children, the child list of menu links should be preceded by an "Overview" link. The "Overview" link should link the user to the secondary menu link. The rest of the secondary menu links' children are listed below the "Overview" link.

Second level overview link

Figma: https://www.figma.com/design/VCPAxetieAC2pzw7hgX3ij/Drupal-Admin-UI---De...

Note that the word "Overview" is still under consideration. Looking to resolve that before we finish up here. Other candidates currently include "See All".

Also, keep in mind that it's likely we'll add support for a fourth level of links. That is the subject of #3425084: Support Deeper Navigation Levels. It's equally likely that the "Overview" link implemented here for the second level, will carry forward to the tertiary level if applicable as well.

Remaining tasks

  • Decide on UX alternatives to "Overview", or settle on it
  • Implement the approach shown in the above screenshot as well as the Figma.

User interface changes

When secondary menu items have children, precede the child menu list by an "Overview" link that take the user to the second level menu link.

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

Users can now directly navigate to secondary menu items directly from the navigation.

Query order when using orCondition in QueryInterface

$
0
0

Problem/Motivation

I was attempting to query some content types using the query interface (in graphql), I wanted them returning in a particular order of langcode (eg fr then en), the by created date. So the final result should return the french nodes, then the english nodes in created date order.
Digging into this, i found that the sql being produced is somewhat wrong, it seems like there is a disconnect somewhere between the select and where when a sort is being applied.
in my example,

    $storage = $this->entityTypeManager->getStorage('node');
    $entityType = $storage->getEntityType();
    $query = $storage->getQuery()
      ->currentRevision()
      ->accessCheck()
      ->condition('status', Node::PUBLISHED);

    $query->condition($entityType->getKey('bundle'), 'resource');

    if (!empty($langcode)) {
      if ($langcode !== "EN") {
        $langConditions = $query->orConditionGroup()
          ->condition('langcode', strtolower('fr')) //hard coded for debug's sake
          ->condition('langcode', strtolower("en"));
        $query->condition($langConditions);
      } else {
        $query->condition('langcode', strtolower($langcode));
      }
    }

    $query->sort('langcode', 'DESC');
    $query->sort('created', 'DESC');
    $query->range($offset, $limit);
    $metadata->addCacheTags($entityType->getListCacheTags());
    $metadata->addCacheContexts($entityType->getListCacheContexts());

    return new QueryResourceConnection($query);

Gets a generated sql output of

SELECT
    `base_table`.`vid` AS `vid`,
    `base_table`.`nid` AS `nid`,
    MAX(node_field_data_3.langcode) AS `expression`,
    MAX(node_field_data_3.created) AS `expression_2`
FROM
    `node` `base_table`
INNER JOIN `node_field_data` `node_field_data` ON
    `node_field_data`.`nid` = `base_table`.`nid`
LEFT JOIN `node_field_data` `node_field_data_2` ON
    `node_field_data_2`.`nid` = `base_table`.`nid`
INNER JOIN `node__field_resource_type` `node__field_resource_type` ON
    `node__field_resource_type`.`entity_id` = `base_table`.`nid`
LEFT OUTER JOIN `taxonomy_term_data` `taxonomy_term_data` ON
    `taxonomy_term_data`.`tid` = `node__field_resource_type`.`field_resource_type_target_id`
INNER JOIN `taxonomy_term_field_data` `taxonomy_term_field_data` ON
    `taxonomy_term_field_data`.`tid` = `taxonomy_term_data`.`tid`
LEFT JOIN `node_field_data` `node_field_data_3` ON
    `node_field_data_3`.`nid` = `base_table`.`nid`
WHERE
    (`node_field_data`.`status` = '1') AND
    (`node_field_data`.`type` = 'resource') AND
    (
        (`node_field_data_2`.`langcode` = 'fr') OR
        (`node_field_data_2`.`langcode` = 'en')
    ) AND
    (`taxonomy_term_field_data`.`name` LIKE 'My Resource' ESCAPE '\\')
GROUP BY
    `base_table`.`vid`,
    `base_table`.`nid`
ORDER BY
	`expression` DESC,
	`expression_2` DESC

the issue here being that node_field_data_2 and node_field_data_3 are joins, but the MAX() is being done on node_field_data_3 and not 2, which produces the incorrect results. like this.. https://pastebin.com/QjavJWxE

Steps to reproduce

I think the easiest would be to create multiple nodes in a few different languages, and then run the query's to see if you can get them sorting in the correct order. I probably need to make a more concrete small example however.

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Create hook_update_requirements

$
0
0

Problem/Motivation

Hook requirements uses phase right now to manage whether it is runtime, install, or update.
Let's move the update portion.

Create a new hook_update_requirements.

It is currently invoked in update.inc

function update_check_requirements() {
  // Because this is one of the earliest points in the update process,
  // detect and fix missing schema versions for modules here to ensure
  // it runs on all update code paths.
  _update_fix_missing_schema();

  // Check requirements of all loaded modules.
  $requirements = \Drupal::moduleHandler()->invokeAll('requirements', ['update']);
  \Drupal::moduleHandler()->alter('requirements', $requirements);
  $requirements += update_system_schema_requirements();
  return $requirements;
}

Steps to reproduce

N/A

Proposed resolution

Create hook_update_requirements
Create hook_update_requirements_alter

Invoke hook_update_requirements after hook_requirements
Merge results
Run hook_requirements_alter
Run hook_update_requirements_alter

Remaining tasks

N/A

User interface changes

N/A

Introduced terminology

hook_update_requirements
hook_update_requirements_alter

API changes

hook_update_requirements
hook_update_requirements_alter
Can be implemented to set or alter requirements during update.

Data model changes

N/A

Release notes snippet

Add array return to remaining applicable hook implementations in Hook classes

$
0
0

Problem/Motivation

See #3483037: [META] Add return types to hook implementations

Steps to reproduce

It's a bit tedious, but you can make a mega git branch of all uncommitted MRs in the parent meta, then grep the baseline for "has no return type" with a pattern match on the Hook namespace. Currently that gives you about 100 results, and 50 of these should return array.

Proposed resolution

Add : array to 50 hook implementations, and their relevant api docs.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Viewing all 296726 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>