How to reproduce

  1. Go on admin/config/search/xmlsitemap/rebuild
  2. Select only Node entity type from multiselect
  3. 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);
  }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sedax created an issue. See original summary.

G42’s picture

I can confirm this behavior on 1.0-alpha2. I tested your changes and created a patch.

nplowman’s picture

Patch #2 worked for me. Thanks!

csedax90’s picture

Status: Active » Needs review
farse’s picture

Had the same issue with commerce installed and this patch works for me on the latest dev version, thanks!

GoZ’s picture

Status: Needs review » Closed (works as designed)

This 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