You are here

function panopoly_magic_panelizer_pre_render in Panopoly Magic 7

Implement the "Content Settings" fieldset in a pre-render. This fixes issues with image caused by initially doing this in a form_alter.

See also

http://drupal.org/node/1567704

1 string reference to 'panopoly_magic_panelizer_pre_render'
panopoly_magic_form_ctools_entity_field_content_type_formatter_options_alter in ./panopoly_magic.module
Implementation of hook_form_FORM_ID_alter()

File

./panopoly_magic.module, line 1314

Code

function panopoly_magic_panelizer_pre_render($element) {
  $exclude_list = array(
    'form_id',
    'form_token',
    'form_build_id',
    'buttons',
  );

  // Add any remaining fields to the content settings fieldset.
  foreach (element_children($element) as $key) {
    $value = $element[$key];
    if (!in_array($key, $exclude_list) && !empty($value['#type']) && $value['#type'] != 'fieldset') {
      if (empty($element['content_settings'])) {

        // Add a content settings fieldset.
        $element['content_settings'] = array(
          '#type' => 'fieldset',
          '#title' => t('Content Settings'),
          '#weight' => 1,
        );
      }
      $element['content_settings'][$key] = $value;
      unset($element[$key]);
    }
  }
  return $element;
}