function authcache_example_block_form in Authenticated User Page Caching (Authcache) 7
Same name and namespace in other branches
- 6 modules/authcache_example/authcache_example.module \authcache_example_block_form()
Form to modify user's block
1 string reference to 'authcache_example_block_form'
- authcache_example_menu in modules/
authcache_example/ authcache_example.module - Implents hook_menu()
File
- modules/
authcache_example/ authcache_example.module, line 59 - authcache_example.module
Code
function authcache_example_block_form($form, &$form_state, $account) {
// Retrieve the block if there is any
$block = db_query("SELECT block_text, uid FROM {authcache_example} WHERE uid = :uid", array(
':uid' => $account->uid,
))
->fetchObject();
// Hold on to the block
$form_state['storage']['authcache_block'] = empty($block) ? FALSE : $block;
$form['block_text'] = array(
'#title' => 'Your Custom Block Text',
'#type' => 'textarea',
'#default_value' => $block && $block->block_text ? $block->block_text : '',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => $block ? 'Update' : 'Save',
);
return $form;
}