- Issue created by @shrikant.dhotre
- Status changed to Postponed: needs info
12 months ago 2:58pm 1 December 2023 With apologies, I do not understand the meaning of this issue. What is a "PFB"?
- 🇮🇳India shrikant.dhotre
I have removed PFB,
I am getting warning which I am adding block on login page. - Status changed to Active
11 months ago 10:55am 7 December 2023 - Status changed to Postponed: needs info
11 months ago 11:59am 7 December 2023 This needs more information. I asked you a question but you did not answer it. Get a stack trace.
- Status changed to Needs work
11 months ago 3:35pm 26 December 2023 - 🇮🇳India shrikant.dhotre
Hi @cilefen,
I am using this hook one of my module and it giving me below error
Warning: Undefined array key "#markup" in Drupal\Core\Render\RenderCache->getCacheableRenderArray() (line 333 of D:\xampp\htdocs\project\docroot\core\lib\Drupal\Core\Render\RenderCache.php)
Inside this hook, I am calling a block which created bin OpenID module. which need to be display in custom login page.
I am getting this warning. Need help to resolve the warning
- 🇮🇳India prashant.c Dharamshala
@shrikant.dhotre
Could you please provide the complete steps to reproduce the issue?
Thanks
- Status changed to Postponed: needs info
11 months ago 3:59pm 26 December 2023 - Status changed to Needs review
11 months ago 2:38pm 27 December 2023 - 🇮🇳India shrikant.dhotre
Hi @Prashan.c,
I have implement below code./** * Implements hook_block_access(). * * Hide Open ID connect block if Drupal Login form is enabled. */ function custom_module_block_access(Block $block, $operation, AccountInterface $account) { $drupalLogin = \Drupal::state()->get('drupal_login_active'); if ($drupalLogin && $block->id() == 'openidconnectlogin_3' && $operation == 'view') { return AccessResult::forbiddenIf(TRUE)->addCacheableDependency($block); } }
- Status changed to Postponed: needs info
11 months ago 6:38pm 27 December 2023 - 🇺🇸United States smustgrave
Instead of id() would check the pluginId.
Instead of forbiddenIf would just use Forbidden since TRUE isn't a condition.
Also may have to dig into the logs some more to see what is calling markup.
- 🇨🇦Canada arakwar
I got the same issue while trying to limit logins to my main "Domain Access" domain name.
The code we're trying to implement :
/** * Implements hook_form_alter(). */ function domain_login_disable_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'user_login_form') { /** @var \Drupal\domain\Entity\Domain $active */ $active = \Drupal::service('domain.negotiator')->getActiveDomain(); if (is_null($active)) { $active = \Drupal::entityTypeManager()->getStorage('domain')->loadDefaultDomain(); } if (is_null($active)) { // If there's an issue with domain, we won't block the login form. return; } if (!$active->isDefault()) { $form['#access'] = FALSE; } } }
When going trough a page request with Xdebug, we can see that in core/lib/Drupal/Core/Render/RenderCache.php, in the getCacheableRenderArray() function, the $elements array doesn't have a #markup element.
Adding
$form['#markup'] = NULL;
in our function right after we set #access to FALSE fix the issue.Is it an intended behavior?
- 🇪🇸Spain leandro713 🇪🇸 Madrid 🤠
I am having this problem too on a fresh new installation of Drupal 10, the error prevents the rendering of the new user creation form. It only appears there.