function ds_render_block_field

cis7 ds.module ds_render_block_field($field)
cle7 ds.module ds_render_block_field($field)
elmsmedia7 ds.module ds_render_block_field($field)
icor7 ds.module ds_render_block_field($field)
meedjum_blog7 ds.module ds_render_block_field($field)
mooc7 ds.module ds_render_block_field($field)

Render a block field.

1 call to ds_render_block_field()
ds_get_field_value in sites/all/modules/ulmus/ds/ds.module
Get the value for a Display Suite field.

File

sites/all/modules/ulmus/ds/ds.module, line 867
Display Suite core functions.

Code

function ds_render_block_field($field) {
  // Invoke the block_view hook of the module.
  list($module, $delta) = explode('|', $field['properties']['block']);
  $block = module_invoke($module, 'block_view', $delta);

  // Get contextual links.
  $contextual_links = array();
  $contextual = module_exists('contextual') && user_access('access contextual links');
  if ($contextual) {
    if (is_array($block['content']) && isset($block['content']['#contextual_links'])) {
      $contextual_links = $block['content']['#contextual_links'];
    }
  }

  // Render the block content.
  if (isset($block['content']) && is_array($block['content'])) {
    $block['content'] = drupal_render($block['content']);
  }

  // Go through in case we have actual content.
  if (!empty($block['content'])) {

    // Make sure subject is set.
    if (!isset($block['subject'])) {
      $block['subject'] = '';
    }

    global $theme_key;
    $full_block = db_query("SELECT * FROM {block} WHERE module = :module AND delta = :delta AND theme = :theme", array(':module' => $module, ':delta' => $delta, ':theme' => $theme_key))->fetchObject();
    if (!empty($full_block)) {
      if ($full_block->title == '<none>') {
        $block['subject'] = '';
      }
      elseif (!empty($full_block->title)) {
        $block['subject'] = $full_block->title;
      }
    }

    // i18n support.
    if (function_exists('i18n_block_block_view_alter')) {

      // Check language visibility.
      global $language;
      static $block_languages = FALSE;
      if (!$block_languages) {
        $block_languages = array();
        $result = db_query('SELECT module, delta, language FROM {i18n_block_language}');
        foreach ($result as $record) {
          $block_languages[$record->module][$record->delta][$record->language] = TRUE;
        }
      }
      if (isset($block_languages[$module][$delta]) && !isset($block_languages[$module][$delta][$language->language])) {
        return;
      }

      // Translate.
      if (!empty($full_block->i18n_mode)) {
        i18n_block_block_view_alter($block, $full_block);
        if (!empty($block['title'])) {
          $block['subject'] = $block['title'];
        }
      }
    }

    $block = (object) $block;
    switch ($field['properties']['block_render']) {
      case DS_BLOCK_TEMPLATE:
        $block->region = NULL;
        $block->module = $module;
        $block->delta = $delta;
        $elements = array('elements' => array(
          '#block' => $block,
          '#children' => $block->content,
        ));
        // Add contextual links.
        if ($contextual) {
          $elements['elements'] += array('#contextual_links' => array_merge($contextual_links, array('block' => array('admin/structure/block/manage', array($block->module, $block->delta)))));
        }
        return theme('block', $elements);
        break;
      case DS_BLOCK_TITLE_CONTENT:
        return '<h2 class="block-title">' . $block->subject . '</h2>' . $block->content;
        break;
      case DS_BLOCK_CONTENT:
        return $block->content;
        break;
    }
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.