You are here

function _jquerymobile_view_multiple in jQuery Mobile module 7.2

Construct a drupal_render() style array from an array of loaded nodes.

Parameters

array $nodes: An array of nodes as returned by node_load_multiple().

string $view_mode: View mode, e.g. 'full', 'teaser'...

int $weight: An integer representing the weight of the first node in the list.

string $langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

Return value

array An array in the format expected by drupal_render().

1 call to _jquerymobile_view_multiple()
jquerymobile_page_default in ./jquerymobile.inc
Menu callback; Generate a listing of promoted nodes.

File

modules/node.inc, line 23
Alterations required to the node module.

Code

function _jquerymobile_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcode = NULL) {
  global $theme_key;
  field_attach_prepare_view('node', $nodes, $view_mode, $langcode);
  entity_prepare_view('node', $nodes, $langcode);
  $build = array();
  foreach ($nodes as $node) {
    $build['nodes'][$node->nid] = _jquerymobile_node_view($node, $view_mode, $langcode);
    $build['nodes'][$node->nid]['#weight'] = $weight;
    $weight++;
  }
  $build['nodes']['#sorted'] = TRUE;
  $use_global = theme_get_setting('use_global', $theme_key);
  $attributes['data-role'] = 'listview';
  $attributes['data-inset'] = $use_global ? theme_get_setting('global_inset', $theme_key) : theme_get_setting('menu_item_inset', $theme_key);
  $attributes['data-theme'] = $use_global ? theme_get_setting('global_theme') : theme_get_setting('menu_item_theme', $theme_key);
  $attributes['data-divider-theme'] = $use_global ? theme_get_setting('global_theme') : theme_get_setting('menu_item_dividertheme', $theme_key);
  $attributes['data-count-theme'] = $use_global ? theme_get_setting('global_theme') : theme_get_setting('menu_item_counttheme', $theme_key);
  $attributes['data-split-theme'] = $use_global ? theme_get_setting('global_theme') : theme_get_setting('menu_item_splittheme', $theme_key);
  $attributes['data-split-icon'] = $use_global ? theme_get_setting('global_icon') : theme_get_setting('menu_item_spliticon', $theme_key);
  if (_jquerymobile_get_setting($theme_key, 'front')) {
    $build['nodes']['#prefix'] = '<ul ' . drupal_attributes($attributes) . '>';
    $build['nodes']['#suffix'] = '</ul>';
  }
  return $build;
}