Skip to content
Snippets Groups Projects

Issue #3391677 by bohart: Added support both hook_form_BASE_FORM_ID_alter and hook_form_FORM_ID_alter hooks for MailerPolicy entity edit form.

Open Issue #3391677 by bohart: Added support both hook_form_BASE_FORM_ID_alter and hook_form_FORM_ID_alter hooks for MailerPolicy entity edit form.
1 unresolved thread
1 unresolved thread
@@ -10,6 +10,23 @@ use Drupal\Core\Form\FormStateInterface;
*/
class PolicyEditForm extends EntityForm {
/**
* {@inheritdoc}
*/
public function getFormId() {
// Generates a unique form ID for each policy form. Examples/explanations:
// - mailer_policy_all_all_edit_form: for All/All policy.
// - mailer_policy_type_all_edit_form: for All policy of the type.
// - mailer_policy_type_subtype_edit_form: for other policies.
return implode("_", [
$this->getEntity()->getEntityTypeId(),
$this->getEntity()->getType() ?? "all",
$this->getEntity()->getSubType() ?? "all",
    • Comment on lines +23 to +24

      I suggest we should use $this->getEntity()->id() instead of these two. It will include the type, sub-type and entity ID of the mailer policy, in a format that is already well-known.

Please register or sign in to reply
$this->operation,
"form",
]);
}
/**
* {@inheritdoc}
*/
Loading