If the parent content type in an Entity Reference Hierarchy relationship also has a field with 'Require on Publish' set to true, going to that node's 'Children' pane causes the following error:
TypeError: Argument 1 passed to require_on_publish_add_indicator() must be of the type array, null given, called in /Users/aoneill/Sites/d8/web/modules/contrib/require_on_publish/require_on_publish.module on line 178
The problem is in 'require_on_publish_form_alter', where it assumes the form object contains the field, even though the 'Children' page is not the same as the entity edit form.
Attaching a patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | require_on_publish-entity-reference-hierarchy-3021630-0.patch | 987 bytes | alxp |
Comments
Comment #2
alxp commentedComment #3
alxp commentedPatch that does a simple check before accessing a field value in hook_form_alter().
Comment #4
alxp commentedComment #5
alxp commentedTo reproduce:
Enable Require on Publish and Entity Reference Hierarchy (https://www.drupal.org/project/entity_hierarchy)
On Standard Drupal install, go to Admin -> Structure -> Content Types.
Edit Fields of Basic Page, add a new field and mark it as 'Require on Publish.'
Edit fields of Article, add a Entity Reference Hierarchy field and make it point to the Basic Page bundle.
Clear Drupal cache.
Add content items of each type, and select the basic page content item in the Entity Reference Hierarchy field of the article content item.
Go to the Basic Page content item you created, and click on the Children tab.
Comment #6
mpriscella commentedLooks good, thanks! I'll merge it in tonight and create a new release.
Comment #8
mpriscella commented