You are here

function afb_block_info in Advanced Form Block 7

Implements hook_block_info().

File

./afb.module, line 583
Allows administrators to create blockd of node add/edit forms.

Code

function afb_block_info() {
  $blocks = array();
  $result_add = db_select('afb_blocks_data', 'n')
    ->fields('n', array(
    'delta',
    'title',
    'content_type',
  ))
    ->condition('n.form_type', 'Add', '=')
    ->execute();
  foreach ($result_add as $row) {
    $blocks[$row->delta] = array(
      'info' => t('@name (Add Form Block) Type: @type', array(
        '@name' => $row->title,
        '@type' => $row->content_type,
      )),
      'cache' => DRUPAL_NO_CACHE,
    );
  }
  $result_edit = db_select('afb_blocks_data', 'n')
    ->fields('n', array(
    'delta',
    'title',
    'content_type',
    'nid',
  ))
    ->condition('n.form_type', 'Edit', '=')
    ->execute();
  foreach ($result_edit as $row) {
    $blocks[$row->delta] = array(
      'info' => t('@name (Edit Form Block) Nid: @nid', array(
        '@name' => $row->title,
        '@nid' => $row->nid,
      )),
      'cache' => DRUPAL_NO_CACHE,
    );
  }
  return $blocks;
}