Can we update it to do an if (isset($bundle_config)) first?
Alternately (/additionally), we could expand the above lines to include media. I am guessing this is failing on field_representative_image.
pointing to this line: https://git.library.upei.ca/Code/metadata_profiles/src/branch/main/src/Controller/MetadataProfileController.php#L1202
Can we update it to do an if `(isset($bundle_config))` first?
Alternately (/additionally), we could expand the above lines to include media. I am guessing this is failing on field_representative_image.
does the trick.
(I've been looking for an excuse to use match for a while now.)
I added a default earlier in the method. Once we have all the handlers we want I'm thinking something like
```
$bundle_storage = match ($handler) {
'default:node' => 'node_type',
'default:media' => 'media_type',
'default:taxonomy_term' => 'taxonomy_vocabulary',
'default:paragraph' => 'paragraphs_type',
default => NULL,
};
```
then a single
```
$bundle_config = $this->entityTypeManager()
->getStorage($bundle_storage)
->load($bundle);
```
does the trick.
(I've been looking for an excuse to use match for a while now.)
pointing to this line: https://git.library.upei.ca/Code/metadata_profiles/src/branch/main/src/Controller/MetadataProfileController.php#L1202
Can we update it to do an if
(isset($bundle_config))first?Alternately (/additionally), we could expand the above lines to include media. I am guessing this is failing on field_representative_image.
I added a default earlier in the method. Once we have all the handlers we want I'm thinking something like
then a single
does the trick.
(I've been looking for an excuse to use match for a while now.)