When changing a content types name (not the machine name) the notice appears:
Notice: Undefined index: Content Type in Drupal\go_back\Plugin\Block\GoBack->build() (line 392 of /home/testsite/public_html/web/modules/contrib/go_back/src/Plugin/Block/GoBack.php)

Comments

Yuri created an issue. See original summary.

bbu23’s picture

The problem is that the current block configuration uses content types labels instead of machine names, so I've changed that. In order to not lose the data for the people who used this before this change, I created an update that would keep the values from the stored content type label and set them under the new machine name key. There is a case when it won't work, but I cannot do anything about it: if the user changed the content type label, it's hard to guess the label that he used before. Also, language might also affect the update, but I don't have a better idea. Just in case for people who changed the label, I added a case that checks also the machine name with capital first letter.

I suggest to rename the content type back to original before applying the patch and make sure to run the updates first!
drush updb

If you still get a warning after applying the patch and running the updates, it means that the update didn't work for content types that changed their name or if the label was translated during the update run.

bbu23’s picture

Status: Active » Needs review

  • saesa committed d5c997a on 8.x-1.x
    Issue #3168991 by bbu23: Undefined index notice after changing content...
saesa’s picture

Status: Needs review » Fixed

Thank you for your work!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.