Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix theme information provided by Entity Reference's Views integration. #6627

Closed
alanmels opened this issue Jun 25, 2024 · 6 comments · Fixed by backdrop/backdrop#4812
Closed

Comments

@alanmels
Copy link

alanmels commented Jun 25, 2024

Steps To Reproduce

To reproduce the behavior:

  1. Enable the Entity Reference module.
  2. Enable showing all error messages under admin/config/development/logging.
  3. Go to /admin/structure/views/view, select any Views.
  4. Add Entity reference display and then click on the Information link under the Other section against the Theme: option.
  5. Click on Style output or Row style output -> the default theme template text box is empty, and errors are shown 👎🏼

The errors for each selection are respectively:

Warning: file_get_contents(./core/modules/views/theme/views-view-unformatted.tpl.php): Failed to open stream: No such file or directory in views_plugin_display->options_form() (line 2040 of /var/www/html/docroot/core/modules/views/plugins/views_plugin_display.inc).

and

Warning: file_get_contents(./core/modules/views/theme/views-view-fields.tpl.php): Failed to open stream: No such file or directory in views_plugin_display->options_form() (line 2067 of /var/www/html/docroot/core/modules/views/plugins/views_plugin_display.inc).

@klonos klonos self-assigned this Jun 25, 2024
@alanmels
Copy link
Author

Additional Information

  1. The path /core/modules/views/theme/ does not exist, because all the templates are in the /core/modules/views/templates/.

  2. The code block around offending line 2040 looks like this:

{
          $output .= '<p>' . t('This is the default theme template used for this style.') . '</p>';
          $output .= '<textarea readonly="readonly" rows="15" cols="82" class="code-sample">' . check_plain(file_get_contents('./' . $plugin->definition['theme path'] . '/' . strtr($plugin->definition['theme'], '_', '-') . '.tpl.php')) . '</textarea>';
        }

Looking the content of $plugin->definition shows an array of 17 elements:

 (Array, 17 elements)

    title (String, 21 characters ) Entity Reference list
    help (String, 54 characters ) Returns results as a list of labels and rendere...
    handler (String, 28 characters ) entityreference_plugin_style
    theme (String, 22 characters ) views_view_unformatted
    theme path (String, 24 characters ) core/modules/views/theme
    theme file (String, 9 characters ) theme.inc
    uses row plugin (Boolean) TRUE
    uses fields (Boolean) TRUE
    uses options (Boolean) TRUE
    type (String, 15 characters ) entityreference
    even empty (Boolean) TRUE
    module (String, 15 characters ) entityreference
    path (String, 36 characters ) core/modules/entityreference/plugins
    file (String, 32 characters ) entityreference_plugin_style.inc
    parent (String, 6 characters ) parent
    name (String, 21 characters ) entityreference_style
    uses grouping (Boolean) TRUE

and as you see the used theme path element has a value of core/modules/views/theme, which does not exist. I am not sure here if the theme path is really needed in order not to break anything, and a new template path element must be added indicating the existing core/modules/views/templates, or just the value must be replaced with the existing path.

@klonos
Copy link
Member

klonos commented Jun 25, 2024

Confirmed @alanmels 👍🏼 ...it seems to be an easy fix. PR coming up.

@klonos
Copy link
Member

klonos commented Jun 25, 2024

Jinx 😅 ...closing my PR.

@alanmels
Copy link
Author

Pardon @klonos, I was doing the same staff :)

@klonos
Copy link
Member

klonos commented Jun 25, 2024

No worries @alanmels ...this is RTBC.

PS: I've updated the issue summary with some additional steps to reproduce the problem more easily.

@jenlampton jenlampton modified the milestones: 1.28.2, 1.28.3 Jul 3, 2024
@quicksketch quicksketch changed the title Failed to open stream: No such file or directory in views_plugin_display->options_form() Theme information provided by Entity Reference's Views integration broken Aug 30, 2024
@quicksketch
Copy link
Member

Thanks @alanmels and @klonos! I merged backdrop/backdrop#4812 into 1.x and 1.28.x.

@jenlampton jenlampton changed the title Theme information provided by Entity Reference's Views integration broken Fix theme information provided by Entity Reference's Views integration. Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment