Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
please forgive my poor english, I just want to report this bug.
I create a custom views style plugin, but it output blank.
then I try to find the reason, the bug in views.module file (about line 182~187)
I don't know why
before:
if (isset($def['theme_file'])) {
$include = \Drupal::root() . '/' . $module_dir. '/' . $def['theme_file'];
if (is_file($include)) {
require_once $include;
}
}
after:
if (isset($def['theme_file'])) {
$include = \Drupal::root() . '/' . $module_dir. '/' . $def['theme_file'];
if (is_file($include)) {
require_once $include;
}
$hooks[$def['theme']]['includes'][] = $module_dir . '/' . $def['theme_file'];
}
As you can see, after I add this code :
$hooks[$def['theme']]['includes'][] = $module_dir . '/' . $def['theme_file'];
then it work well.
thanks.
Comment | File | Size | Author |
---|---|---|---|
#5 | views_custom-style_plugin_2443613_5.patch | 518 bytes | zhiqiang.qiu |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedCould you please specify how we can reproduce the issue?
Comment #2
zhiqiang.qiu CreditAttribution: zhiqiang.qiu commentedMy Drupal 8 custom module is like this:
---test.info.yml
---test.module
---test.theme.inc
---src(dir)
------Plugin(dir)
---------views(dir)
------------row(dir)
---------------testPluginRowFields.php
------------style(dir)
---------------testPluginStyleDefault.php
---template(dir)
-------test-view-unformatted.html.twig
so you should be know it's a views syle plugin. I just test drupal beta9, there is still have this bug.
thanks.
Comment #3
zhiqiang.qiu CreditAttribution: zhiqiang.qiu commentedstep:
1. install my custom views style module.
2. create or modify any views.
3. change the Format Style to select my custom style.
4. you will found the ouput is blank
thanks.
Comment #4
dawehner@zhiqiang.qiu
Do you want to try to write a patch for this, see https://www.drupal.org/node/707484
Comment #5
zhiqiang.qiu CreditAttribution: zhiqiang.qiu commentedthis is the patch to fix this issue.
This is my first time to create a patch. if not right, please tell me. :)
thanks.
Comment #6
dawehnerLooks great. Let's see what the testbot says about it.
Comment #7
zhiqiang.qiu CreditAttribution: zhiqiang.qiu commentedsorry, I just note Drupal8 will be released on November 19, 2015, I just hope Drupal8 is perfect, so I very hope this bug can be fixed. thanks.
Comment #8
Lendudewouldn't it make more sense to put this inside the if(), no point adding the file to $hooks if it doesn't exist.
Also still needs tests so back to ' needs work'.
Comment #9
zhiqiang.qiu CreditAttribution: zhiqiang.qiu commentedsorry , maybe it's my mistake, I read this module code, then I found maybe I can write the "template_preprocess_example_view_fields" function in "test.module" file not in "test.theme.inc" file, and change views style plugin annotation :
remove this:
* module = "test",
* register_theme = TRUE,
* theme_file = "test.theme.inc",
then it works as designed.