You are here

function config_pages_render_field in Config Pages 7

Theme specified config.

Since config is just an entity it can be themed.

File

./config_pages.inc, line 153
Logic functions.

Code

function config_pages_render_field($type, $filed_name, $delta = 0, $context = NULL, $view_mode = 'full', $render = TRUE) {

  // Load config.
  if ($context === NULL) {
    $context = config_pages_context_get($type);
  }
  $config = config_pages_load_entity($type, $context);
  if (empty($config)) {
    return '';
  }

  // Build fields content.
  $content = array();
  $items = config_pages_get($type, $filed_name, NULL, $delta, array(), $context);
  if (!empty($items)) {
    if (is_array($delta) && is_array($items)) {
      foreach ($items as $item) {
        $content[] = field_view_value('config_pages', $config, $filed_name, $item, $view_mode);
      }
    }
    else {
      $content = field_view_value('config_pages', $config, $filed_name, $items, $view_mode);
    }
  }

  // Return result.
  return !empty($render) ? drupal_render($content) : $content;
}