You are here

function boxes_form_block_admin_display_form_alter in Boxes 6

Same name and namespace in other branches
  1. 7 boxes.module \boxes_form_block_admin_display_form_alter()

Alters the block admin form to add delete links next to boxes blocks.

File

./boxes.module, line 363

Code

function boxes_form_block_admin_display_form_alter(&$form, $form_state) {
  foreach (element_children($form) as $i) {
    if (isset($form[$i]['module']['#value']) && $form[$i]['module']['#value'] == 'boxes') {
      $delta = $form[$i]['delta']['#value'];
      if (strpos($delta, 'boxes_add__') !== 0) {
        $box = boxes_load($delta);
        if ($box->export_type & EXPORT_IN_DATABASE && $box->export_type & EXPORT_IN_CODE) {
          $form[$i]['delete'] = array(
            '#value' => l(t('revert'), 'admin/build/block/configure/boxes/' . $delta . '/delete'),
          );
        }
        elseif (!($box->export_type & EXPORT_IN_CODE)) {
          $form[$i]['delete'] = array(
            '#value' => l(t('delete'), 'admin/build/block/configure/boxes/' . $delta . '/delete'),
          );
        }
      }
    }
  }
}