Created
November 17, 2014 22:07
-
-
Save nalipaz/d99e3bd821ca4b097023 to your computer and use it in GitHub Desktop.
Programmatically save block admin form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ccs_deploy_update_7108() { | |
$beans = array( | |
'popular-brands', | |
'popular-courses', | |
'featured-prizes', | |
'user-testimonials', | |
'globalcs-get-started-button' | |
); | |
$weight = 2; | |
$form_state = array(); | |
form_load_include($form_state, 'inc', 'block', 'block.admin'); | |
foreach ($beans as $delta) { | |
$form_state = array(); | |
$form_state['values'] = array( | |
'title' => '<none>', | |
'info' => $description, | |
'visibility' => '1', | |
'pages' => '<front>', | |
'custom' => '0', | |
'cache_block' => '1', | |
'regions' => array( | |
'globalcs' => 'content', | |
'icsboot' => '-1', | |
'seven' => '-1', | |
'ccs_vhp' => '-1', | |
'bootstrap' => '-1', | |
'bartik' => '-1', | |
), | |
); | |
// Submit the form programmatically. | |
drupal_form_submit('block_admin_configure', $form_state); | |
$weight++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment