You are here

function _webform_load_components in Webform 5

Load all necessary component.inc files into memory.

9 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_edit_field_form in ./webform.module
webform_edit_field_form_prepare_validate in ./webform.module
Field name validation for the webform unique key. Must be alphanumeric.
webform_form in ./webform.module
Implementation of hook_form() Creates the standard form for editing or creating a webform.

... See full list

File

./webform.module, line 1961

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) {
        include_once $filename;
        $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);
}