function dashboard_update
dashboard_update()
Sets the new weight of each region according to the drag-and-drop order.
File
- modules/dashboard/dashboard.module, line 543
- Provides a dashboard page in the administrative interface.
Code
function dashboard_update() { drupal_theme_initialize(); global $theme_key; // Check the form token to make sure we have a valid request. if (!empty($_REQUEST['form_token']) && drupal_valid_token($_REQUEST['form_token'], 'dashboard-update')) { parse_str($_REQUEST['regions'], $regions); foreach ($regions as $region_name => $blocks) { if ($region_name == 'disabled_blocks') { $region_name = 'dashboard_inactive'; } foreach ($blocks as $weight => $block_string) { // Parse the query string to determine the block's module and delta. preg_match('/block-([^-]+)-(.+)/', $block_string, $matches); $block = new stdClass(); $block->module = $matches[1]; $block->delta = $matches[2]; $block->region = $region_name; $block->weight = $weight; $block->status = 1; db_merge('block') ->key(array( 'module' => $block->module, 'delta' => $block->delta, 'theme' => $theme_key, )) ->fields(array( 'status' => $block->status, 'weight' => $block->weight, 'region' => $block->region, 'pages' => '', )) ->execute(); } } drupal_set_message(t('The configuration options have been saved.'), 'status', FALSE); } drupal_exit(); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!dashboard!dashboard.module/function/dashboard_update/7.x