You are here

function webform_service_get_components in Webform Service 7.4

Same name and namespace in other branches
  1. 6.3 webform_service.module \webform_service_get_components()

Returns the data structure for webform components.

2 calls to webform_service_get_components()
webform_service_get_submission in ./webform_service.module
Returns a single submission resource.
webform_service_get_webform in ./webform_service.module
Returns a data structure of a webform object.

File

./webform_service.module, line 133

Code

function webform_service_get_components($webform) {
  $components = array();
  foreach ($webform['components'] as $cid => $component) {
    if (isset($component['extra']['items'])) {
      $items = preg_split("/\r\n|\n|\r/", $component['extra']['items']);
      $component['extra']['items'] = array();
      foreach ($items as $item) {
        $parts = explode('|', $item);
        $key = $parts[0];
        $value = isset($parts[1]) ? $parts[1] : $key;
        $component['extra']['items'][$key] = $value;
      }
    }
    $components[$cid] = $component;
  }
  return $components;
}