You are here

protected function Notifications_Subscription::build_fields_from_submission in Notifications 7

Build submitted fields (match them with this subscription type fields)

1 call to Notifications_Subscription::build_fields_from_submission()
Notifications_Subscription::set_properties_from_submission in ./notifications.subscription.inc
Set instance properties from form submission

File

./notifications.subscription.inc, line 682
Drupal Notifications Framework - Default class file

Class

Notifications_Subscription
Common base for subscription type and subscription instance

Code

protected function build_fields_from_submission($form, &$form_state) {
  $fields = array();
  if (!empty($form_state['values']['subscription_fields'])) {
    $field_values = $form_state['values']['subscription_fields'];

    // In this case we have known fields that are always indexed by position
    foreach ($this
      ->get_editable_fields() as $field) {
      if (isset($field_values[$field->position])) {
        $build = Notifications_Field::build_from_value($field_values[$field->position], $field->type, $field->position);
        if ($build) {
          $fields[$field->position] = $build;
        }
      }
    }
  }
  return $fields;
}