Views Results Inject

Categories

Component ID

2699035

Component name

Views Results Inject

Component type

module

Maintenance status

Development status

Component security advisory coverage

covered

Downloads

237

Component created

Component changed

Component body

Please note: this module is for developer use only.

This module allows you to inject content between results returned from the view.
At the moment works only if views row plugin is 'Rendered Entity'

How to use:

  • Make sure your view row plugin is set to be 'Rendered entity with injected custom markup' instead of 'Rendered Entity'
  • Implement hook_views_post_execute() where you inject the callback function into results

Example:

/**
 * Implements hook_views_post_execute().
 */
function yourmodule_views_post_execute(&$view) {
  if ($view->name == 'yourview' && $view->current_display == 'somedisplay') {
    // Inject output of yourmodule_custom_callback into '2' position of your results.    
    $view->result = views_results_inject_content($view, 2, 'yourmodule_custom_callback', array($view->name));
  }
}

function yourmodule_custom_callback($name) {
  return t("Embed custom markup into results of the view @view", array('@view' => $name));
}