You are here

function mobile_codes_ctools_block_view in Mobile Codes 7.2

Mobile Codes blocks view callback.

File

includes/ctools.inc, line 67
CTools module integration.

Code

function mobile_codes_ctools_block_view($delta) {
  ctools_include('export');
  $block = ctools_export_crud_load('mobile_codes_blocks', $delta);
  $data = '';
  switch ($block->data['type']) {
    case 'raw':
      $data = token_replace($block->data['content']);
      break;
    case 'php':
      if (module_exists('php')) {
        $data = php_eval($block->data['content']);
        break;
      }
      watchdog('mobile_codes', "Mobile Codes Block '%name' requires the PHP module.", array(
        '%name' => $block->name,
      ), WATCHDOG_ERROR);
      return FALSE;
  }
  return array(
    'subject' => $block->label,
    'content' => theme('mobilecode', array(
      'data' => $data,
      'attributes' => array(
        '#preset' => $block->preset,
      ),
    )),
  );
}