@starlight-sparkle

Account created on 6 February 2024, 11 months ago
#

Recent comments

I have made a merge request addressing this issue this as part of Drupalcon Singapore 2024 Contribution Day.
@larowan came by and suggested to add a message explaining the empty field rather than altering the behaviour of the edit settings gear icon, as this would require EntityDisplayFormBase::buildFieldRow() to traverse all the nested fields inside of widget settings form to check if they are visible.
Removing the form element from the settings form was also not advisable as this would change the form schema.

it's present!

Coaston means to say that the original commit is incomplete, not that the commit is missing.

The MR created by jnettik implemented the fix in a different way from the patch file submitted by artyom. Namely:

  • The MR implementation simply calls Element::isEmpty()
  • The patch file implementation additionally executes the view to check if the rendered output is empty

This is significant in the special case of views because as explained πŸ› Empty content view Fixed :

ViewExecutable will build a render array regardless of whether it has anything to display, because the view is not executed until render time, and hence just checking the render array it not reliable, which is all Element::isEmpty() does.

The Drupal Core views block display plugin (\Drupal\views\Plugin\views\display\Block::execute()) suggests that the correct way to check is to actually execute the view with arguments, then check $view->getDisplay()->outputIsEmpty(), which is how the plugin implements its "Hide block if the view output is empty" option.

Follow up from issue 3283364 as well as comment #4 from this issue's reporter.
The merged commit (94a2ab3d) contains a fix for ExtraFieldBlockPlugin, but it appears ExtraFieldViewsPlugin also has an issue.
The problem is that a ViewExecutable will build a render array regardless of whether it has anything to display, because the view is not executed until render time, and hence it is not sufficient to check the render array.
You have to actually execute the view with arguments, then check $view->getDisplay()->outputIsEmpty()

Production build 0.71.5 2024