Skip to content

Organisation entity preprocess assumes Stakeholder bundle fields exist #1671

@kp77

Description

@kp77

After creating a new Organisation type (oe_organisation entity type) with custom bundle fields, I get error from oe_theme_content_entity_organisation_preprocess_oe_organisation:

InvalidArgumentException: Field oe_acronym is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 616 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

It seems the preprocess function assumes that certain bundle fields that exist on Stakeholder type organisations also exist on other types. Fields that are used with get method on the entity (without checking if they exist) are: oe_acronym, oe_logo, oe_contact_url, oe_address and oe_website.

Possibly, this preprocess function should be restricted to the oe_stakeholder bundle, or the hasField method should be used before getting the fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions