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.
i want to call views_embed_view or $view->render to get the array (ex. json) instead of string. But I have to override the theme template so that i don't get all the
elements.
function xxx_theme() {
return array(
'views_view__report_ontime_delivery' => array(
'variables' => array('view' => NULL, 'options' => NULL, 'row' => NULL),
'template' => 'views-view--report-ontime-delivery',
'base hook' => 'views_view',
'path' => drupal_get_path('module', 'plusdelta'),
),
);
}
and in the template file, i just put
<?php print $rows; ?>
as you see, if i can have a function call in view or in datasource which let me grab this $rows, it'll make my life easier. Let me know if this can be done in any other way. Currently i just reverse the json which is kinda of funny to me, but works :)
$res = views_embed_view('report_ontime_delivery', 'page_1');
$res = json_decode($res);
I know, maybe i should ask this question in Views module