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)
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | go_back-content_type_name_change-3168991-2.patch | 7.15 KB | bbu23 |
Comments
Comment #2
bbu23The 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 updbIf 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.
Comment #3
bbu23Comment #5
saesa commentedThank you for your work!