Problem/Motivation
On the template edit page there is a runtime error.
The website encountered an unexpected error. Please try again later.
Error: Call to undefined method Drupal\Core\Field\BaseFieldDefinition::label() in Drupal\workbench_email\Plugin\RecipientType\EntityReferenceUser->buildConfigurationForm() (line 54 of modules/contrib/workbench_email/src/Plugin/RecipientType/EntityReferenceUser.php).
Drupal\workbench_email\Plugin\RecipientType\EntityReferenceUser->buildConfigurationForm() (Line: 237)
Drupal\workbench_email\Form\TemplateForm->form() (Line: 106)
Drupal\Core\Entity\EntityForm->buildForm()
call_user_func_array() (Line: 531)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 278)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult() (Line: 39)
Drupal\layout_builder\Controller\LayoutBuilderHtmlEntityFormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 49)
Asm89\Stack\Cors->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)
Steps to reproduce
Created an email template and edit to see the error.
Proposed resolution
Replace label with getLabel.
- $field_options[$entity_type_id . ':' . $field_name] = $sample_field->label() . ' (' . $entity_type->getLabel() . ')';
+ $field_options[$entity_type_id . ':' . $field_name] = $sample_field->getLabel() . ' (' . $entity_type->getLabel() . ')';
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comments
Comment #2
jibranComment #3
larowlanI think this happens when your field map is corrupt
Comment #4
larowlanComment #5
jibranThank you for the suggestion I tired to rebuild the map but still can't get rid of the error but
::getLabel()exists on both\Drupal\Core\Field\BaseFieldDefinitionand\Drupal\Core\Field\FieldDefinitionand I think that is the right method to call.Comment #7
larowlanTagging 2.3.2