function fb_social_presets_ui_form in Facebook social plugins integration 7.2
Same name and namespace in other branches
- 6.2 plugins/export_ui/fb_social_presets_ui.inc \fb_social_presets_ui_form()
The preset add/edit form
File
- plugins/
export_ui/ fb_social_presets_ui.inc, line 44
Code
function fb_social_presets_ui_form(&$form, &$form_state) {
ctools_include('dependent');
$export = $form_state['item'];
$form['description'] = array(
'#title' => t('description'),
'#type' => 'textfield',
'#default_value' => !empty($export->description) ? $export->description : '',
'#description' => t('Description for this preset.'),
);
$all_plugins = fb_social_fb_plugin_load();
$options = array();
foreach ($all_plugins as $plugin) {
$options[$plugin['name']] = $plugin['description'];
}
$form['fb_plugin_type'] = array(
'#type' => 'fieldset',
'#title' => t('Facebook plugin type'),
'#collapsible' => TRUE,
'#tree' => TRUE,
);
$form['fb_plugin_type']['plugin_type'] = array(
'#title' => t('type'),
'#type' => 'radios',
'#options' => $options,
'#default_value' => !empty($export->plugin_type) ? $export->plugin_type : 'like',
'#description' => t('Description for this preset.'),
);
// output all form settings here but show/hide using
// ctools 'dependent' plugin
foreach ($all_plugins as $type => $plugin) {
// fb settings
$id = 'fb_social-settings-' . $type;
$wrapper_id = $id . '-wrapper';
$form['fb_social_settings_' . $type] = array(
'#type' => 'fieldset',
'#title' => t('%description - settings', array(
'%description' => $plugin['description'],
)),
'#input' => TRUE,
'#process' => array(
'ctools_dependent_process',
),
'#dependency' => array(
'radio:fb_plugin_type[plugin_type]' => array(
$type,
),
),
'#id' => $id,
'#prefix' => '<div id="' . $wrapper_id . '">',
'#suffix' => '</div>',
'#collapsible' => TRUE,
'#tree' => TRUE,
);
// facebook attrs
$form['fb_social_settings_' . $type]['fb_attrs_' . $type] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#title' => 'Fb plugin attributes',
);
$form['fb_social_settings_' . $type]['fb_attrs_' . $type] += fb_social_fb_plugin_fb_settings_form($type, $export->fb_attrs);
// drupal settings
$form['fb_social_settings_' . $type]['settings_' . $type] = array(
'#type' => 'fieldset',
'#title' => 'Drupal settings',
'#collapsible' => TRUE,
);
//$form['fb_social_settings_' . $type]['settings_' . $type] += fb_social_fb_plugin_drupal_settings_form($type, $export->settings);
$fb_attrs_form = fb_social_fb_plugin_drupal_settings_form($type, $export->settings);
foreach ($fb_attrs_form as $k => $v) {
$form['fb_social_settings_' . $type]['settings_' . $type][$k] = $v;
}
$form['fb_social_settings_' . $type]['settings_' . $type] += _fb_social_presets_ui_create_block_form($export);
}
}