printfriendly.admin.inc in PrintFriendly & PDF 7
Same filename and directory in other branches
Administrative page callbacks for Service Links module.
File
printfriendly.admin.incView source
<?php
/**
* @file
* Administrative page callbacks for Service Links module.
*/
/**
* Menu callback administration settings for general options.
*/
function printfriendly_admin_settings() {
if (substr($_SERVER['REMOTE_ADDR'], 0, 4) == '127.' || $_SERVER['REMOTE_ADDR'] == '::1') {
drupal_set_message(t('It appears that your site is running on a local
server. PrintFriendly service requires a remotely-accessible web site
to function.'), 'warning', FALSE);
}
$form['printfriendly_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Content Types'),
'#description' => t('Configure where the printfriendly button should appear.'),
'#options' => node_type_get_names(),
'#default_value' => variable_get('printfriendly_types', array()),
);
$form['printfriendly_display'] = array(
'#type' => 'checkboxes',
'#title' => t('Button display'),
'#description' => t('Select content displays that the button should appear.'),
'#options' => array(
'teaser' => t('Teaser'),
'full' => t('Full content page'),
),
'#default_value' => array_filter(variable_get('printfriendly_display', array())),
);
$img_path = drupal_get_path('module', 'printfriendly') . '/images';
$results = file_scan_directory($img_path, '/^.*\\.(gif|png|jpg|GIF|PNG|JPG)$/');
$options = array();
foreach ($results as $image) {
$options[$image->filename] = theme('image', array(
'path' => $image->uri,
));
}
ksort($options);
$options['_text_'] = t('Text link');
$form['printfriendly_image'] = array(
'#type' => 'radios',
'#title' => t('Choose button'),
'#options' => $options,
'#default_value' => variable_get('printfriendly_image', 'button-print-grnw20.png'),
);
$form['printfriendly_text'] = array(
'#type' => 'textfield',
'#title' => t('PrintFriendly text link title'),
'#default_value' => variable_get('printfriendly_text', t('Print this page')),
'#description' => t('This text will be used instead of the image button. You can further style the link by adding custom CSS.'),
'#states' => array(
'visible' => array(
':input[name="printfriendly_image"]' => array(
'value' => '_text_',
),
),
),
);
$form['support-link'] = array(
'#markup' => t('Need help or have suggestions? !support-email.', array(
'!support-email' => l(t('Support@PrintFriendly.com'), 'mailto:support@printfriendly.com', array(
'absolute' => TRUE,
'query' => array(
'subject' => 'Support for PrintFriendly Drupal module',
),
)),
)),
'#weight' => 1000,
);
return system_settings_form($form);
}
Functions
Name | Description |
---|---|
printfriendly_admin_settings | Menu callback administration settings for general options. |