Because of
$this->accessStorage->getUserTermPermissionsByTids($tids);
returns an not empty array ([0 => NULL]) the empty check at
if (!empty($rids)) {
$roles = Role::loadMultiple($rids);
}
is allways true, but NULL is not a flipable Value. I fixed it.
Warning: array_flip(): Can only flip STRING and INTEGER values! in Drupal\Core\Entity\EntityStorageBase->loadMultiple() (line 227 of core/lib/Drupal/Core/Entity/EntityStorageBase.php).
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 507)
Drupal\Core\Entity\Entity::loadMultiple(Array) (Line: 67)
Drupal\permissions_by_term\Service\Info->renderNodeDetails('60', 'modules/permissions_by_term/src/View/node-details.html.twig') (Line: 221)
permissions_by_term_form_alter(Array, Object, 'node_page_edit_form') (Line: 501)
Drupal\Core\Extension\ModuleHandler->alter('form', Array, Object, 'node_page_edit_form') (Line: 819)
Drupal\Core\Form\FormBuilder->prepareForm('node_page_edit_form', Array, Object) (Line: 272)
Drupal\Core\Form\FormBuilder->buildForm('node_page_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: 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: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
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: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)| Comment | File | Size | Author |
|---|---|---|---|
| #5 | array_flip.patch | 903 bytes | JR Tera3yte |
Comments
Comment #2
jepster_Thanks for reporting. Have you forgotten to upload the patch?
Comment #3
JR Tera3yte commentedSorry, I was not able to upload it earlier because I was not confirmed.
Comment #4
JR Tera3yte commentedChanged public function to a private function
Comment #5
JR Tera3yte commentedDid not double check my patch, so now it is well tested and works as expected. I'm sorry.
Comment #7
jepster_Fixed in 8.x-1.31: https://www.drupal.org/project/permissions_by_term/releases/8.x-1.31
I have used a different code. There has not been an additional class method needed.
Please test and re-open this issue, if you have any objections.