Révision 66b5cbf6
Ajouté par Assos Assos il y a presque 10 ans
drupal7/sites/all/modules/twitter_block/twitter_block.admin.inc | ||
---|---|---|
17 | 17 |
$form = block_admin_configure($form, $form_state, 'twitter_block', NULL); |
18 | 18 |
|
19 | 19 |
// Other modules should be able to use hook_form_block_add_block_form_alter() |
20 |
// to modify this form, so add a base form ID |
|
20 |
// to modify this form, so add a base form ID.
|
|
21 | 21 |
$form_state['build_info']['base_form_id'] = 'block_add_block_form'; |
22 | 22 |
|
23 | 23 |
// Prevent block_add_block_form_validate/submit() from being automatically |
24 |
// added because of the base form ID by providing these handlers manually |
|
24 |
// added because of the base form ID by providing these handlers manually.
|
|
25 | 25 |
$form['#validate'] = array('twitter_block_add_block_form_validate'); |
26 | 26 |
$form['#submit'] = array('twitter_block_add_block_form_submit'); |
27 | 27 |
|
... | ... | |
71 | 71 |
'polite' => $form_state['values']['polite'], |
72 | 72 |
); |
73 | 73 |
|
74 |
// Save the block configuration |
|
74 |
// Save the block configuration.
|
|
75 | 75 |
$delta = db_insert('twitter_block') |
76 | 76 |
->fields(array( |
77 | 77 |
'info' => $form_state['values']['info'], |
78 | 78 |
'widget_id' => $form_state['values']['widget_id'], |
79 |
'username' => $form_state['values']['username'], |
|
79 | 80 |
'data' => serialize($data), |
80 | 81 |
)) |
81 | 82 |
->execute(); |
82 | 83 |
|
83 |
// Store block delta to allow other modules to work with new block |
|
84 |
// Store block delta to allow other modules to work with new block.
|
|
84 | 85 |
$form_state['values']['delta'] = $delta; |
85 | 86 |
|
86 |
// Run the normal new block submission (borrowed from block_add_block_form_submit) |
|
87 |
// Run the normal new block submission (borrowed from block_add_block_form_submit).
|
|
87 | 88 |
$query = db_insert('block')->fields(array('visibility', 'pages', 'custom', 'title', 'module', 'theme', 'status', 'weight', 'delta', 'cache')); |
88 | 89 |
foreach (list_themes() as $key => $theme) { |
89 | 90 |
if ($theme->status) { |
... | ... | |
113 | 114 |
} |
114 | 115 |
$query->execute(); |
115 | 116 |
|
116 |
// Store regions per theme for this block |
|
117 |
// Store regions per theme for this block.
|
|
117 | 118 |
foreach ($form_state['values']['regions'] as $theme => $region) { |
118 | 119 |
db_merge('block') |
119 | 120 |
->key(array('theme' => $theme, 'delta' => $delta, 'module' => $form_state['values']['module'])) |
Formats disponibles : Unified diff
Weekly update of contrib modules