function blogapi_admin_settings in Blog API 7
Add some settings to the admin_settings form.
1 string reference to 'blogapi_admin_settings'
- blogapi_menu in ./
blogapi.module - Implement hook_menu().
File
- ./
blogapi.module, line 772 - Enable users to post using applications that support XML-RPC blog APIs.
Code
function blogapi_admin_settings() {
$node_types = array_map('check_plain', node_type_get_names());
$defaults = isset($node_types['blog']) ? array(
'blog' => 'blog',
) : array();
$form['blogapi_node_types'] = array(
'#type' => 'checkboxes',
'#title' => t('Enable for external blogging clients'),
'#required' => TRUE,
'#default_value' => variable_get('blogapi_node_types', $defaults),
'#options' => $node_types,
'#description' => t('Select the content types available to external blogging clients via Blog API. If supported, each enabled content type will be displayed as a separate "blog" by the external client.'),
);
$blogapi_extensions_default = variable_get('blogapi_extensions_default', 'jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp');
$blogapi_uploadsize_default = variable_get('blogapi_uploadsize_default', 1);
$blogapi_usersize_default = variable_get('blogapi_usersize_default', 1);
$form['settings_general'] = array(
'#type' => 'fieldset',
'#title' => t('File settings'),
'#collapsible' => TRUE,
);
$form['settings_general']['blogapi_extensions_default'] = array(
'#type' => 'textfield',
'#title' => t('Default permitted file extensions'),
'#default_value' => $blogapi_extensions_default,
'#maxlength' => 255,
'#description' => t('Default extensions that users can upload. Separate extensions with a space and do not include the leading dot.'),
);
$form['settings_general']['blogapi_uploadsize_default'] = array(
'#type' => 'textfield',
'#title' => t('Default maximum file size per upload'),
'#default_value' => $blogapi_uploadsize_default,
'#size' => 5,
'#maxlength' => 5,
'#description' => t('The default maximum file size a user can upload.'),
'#field_suffix' => t('MB'),
);
$form['settings_general']['blogapi_usersize_default'] = array(
'#type' => 'textfield',
'#title' => t('Default total file size per user'),
'#default_value' => $blogapi_usersize_default,
'#size' => 5,
'#maxlength' => 5,
'#description' => t('The default maximum size of all files a user can have on the site.'),
'#field_suffix' => t('MB'),
);
$form['settings_general']['upload_max_size'] = array(
'#value' => '<p>' . t('Your PHP settings limit the maximum file size per upload to %size.', array(
'%size' => format_size(file_upload_max_size()),
)) . '</p>',
);
$roles = user_roles(FALSE, 'administer content with blog api');
$form['roles'] = array(
'#type' => 'value',
'#value' => $roles,
);
foreach ($roles as $rid => $role) {
$form['settings_role_' . $rid] = array(
'#type' => 'fieldset',
'#title' => t('Settings for @role role', array(
'@role' => $role,
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['settings_role_' . $rid]['blogapi_extensions_' . $rid] = array(
'#type' => 'textfield',
'#title' => t('Permitted file extensions'),
'#default_value' => variable_get('blogapi_extensions_' . $rid, $blogapi_extensions_default),
'#maxlength' => 255,
'#description' => t('Extensions that users in this role can upload. Separate extensions with a space and do not include the leading dot.'),
);
$form['settings_role_' . $rid]['blogapi_uploadsize_' . $rid] = array(
'#type' => 'textfield',
'#title' => t('Maximum file size per upload'),
'#default_value' => variable_get('blogapi_uploadsize_' . $rid, $blogapi_uploadsize_default),
'#size' => 5,
'#maxlength' => 5,
'#description' => t('The maximum size of a file a user can upload (in megabytes).'),
'#field_suffix' => t('MB'),
);
$form['settings_role_' . $rid]['blogapi_usersize_' . $rid] = array(
'#type' => 'textfield',
'#title' => t('Total file size per user'),
'#default_value' => variable_get('blogapi_usersize_' . $rid, $blogapi_usersize_default),
'#size' => 5,
'#maxlength' => 5,
'#description' => t('The maximum size of all files a user can have on the site (in megabytes).'),
'#field_suffix' => t('MB'),
);
}
return system_settings_form($form, FALSE);
}