function socialmedia_admin_profile_widgets_form in Social media 7
1 call to socialmedia_admin_profile_widgets_form()
- socialmedia_setup_2_form in ./
socialmedia.setup.inc - Select social media profiles
1 string reference to 'socialmedia_admin_profile_widgets_form'
- socialmedia_menu in ./
socialmedia.module - Implements hook_menu().
File
- ./
socialmedia.admin.inc, line 445 - Admin page callback for the socialmedia module.
Code
function socialmedia_admin_profile_widgets_form($form, $form_state) {
require_once drupal_get_path('module', 'socialmedia') . '/socialmedia.tokens.inc';
drupal_set_title(t('Social media profile widget'));
$instructions = t('The profile widget provides a set of buttons that link to your social profiles. Check each platform you want displayed in your default profile widget set. You can edit and change the sort order later.');
$instructions2 = t('Only platforms that you have entered profile information for can be enabled. To enable additional profiles, !profiles_link. To place the widget set on your site and for additional configuration settings, !widget_link.', array(
'!profiles_link' => l(t('visit the profile settings page'), 'admin/config/media/socialmedia/profiles'),
'!widget_link' => l(t('visit the profile widget set configuration page'), 'admin/structure/widgets/sets/edit/socialmedia_profile-default'),
));
$form['instructions'] = array(
'#markup' => '<p>' . $instructions . '</p>',
);
$form['instructions2'] = array(
'#markup' => '<p>' . $instructions2 . '</p>',
);
$form['setup_mode'] = array(
'#type' => 'value',
'#value' => 1,
);
$form['#tree'] = TRUE;
$defs = socialmedia_widgets_set_profile_default_elements();
$set = variable_get('socialmedia_widget_set_default_profile', socialmedia_widgets_set_profile_default());
foreach ($defs as $group => $defs2) {
$form[$group] = array(
'#type' => 'fieldset',
'#title' => filter_xss($defs2['name']),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$weight = 0;
foreach ($defs2['elements'] as $key => $element) {
$def = widgets_element_definition_load($element['name']);
if (isset($element['data'])) {
$def['data'] = $element['data'];
}
$vars = array(
'element' => $def,
);
$form[$group][$element['name']] = array(
'#type' => 'checkbox',
'#field_prefix' => theme('widgets_element_view', $vars),
'#title' => t('Include @widget.', array(
'@widget' => $def['label'],
)),
'#return_value' => $element['name'],
'#default_value' => socialmedia_element_in_set($element, $set) ? $key : 0,
'#weight' => isset($defs['basic']['elements'][$key]['weight']) ? $defs['basic']['elements'][$key]['weight'] : 0,
);
$weight++;
}
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save profile widget buttons'),
);
return $form;
}