You are here

function popup_announcement_block_configure in Pop-up announcement 7

Implements hook_block_configure().

File

./popup_announcement.module, line 82
Primarily Drupal hooks and custom functions for creating block with pop-up announcement.

Code

function popup_announcement_block_configure($delta) {
  if (strstr($delta, 'popup_announcement_')) {
    $bid = substr($delta, 19);
    $pa = new Popup_announcement_block();
    $b = $pa
      ->get_block($bid);

    /* $form['info'] = array(
         '#markup' => '<b>Note:</b> list with all announcements here: ' . l('admin/config/popup_announcement/list', 'admin/config/popup_announcement/list'),
         '#weight' => 100,
       ); */

    // override default title
    $form['title'] = array(
      '#type' => 'textfield',
      '#title' => t('Title'),
      '#description' => t('Visible only on admin pages'),
      '#default_value' => $b['name'],
    );
    $form['number_visit'] = array(
      '#type' => 'textfield',
      '#title' => t('Number of visits when announcement will appear'),
      '#description' => t('Only numbers separate by commas. Be aware: the pop-up appears at every visit if this field is empty. Default: 1,2,5'),
      '#default_value' => $b['number_visit'],
    );

    //  https://api.drupal.org/api/drupal/developer%21topics%21forms_api_reference.html/7#text_format todo
    $form['text'] = array(
      '#type' => 'textarea',
      '#title' => t('Announcement text'),
      '#description' => t('You may use html here if necessary.'),
      '#format' => NULL,
      '#default_value' => $b['text'],
    );
    $form['width'] = array(
      '#type' => 'textfield',
      '#title' => t('Announcement width'),
      '#description' => t('In pixels. Just number. Default: 500.'),
      '#default_value' => $b['width'],
    );
    $form['height'] = array(
      '#type' => 'textfield',
      '#title' => t('Announcement height'),
      '#description' => t('In pixels too. Just number. Default: 300.'),
      '#default_value' => $b['height'],
    );
    $form['delay'] = array(
      '#type' => 'textfield',
      '#title' => t('Delay'),
      '#description' => t('In seconds. Just number. Default: 1.'),
      '#default_value' => $b['delay'],
    );
  }
  return $form;
}