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 | |
// Assume $arguments can contain any node on the site... | |
$nodes = node_load_multiple($arguments); | |
foreach ($nodes as $node) { | |
$options[$node->nid] = $node->title; | |
} | |
$form['test1'] = array( | |
'#type' => 'select' | |
'#options' => $options, | |
); |
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 | |
/** | |
* Provides an API function to load/tweak a user's name. | |
* Called by a module which has already checked permission and the validity of the $uid. | |
*/ | |
function example_module_usertweak($uid) { | |
global $user; | |
drupal_set_message(t('Thanks, @user, for tweaking this!', array('@user' => $user->name)); | |
// Save the original user. |
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 example_module_menu() { | |
// Allow admins to delete a comment at /example-delete-comment/CID. | |
$items['example-delete-comment'] = array( | |
'title' => t('Delete a comment'), | |
'page callback' => 'example_module_callback', | |
'access arguments' => array('administer comments'), |
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 example_module_menu() { | |
$items['example-search-callback'] = array( | |
'title' => t('Node search'), | |
'page callback' => 'example_module_callback', | |
'access callback' => TRUE, | |
'type' => MENU_CALLBACK | |
); | |
return $items; |
NewerOlder