You are here

function ds_block in Display Suite 6.3

Same name and namespace in other branches
  1. 6 ds.module \ds_block()
  2. 6.2 ds.module \ds_block()

Implementation of hook_block().

File

./ds.module, line 240

Code

function ds_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      require_once 'includes/ds.registry.inc';
      return _ds_block_list();
      break;
    case 'view':
      $content = array();
      $ds_blocks = variable_get('ds_blocks', array());
      if (isset($ds_blocks[$delta])) {
        $info = $ds_blocks[$delta];
        $data = $info['data'];
        if (isset($data['filename']) && isset($data['class'])) {
          require_once $data['filename'];
          $class = $data['class'];
          $plugin = new $class();
          if (method_exists($plugin, 'block_view')) {
            $content = $plugin
              ->block_view($info);
          }
        }
      }
      return $content;
      break;
  }
}