Hello,

I have some problem with taxonomies in drupal 8.

I have one taxonomy, and when I try to add some word, system show me one error. After that, I can't see the added word on /taxonomy/manage/category/overview... but otherwise If I try to create some content type and use taxonomy, I can't see any word.

If I read in error text, if a missing entity but I don't know what or how find it.

Thanks for all!

Missatge d'error

<blockquote>Warning: array_keys() expects parameter 1 to be array, null given in Drupal\taxonomy\TermForm->buildEntity() (line 113 of core/modules/taxonomy/src/TermForm.php).
Drupal\taxonomy\TermForm->buildEntity(Array, Object) (Line: 94)
Drupal\Core\Entity\ContentEntityForm->validateForm(Array, Object) (Line: 95)
Drupal\taxonomy\TermForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 83)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 270)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'taxonomy_term_category_form') (Line: 119)
Drupal\Core\Form\FormValidator->validateForm('taxonomy_term_category_form', Array, Object) (Line: 571)
Drupal\Core\Form\FormBuilder->processForm('taxonomy_term_category_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 26)
Drupal\taxonomy\Controller\TaxonomyController->addForm(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
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}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
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: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Warning: array_keys() expects parameter 1 to be array, null given in Drupal\taxonomy\TermForm->buildEntity() (line 113 of core/modules/taxonomy/src/TermForm.php).
Drupal\taxonomy\TermForm->buildEntity(Array, Object) (Line: 276)
Drupal\Core\Entity\EntityForm->submitForm(Array, Object) (Line: 64)
Drupal\Core\Entity\ContentEntityForm->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('taxonomy_term_category_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 26)
Drupal\taxonomy\Controller\TaxonomyController->addForm(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
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}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
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: 652)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Missatge d'estat</blockquote>

Comments

nasinandes’s picture

Hello,

I try some post that explain one solution:

Hello!

Try to add:

if(isset($form['relations']['parent'])) {
$term->parent = array_keys($form_state->getValue('parent'));
}

on /core/modules/taxonomy/src/TermForm.php (line 113)

and it's works!!!

You can find the post at: https://www.drupal.org/node/2816497#comment-11768175

Thanks!

nasinandes’s picture

Hello!

Sorry for delay!! Thanks, its works your solution!!! Thanks for explanation!!

Nasi