You are here

function panels_admin_fix_block_tree in Panels 6.2

Same name and namespace in other branches
  1. 5.2 content_types/block.inc \panels_admin_fix_block_tree()

Because form api cannot collapse just part of a tree, and the block settings assume no tree, we have to collapse the tree ourselves.

1 call to panels_admin_fix_block_tree()
panels_admin_edit_block in content_types/block.inc
Returns an edit form for a block.

File

content_types/block.inc, line 183

Code

function panels_admin_fix_block_tree(&$form, $key = NULL) {
  if ($key) {
    if (!empty($form['#parents'])) {
      $form['#parents'] = array_merge(array(
        'configuration',
        'block_settings',
      ), $form['#parents']);
    }
    else {
      if (empty($form['#tree'])) {
        $form['#parents'] = array(
          'configuration',
          'block_settings',
          $key,
        );
      }
    }
  }
  if (isset($form['#type']) && $form['#type'] == 'textarea' && !empty($form['#rows']) && $form['#rows'] > 10) {
    $form['#rows'] = 10;
  }
  foreach (element_children($form) as $key) {
    panels_admin_fix_block_tree($form[$key], $key);
  }
}