Ошибка: вызов функции-члена uuid () в null в Drupal 8 - PullRequest
0 голосов
/ 17 мая 2018

У меня есть тип контента Artist и в разделе Artist Type Type у меня есть поля изображений.но я не могу отредактировать и сохранить новое изображение. Показывает сообщение об ошибке

The website encountered an unexpected error. Please try again later.
Error: Call to a member function uuid() on null in Drupal\Core\Field\EntityReferenceFieldItemList->defaultValuesFormSubmit() (line 126 of core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php).
Drupal\Core\Field\EntityReferenceFieldItemList->defaultValuesFormSubmit(Array, Array, Object) (Line: 169)
Drupal\field_ui\Form\FieldConfigEditForm->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('field_config_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('field_config_edit_form', Object) (Line: 74)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 664)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

1 Ответ

0 голосов
/ 17 мая 2018
 $default_value = array_filter($default_value);

Только что добавил код и его работа для меня.

Index: core/lib/Drupal/Core/Field/EntityReferenceFieldItemList.php

public function defaultValuesFormSubmit(array $element, array &$form, FormStateInterface $form_state) {
     $default_value = parent::defaultValuesFormSubmit($element, $form, $form_state);
//just add this line 
$default_value = array_filter($default_value);

     // Convert numeric IDs to UUIDs to ensure config deployability.
     $ids = array();
...