You are here

function _webform_component_options in Webform 6.2

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

Given a set of components, determine which one are appropriate for a particular use, such as an email address or subject.

Parameters

$components: An array of components.

$type: Either 'email' or 'string' (for use as subject or from value).

1 call to _webform_component_options()
webform_form in ./webform.module
Implementation of hook_form(). Creates the standard form for editing or creating a webform.

File

./webform.module, line 2409

Code

function _webform_component_options($components, $type) {
  $acceptable_types = $type == 'email' ? array(
    'email',
    'select',
    'hidden',
  ) : array(
    'textfield',
    'select',
    'hidden',
  );
  $options = array();
  foreach ((array) $components as $cid => $component) {
    if (in_array($component['type'], $acceptable_types)) {
      $options[$cid] = $component['name'];
    }
  }
  return $options;
}