Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
How to reproduce
- Go on admin/config/search/xmlsitemap/rebuild
- Select only Node entity type from multiselect
- Click Save configuration
If you're using Commerce it will return a fatal error like:
Error: Call to a member function access() on null in Drupal\commerce_payment\PaymentAccessControlHandler->checkAccess() (line 23 of /var/www/teatro.it/modules/contrib/commerce/modules/payment/src/PaymentAccessControlHandler.php) #0
However, the problem is due to the fact that the choice made in the multiselect is not respected
I think the problem can be easily resolved like:
public function submitForm(array &$form, FormStateInterface $form_state) {
$userInput = $form_state->getUserInput();
// Save any changes to the frontpage link.
$entity_type_ids = $userInput['entity_type_ids'];
$save_custom = $form_state->getValue('save_custom');
$batch = xmlsitemap_rebuild_batch($entity_type_ids, $save_custom);
batch_set($batch);
$form_state->setRedirect('xmlsitemap.admin_search');
parent::submitForm($form, $form_state);
}
Comment | File | Size | Author |
---|---|---|---|
#2 | 2876082-xml-sitemap-rebuild-form-submit.patch | 882 bytes | G42 |
Comments
Comment #2
G42 CreditAttribution: G42 commentedI can confirm this behavior on 1.0-alpha2. I tested your changes and created a patch.
Comment #3
nplowman CreditAttribution: nplowman at FFW commentedPatch #2 worked for me. Thanks!
Comment #4
csedax90 CreditAttribution: csedax90 commentedComment #5
farse CreditAttribution: farse at Zoocha commentedHad the same issue with commerce installed and this patch works for me on the latest dev version, thanks!
Comment #6
GoZ CreditAttribution: GoZ at Iosan, Barbe-Rousse for Niji commentedThis is not an issue, you have to check "Enable developer mode to expose additional settings." in settings tab admin/config/search/xmlsitemap/settings to be able to access to the entity_type_ids field.
We should never use user input in form_state.
I close this since it works as designed