function easy_social_admin_config_main in Easy Social 7.2
Form callback. Main settings form.
See also
1 string reference to 'easy_social_admin_config_main'
- easy_social_menu in ./
easy_social.module - Implements hook_menu().
File
- includes/
easy_social.admin.inc, line 13 - Easy Social admin settings.
Code
function easy_social_admin_config_main() {
$form = array();
// Global Settings.
$form['global_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Global Settings'),
'#description' => t('Global settings for all widgets'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['global_settings']['easy_social_global_type'] = array(
'#type' => 'radios',
'#title' => t('Type of buttons'),
'#options' => array(
EASY_SOCIAL_WIDGET_HORIZONTAL => t('Horizontal'),
EASY_SOCIAL_WIDGET_VERTICAL => t('Vertical'),
),
'#default_value' => variable_get_value('easy_social_global_type'),
);
$options = _easy_social_get_options();
$form['global_settings']['easy_social_global_widgets'] = array(
'#type' => 'checkboxes',
'#title' => t('Social Widgets'),
'#options' => $options,
'#default_value' => variable_get_value('easy_social_global_widgets'),
);
// Block settings.
$form['block_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Block Settings'),
'#description' => t('Custom settings for Blocks'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$num_blocks = variable_get_value('easy_social_block_count');
$form['block_settings']['easy_social_block_count'] = array(
'#type' => 'select',
'#title' => t('Number of Easy Social blocks'),
'#description' => t('You can create up to !num Easy Social blocks. Please save and refresh the page to see the settings for each additional block.', array(
'!num' => EASY_SOCIAL_BLOCK_MAX,
)),
'#options' => range(0, EASY_SOCIAL_BLOCK_MAX),
'#default_value' => $num_blocks,
);
for ($i = 1; $i <= $num_blocks; ++$i) {
$form['block_settings']["easy_social_block_{$i}"] = array(
'#type' => 'fieldset',
'#title' => t('Custom Settings for Block #!num', array(
'!num' => $i,
)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['block_settings']["easy_social_block_{$i}"]["easy_social_block_{$i}_title"] = array(
'#type' => 'textfield',
'#title' => t('Block title'),
'#description' => t("Leave this blank if you don't want this block to have a title."),
'#maxlength' => 255,
'#default_value' => variable_get_value("easy_social_block_{$i}_title"),
);
$form['block_settings']["easy_social_block_{$i}"]["easy_social_block_{$i}_override"] = array(
'#type' => 'checkbox',
'#title' => t('Override settings for this block'),
'#description' => t('Check this option to override the global settings for this block'),
'#default_value' => variable_get_value("easy_social_block_{$i}_override"),
);
$form['block_settings']["easy_social_block_{$i}"]['override'] = array(
'#type' => 'container',
'#states' => array(
'invisible' => array(
"input[name=\"easy_social_block_{$i}_override\"]" => array(
'checked' => FALSE,
),
),
),
);
$form['block_settings']["easy_social_block_{$i}"]['override']["easy_social_block_{$i}_type"] = array(
'#type' => 'radios',
'#title' => t('Widget Type'),
'#options' => array(
EASY_SOCIAL_WIDGET_HORIZONTAL => t('Horizontal'),
EASY_SOCIAL_WIDGET_VERTICAL => t('Vertical'),
),
'#default_value' => _easy_social_variable_get_value("easy_social_block_{$i}_type"),
);
$form['block_settings']["easy_social_block_{$i}"]['override']["easy_social_block_{$i}_widgets"] = array(
'#type' => 'checkboxes',
'#title' => t('Enabled Widgets'),
'#options' => $options,
'#default_value' => _easy_social_variable_get_value("easy_social_block_{$i}_widgets"),
);
$form['block_settings']["easy_social_block_{$i}"]['override']["easy_social_block_{$i}_share_title"] = array(
'#type' => 'textfield',
'#title' => t('Custom Share Title for Social Widgets'),
'#description' => t("By Default, Easy Social uses the site_name variable as the share title. Setting this overrides the default using tokens. (You can use [current-page:title] to share using the title of the current page)."),
'#maxlength' => 255,
'#default_value' => variable_get("easy_social_block_{$i}_share_title", ""),
);
$form['block_settings']["easy_social_block_{$i}"]['override']['urls'] = array(
'#type' => 'fieldset',
'#title' => t('Custom URLs for this block'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$widgets_block = _easy_social_variable_get_value("easy_social_block_{$i}_widgets");
//Not using variable_get_value because of a problem in accessing all the widgets available
//with easy_social_get_widgets in the implementation of hook_variable_info
foreach ($widgets_block as $widget_block) {
if ((bool) $widget_block !== FALSE) {
$form['block_settings']["easy_social_block_{$i}"]['override']['urls']["easy_social_block_{$i}_url_{$widget_block}"] = array(
'#type' => 'textfield',
'#title' => t('Custom URL for widget !widget', array(
'!widget' => $widget_block,
)),
'#description' => t("Leave this blank or [current-path] for the current path, [base-url] for the base url, or place an internal drupal path, or even a full external URL e.g. http://external.com/myurl"),
'#maxlength' => 255,
'#default_value' => variable_get("easy_social_block_{$i}_url_{$widget_block}", "[current-path]"),
);
}
}
}
return system_settings_form($form);
}