function template_preprocess_block_admin_display_form

Processes variables for block-admin-display-form.tpl.php.

The $variables array contains the following arguments:

  • $form

See also

block-admin-display.tpl.php

theme_block_admin_display()

1 call to template_preprocess_block_admin_display_form()
template_preprocess_dashboard_admin_display_form in modules/dashboard/dashboard.module
Preprocesses variables for block-admin-display-form.tpl.php.

File

modules/block/block.admin.inc, line 662

Code

function template_preprocess_block_admin_display_form(&$variables) {
    $variables['block_regions'] = $variables['form']['block_regions']['#value'];
    if (isset($variables['block_regions'][BLOCK_REGION_NONE])) {
        $variables['block_regions'][BLOCK_REGION_NONE] = t('Disabled');
    }
    foreach ($variables['block_regions'] as $key => $value) {
        // Initialize an empty array for the region.
        $variables['block_listing'][$key] = array();
    }
    // Initialize disabled blocks array.
    $variables['block_listing'][BLOCK_REGION_NONE] = array();
    // Add each block in the form to the appropriate place in the block listing.
    foreach (element_children($variables['form']['blocks']) as $i) {
        $block =& $variables['form']['blocks'][$i];
        // Fetch the region for the current block.
        $region = isset($block['region']['#default_value']) ? $block['region']['#default_value'] : BLOCK_REGION_NONE;
        // Set special classes needed for table drag and drop.
        $block['region']['#attributes']['class'] = array(
            'block-region-select',
            'block-region-' . $region,
        );
        $block['weight']['#attributes']['class'] = array(
            'block-weight',
            'block-weight-' . $region,
        );
        $variables['block_listing'][$region][$i] = new stdClass();
        $variables['block_listing'][$region][$i]->row_class = !empty($block['#attributes']['class']) ? implode(' ', $block['#attributes']['class']) : '';
        $variables['block_listing'][$region][$i]->block_modified = !empty($block['#attributes']['class']) && in_array('block-modified', $block['#attributes']['class']);
        $variables['block_listing'][$region][$i]->block_title = drupal_render($block['info']);
        $variables['block_listing'][$region][$i]->region_select = drupal_render($block['region']) . drupal_render($block['theme']);
        $variables['block_listing'][$region][$i]->weight_select = drupal_render($block['weight']);
        $variables['block_listing'][$region][$i]->configure_link = drupal_render($block['configure']);
        $variables['block_listing'][$region][$i]->delete_link = !empty($block['delete']) ? drupal_render($block['delete']) : '';
        $variables['block_listing'][$region][$i]->printed = FALSE;
    }
    $variables['form_submit'] = drupal_render_children($variables['form']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.