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.
By incursus on
Working on a module in which I'm trying to utilize this hook. According to the API docs, the arguments to this hook are:
\Drupal\views\ViewExecutable $view: The view object about to be processed.
string $output: A flat string with the rendered output of the view.
\Drupal\views\Plugin\views\cache\CachePluginBase $cache: The cache settings.
However, the second argument ($output), does not in fact, come in as a "flat string". It comes in as an array. Also, shouldn't that be "&$output", instead of "$output"?
So the API docs are wrong?
Assuming they are for a moment, anyone have any guidance on how best to obtain the rendered view output programatically?
Thanks in advance!
Comments
However, the second argument
You should do some tests to confirm if this is always the case, or if it's specific to your installation (maybe you have something that is breaking normal functionality). I'd test on a vanilla installation. If you find that it is indeed an array, then you should file an issue on the matter (click the 'file an issue' link on the api page), and potentially submit a patch with a correction to the documentation.
It's listed as &$output in the function definition. It wouldn't be listed as such in the documentation.
Problem exists under vanilla
Problem exists under vanilla as well. I've opened an issue: https://www.drupal.org/node/2790915
Cheers.