function tweet_admin in Tweet 5.2
Same name and namespace in other branches
- 5 tweet.module \tweet_admin()
- 6.4 tweet.admin.inc \tweet_admin()
- 6.2 tweet.admin.inc \tweet_admin()
- 6.3 tweet.admin.inc \tweet_admin()
- 7.4 tweet.admin.inc \tweet_admin()
Settings page.
1 string reference to 'tweet_admin'
- tweet_menu in ./
tweet.module - Implementation of hook_menu().
File
- ./
tweet.module, line 333 - Builds links to post pages to twitter.
Code
function tweet_admin() {
$form['node_type'] = array(
'#type' => 'select',
'#title' => t('Type of link to show on nodes'),
'#default_value' => variable_get('tweet_node', 'icon'),
'#options' => array(
'icon' => 'icon',
'icon_text' => 'icon_text',
'text' => 'text',
'none' => 'none',
),
);
$form['teaser_type'] = array(
'#type' => 'select',
'#title' => t('Type of link to show on teasers'),
'#default_value' => variable_get('tweet_teaser', 'none'),
'#options' => array(
'icon' => 'icon',
'icon_text' => 'icon_text',
'text' => 'text',
'none' => 'none',
),
);
$form['tweet_new_window'] = array(
'#type' => 'radios',
'#title' => t('Open Twitter'),
'#default_value' => variable_get('tweet_new_window', 'target'),
'#options' => array(
0 => t('In same window'),
'target' => t('In new window with target="_blank" (not XHTML 1.0 Strict compliant)'),
'js' => t('In new window with JavaScript'),
),
);
$methods = array();
if (function_exists('file_get_contents')) {
$methods['php'] = t('PHP');
}
if (function_exists('curl_exec')) {
$methods['curl'] = t('cURL');
}
if (empty($methods)) {
if (variable_get('tweet_method', 'curl') != 'none') {
variable_set('tweet_method', 'none');
}
$form['tweet_method'] = array(
'#type' => 'radios',
'#title' => t('Method'),
'#description' => '<p>' . t('The method to use to retrieve the abbreviated URL.') . '</p>' . '<p><strong>' . t('Your PHP installation does not support the URL abbreviation feature of the Tweet module.') . '</strong> ' . t('You must compile PHP with either the cURL library or the file_get_contents() function to use this option.') . '</p>',
'#default_value' => 'none',
'#options' => array(
'none' => t('None'),
),
'#disabled' => TRUE,
);
$form['tweet_service'] = array(
'#type' => 'radios',
'#title' => t('Service'),
'#description' => t('The service to use to create the abbreviated URL.'),
'#default_value' => 'none',
'#options' => array(
'none' => t('None'),
),
);
$form['tweet_service_backup'] = array(
'#type' => 'radios',
'#title' => t('Backup Service'),
'#description' => t('The service to use to create the abbreviated URL if the primary service is down.'),
'#default_value' => 'none',
'#options' => array(
'none' => t('None'),
),
);
}
else {
$form['tweet_method'] = array(
'#type' => 'radios',
'#title' => t('Method'),
'#description' => t('The method to use to retrieve the abbreviated URL.'),
'#default_value' => variable_get('tweet_method', 'curl'),
'#options' => $methods,
);
$all_services = module_invoke_all('tweet_service', $original);
$services = array();
foreach ($all_services as $key => $value) {
$services[$key] = $key;
}
$services['none'] = t('None');
$form['tweet_service'] = array(
'#type' => 'select',
'#title' => t('Service'),
'#description' => t('The service to use to create the abbreviated URL.'),
'#default_value' => variable_get('tweet_service', 'is.gd'),
'#options' => $services,
);
$form['tweet_service_backup'] = array(
'#type' => 'select',
'#title' => t('Backup Service'),
'#description' => t('The service to use to create the abbreviated URL if the primary service is down.'),
'#default_value' => variable_get('tweet_service_backup', 'TinyURL'),
'#options' => $services,
);
}
$node_types = variable_get('tweet_types', array());
//If all types are selected, un-select them, because the system will still save the result as all selected and it looks better.
if ($node_types == _tweet_node_types()) {
$node_types = array();
}
$form['types'] = array(
'#type' => 'select',
'#multiple' => TRUE,
'#title' => t('Node types on which to display link'),
'#description' => t('If no types are selected, the link will appear on all types. To stop links from appearing on all nodes, choose "none" in the teaser and node display options above.'),
'#default_value' => $node_types,
'#options' => _tweet_node_types(),
);
$image_location = drupal_get_path('module', 'tweet') . '/icon.png';
$form['tweet_image'] = array(
'#type' => 'textfield',
'#title' => t('Image'),
'#description' => t('Enter the URL for the image you want to show up if you allow images to appear in your links, relative to your Drupal installation. Ex.: sites/all/modules/tweet/icon.png'),
'#default_value' => variable_get('tweet_image', $image_location),
);
$form['tweet_exclude'] = array(
'#type' => 'textfield',
'#title' => t('Exclude nodes'),
'#description' => t('Enter the NIDs of nodes which should not have Tweet links, separated by commas.'),
'#default_value' => variable_get('tweet_exclude', ''),
);
$form['tweet_format'] = array(
'#type' => 'textfield',
'#title' => t('Format'),
'#description' => t('Manipulate the elements of the tweet by changing their order, removing them, or adding them (like hashtags). You can use the case-insensitive tokens [url] and [title].'),
'#maxlength' => 140,
'#default_value' => variable_get('tweet_format', '[url] [title]'),
);
return system_settings_form($form);
}