You are here

function block_upload_block_view in Block Upload 7

Implements hook_block_view().

File

./block_upload.module, line 123
Block Upload module.

Code

function block_upload_block_view($delta = '') {
  $block = array();
  $blocks_count = variable_get('block_upload_blocks_count', 1);
  for ($i = 1; $i <= $blocks_count; $i++) {
    if ($delta == 'block_upload_' . $i && user_access('block upload') && ($node = menu_get_object())) {
      $field = field_info_field(variable_get('block_upload_' . $i . '_field', ''));
      if (!empty($field['bundles']['node'])) {
        foreach ($field['bundles']['node'] as $bundle) {
          if ($bundle == $node->type) {
            $settings = variable_get('block_upload_' . $i . '_settings', array());
            if (isset($settings['plupload']) && $settings['plupload']) {

              // Plupload integration form.
              $block['content'] = drupal_get_form('block_upload_plupload_form', $node, $i);
            }
            else {

              // Simple file upload form.
              $block['content'] = drupal_get_form('block_upload_form', $node, $i);
            }
          }
        }
      }
    }
  }
  return $block;
}