public function SocialContent::getForm in Social Content 7.2
Get an internal form of the gievn type.
Parameters
string $type: The type of form to get.
Return value
array A structured form array.
File
- ./
social_content.class.inc, line 105 - Social Content class.
Class
- SocialContent
- TODO: Table names should be a property for ease of change Separate this class into smaller classes.
Code
public function getForm($type) {
$settings = array_merge($this->settings['global'], $this->settings['instance']);
$fieldset_name = $this
->getFormRootElementKey();
$machine_name = $this
->getMachineName();
$form[$fieldset_name] = array(
'#type' => 'fieldset',
'#title' => $this
->getLabel(),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE,
);
$form[$fieldset_name][$machine_name] = array();
if ($type == 'global') {
$form[$fieldset_name][$machine_name] = $this
->globalSettingsForm();
}
if ($type == 'instance') {
$form[$fieldset_name][$machine_name] = $this
->instanceSettingsForm();
if (!isset($settings['id'])) {
$this
->applyGlobalTemplate($form[$fieldset_name][$machine_name]);
}
}
$form[$fieldset_name]['type'] = array(
'#type' => 'hidden',
'#value' => $type,
);
// Allow modules to attach their fields so they can be save later on.
drupal_alter('social_content_settings', $type, $form[$fieldset_name][$machine_name], $settings);
return $form;
}