You are here

function webform_load_components in Webform 6.2

Same name and namespace in other branches
  1. 5.2 webform.module \webform_load_components()

Load all necessary component.inc files into memory.

14 calls to webform_load_components()
webform_admin_settings in ./webform.module
Menu callback for admin/webform/settings.
webform_client_form in ./webform.module
Client form generation function. If this is displaying an existing submission, pass in the $submission variable with the contents of the submission to be displayed.
webform_client_form_submit in ./webform.module
webform_components_form in ./webform_components.inc
Overview form of all components for this webform.
webform_component_defaults in ./webform_components.inc
Populate a component with the defaults for that type.

... See full list

File

./webform.module, line 2487

Code

function webform_load_components($return_all = FALSE, $reset = FALSE) {
  static $component_list, $enabled_list;
  if (!isset($component_list) || $reset) {
    $component_list = array();
    $enabled_list = array();
    $path = drupal_get_path('module', 'webform') . '/components';
    $files = file_scan_directory($path, '^.*\\.inc$');
    foreach ($files as $filename => $file) {
      $enabled = variable_get('webform_enable_' . $file->name, 1);
      if ($return_all || $enabled) {
        module_load_include('inc', 'webform', 'components/' . $file->name);
        $component_list[$file->name] = t($file->name);
      }
      if ($enabled) {
        $enabled_list[$file->name] = t($file->name);
      }
    }
  }

  // Ensure only wanted components are returned, even all are loaded.
  return $return_all ? $component_list : array_intersect_assoc($component_list, $enabled_list);
}