You are here

function sharedblocks_block_configure in Shared Blocks 7.2

Implements hook_block_configure.

1 call to sharedblocks_block_configure()
sharedblocks_ctools_export_ui_form in plugins/export_ui/sharedblocks_ctools_export_ui.inc
Implements HOOK_ctools_export_ui_form().

File

./sharedblocks.module, line 104

Code

function sharedblocks_block_configure($delta = '') {
  $subscription = !empty($delta) ? sharedblocks_subscription_load($delta) : FALSE;
  $form['description'] = array(
    '#type' => 'textfield',
    '#title' => t('Administrative label'),
    '#description' => t('A brief description of your block. Used on the <a href="@url">Blocks administration page</a>.', array(
      '@url' => url('admin/structure/block'),
    )),
    '#default_value' => !empty($subscription->description) ? $subscription->description : '',
    '#required' => TRUE,
  );
  $form['name'] = array(
    '#type' => 'machine_name',
    '#default_value' => $delta,
    '#maxlength' => 32,
    '#disabled' => !empty($delta),
    '#machine_name' => array(
      'exists' => 'sharedblocks_subscription_load',
      'source' => array(
        'settings',
        'description',
      ),
    ),
    '#required' => TRUE,
  );
  $form['url'] = array(
    '#type' => module_exists('elements') ? 'urlfield' : 'textfield',
    '#title' => t('Subscribe URL'),
    '#default_value' => !empty($subscription->url) ? $subscription->url : '',
    '#description' => t('The URL to the block you wish to subscribe to, supplied by publishing site.'),
    '#required' => TRUE,
    '#element_validate' => array(
      'sharedblocks_element_validate_url',
    ),
    '#maxlength' => 255,
  );
  $interval_options = array(
    0 => t('Never cache'),
  ) + drupal_map_assoc(array(
    60,
    300,
    600,
    1200,
    1800,
    3600,
    10800,
    21600,
    32400,
    43200,
    86400,
    172800,
    259200,
    604800,
    1209600,
    2419200,
    4838400,
    9676800,
  ), 'format_interval');
  $form['update_interval'] = array(
    '#type' => 'select',
    '#title' => t('Refresh rate'),
    '#options' => $interval_options,
    '#description' => t("How frequently should this block's content be updated? Note that this can only run as often as cron runs."),
    '#default_value' => isset($subscription->update_interval) ? $subscription->update_interval : 3600,
  );
  return $form;
}