You are here

function boxes_form_block_admin_configure_alter in Boxes 7

Same name and namespace in other branches
  1. 6 boxes.module \boxes_form_block_admin_configure_alter()

Implements hook_form_alter for block_admin_configure().

File

./boxes.module, line 546
Core functionality for boxes module.

Code

function boxes_form_block_admin_configure_alter(&$form, &$form_state) {
  if ($form['module']['#value'] == 'boxes') {
    $box = boxes_box_load($form['delta']['#value']);
    if ($box->export_type & EXPORT_IN_DATABASE && $box->export_type & EXPORT_IN_CODE) {
      $form['actions']['revert'] = array(
        '#type' => 'submit',
        '#value' => t('Revert'),
        '#submit' => array(
          'boxes_block_delete_submit',
        ),
      );
    }
    elseif (!($box->export_type & EXPORT_IN_CODE)) {
      $form['actions']['delete'] = array(
        '#type' => 'submit',
        '#value' => t('Delete'),
        '#submit' => array(
          'boxes_block_delete_submit',
        ),
      );
    }

    // Cancel behavior is different on admin/structure page
    unset($form['settings']['cancel']);
    $form['actions']['cancel'] = array(
      '#type' => 'submit',
      '#value' => t('Cancel'),
      '#submit' => array(
        'boxes_block_cancel_submit',
      ),
    );
  }
}