You are here

function ds_make in Display Suite 6.2

Same name and namespace in other branches
  1. 6.3 includes/ds.api.inc \ds_make()

API function to build and render a build mode for a given object

This is not used internally by ds, but can be called by other modules wishing to call a build mode programatically.

Note that ds normally steps in during the normal build process and expects certain values to be available in $vars as a result, so you will need to determine what those properties are and provide them, or ensure that all your fields do not require values from that array. In a lot of cases, calling this function outside of a page load workflow will fail as a result.

Parameters

$key: Key of the object, e.g. NID

$object: the object to be manipulated

$module: the ds module providing the display

$vars: an array of values to use in the render

$build_mode (optional): the build mode to use

Return value

a string containing the fully rendered display

File

./ds.module, line 275
Core functions for the Display Suite module.

Code

function ds_make($key, $module, &$object, &$vars, $build_mode = NULL) {
  if (isset($build_mode) && !is_null($build_mode)) {
    $object->build_mode = $build_mode;
  }
  $data = array(
    'object' => $object,
    'module' => $module,
    'vars' => $vars,
  );
  drupal_alter('ds_render', $data);
  ds_build_fields_and_regions($data['object'], $module);
  $render = ds_render($key, $data['object'], $module, $data['vars']);
  return $render;
}