function boxes_block_view

cis7 boxes.module boxes_block_view($delta)
cle7 boxes.module boxes_block_view($delta)
elmsmedia7 boxes.module boxes_block_view($delta)
icor7 boxes.module boxes_block_view($delta)
meedjum_blog7 boxes.module boxes_block_view($delta)
mooc7 boxes.module boxes_block_view($delta)

Implements hook_block_view().

1 call to boxes_block_view()
boxes_footer in sites/all/modules/ulmus/boxes/boxes.module
Implements hook_footer().

File

sites/all/modules/ulmus/boxes/boxes.module, line 141

Code

function boxes_block_view($delta) {
  // Add boxes JS.
  boxes_add_js();

  ctools_include('export');

  // If the 'add' box was requested, replace the delta with a unique delta.
  if (strpos($delta, 'boxes_add__') === 0) {
    $plugin_key = str_replace('boxes_add__', '', $delta);
    $identifier = (module_exists('spaces') && $space = spaces_get_space()) ? "{$space->type}-{$space->id}" : 'box';
    $hash = boxes_create_hash($identifier);
    $delta = $identifier . "-" . $hash;
    $box = boxes_factory($plugin_key, array('delta' => $delta));
    $form_state = array(
      'box' => $box,
      'plugin_key' => $plugin_key,
      'custom_action' => TRUE,
      'no_redirect' => TRUE,
    );

    // We need to explicitly set the form input as empty to avoid the form being
    // processed. The actual form submission is handled in the footer.
    $form_state['input'] = array();
    $form_state['init_form'] = TRUE;
    $form = drupal_build_form('boxes_box_form', $form_state);

    $block['delta'] = $delta;
    $block['content'] = '';
    $block['editing'] = $form;
    $block['content'] = theme('boxes_box', array('block' => $block));
    $plugin = ctools_get_plugins('boxes', 'plugins', $plugin_key);
    $block['subject'] = t('Add custom @title', array('@title' => strtolower($plugin['title'])));
    $block['boxes_plugin'] = $box->plugin_key;
    return $block;
  }
  elseif ($box = boxes_box_load($delta)) {
    // Generate content and provide an editing form if user has proper
    // permissions.
    $block = $box->render();
    if (boxes_access_edit()) {
      if (variable_get('boxes_edit_location', BOXES_EDIT_IN_PLACE) == BOXES_EDIT_IN_PLACE) {
        $edit_link = array(
          'title' => t('Edit Box'),
          'href' => $_GET['q'],
          'query' => array(
            'plugin_key' => $box->plugin_key,
            'boxes_delta' => $block['delta'],
          ),
          'attributes' => array('class' => array('use-ajax')),
        );
      }
      else {
        $edit_link = array(
          'title' => t('Edit Box'),
          'href' => 'admin/structure/block/manage/boxes/' . $block['delta'] . '/configure',
          'query' => drupal_get_destination(),
        );

      }
      $block['controls'] = theme('links', array(
        'links' => array(
          'edit' => $edit_link,
          'cancel' => array(
            'title' => t('Cancel'),
            'href' => $_GET['q'],
          ),
        ),
      ));
    }
    // Add additional_classes
    if (!empty($box->options['additional_classes'])) {
      $block['additional_classes'] = $box->options['additional_classes'];
    }
    $block['content'] = theme('boxes_box', array('block' => $block));
    $block['boxes_plugin'] = $box->plugin_key;
    return $block;
  }
}
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.