You are here

protected function SocialContent::applyGlobalTemplate in Social Content 7.2

Apply global template to instance.

1 call to SocialContent::applyGlobalTemplate()
SocialContent::getForm in ./social_content.class.inc
Get an internal form of the gievn type.

File

./social_content.class.inc, line 156
Social Content class.

Class

SocialContent
TODO: Table names should be a property for ease of change Separate this class into smaller classes.

Code

protected function applyGlobalTemplate(&$form, $settings = array()) {
  if (empty($settings)) {
    $settings = isset($this->settings['global']['instance_template']) ? $this->settings['global']['instance_template'] : array();
  }
  foreach (element_children($form) as $key) {
    if (!empty($settings[$key])) {
      if ($form[$key]['#type'] == 'fieldset') {
        $this
          ->applyGlobalTemplate($form[$key], $settings[$key]);
      }
      else {
        $form[$key]['#default_value'] = $settings[$key];
      }
    }
  }
}