You are here

function block_patterns_params in Patterns 7

File

patterns_components/components/block.inc, line 266

Code

function block_patterns_params($action, $form_id, &$data, &$a) {
  if ($form_id == 'block_admin_configure') {
    $result = array(
      $data['module'],
      $data['delta'],
    );
  }
  elseif ($form_id == 'block_admin_display_form') {
    $blocks = _block_rehash();

    // TODO: Haven't we done this before?
    $check = end($data);

    // Only return the block we are dealing with now
    foreach ($blocks as $key => &$block) {

      // TODO: is there a function for this?
      if ($block['module'] == $check['module'] && $block['delta'] == $check['delta']) {
        $blocks = array(
          &$check,
        );
        break;
      }
    }
    $result = array(
      $blocks,
      $check['theme'],
    );
  }
  elseif ($form_id == 'block_custom_block_delete') {
    $result = array(
      'block',
      $data['delta'],
    );
  }
  return patterns_results(PATTERNS_SUCCESS, t('Execution successful'), $result);
}