Skip to content

MessageNotifierBase: restricts rendered fields to user/cck fields only #250

@OnkelTem

Description

@OnkelTem

I extended Message entity with a base field which I use to store the output.
Then I pass it in 'rendered fields' array of the notifier options.
And it doesn't work in \Drupal\message_notify\Plugin\Notifier\MessageNotifierBase::postSend because it expects the field must be a cck-one which is not the case in my situation.
Particularly this check breaks everything:

if (!$field = $this->entityTypeManager->getStorage('field_config')->load('message.' . $this->message->bundle() . '.' . $field_name)) {
    throw new MessageNotifyException('Field "' . $field_name . '"" does not exist.');
}

I propose replacing this with the basic: $this->message->hasField($field_name) and not bothering with deducing the nature of the field provided.

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