You are here

function gathercontent_gathercontent_process_choice_radio_field in GatherContent 7.3

Parameters

EntityMetadataWrapper $node: Object of node.

string $local_field_name: Local field name.

string $gathercontent_field_name: Name of field in GatherContent.

bool $is_translatable: Indicator if node is translatable.

string $language: Language of translation if applicable.

array $options: Array of options.

1 call to gathercontent_gathercontent_process_choice_radio_field()
gathercontent_gathercontent_process_content_pane in ./gathercontent.module

File

./gathercontent.module, line 1002

Code

function gathercontent_gathercontent_process_choice_radio_field(EntityMetadataWrapper &$node, $local_field_name, $gathercontent_field_name, $is_translatable = FALSE, $language = 'und', $options) {
  foreach ($options as $option) {
    if ($option->selected) {
      if (isset($option->value)) {
        if ($is_translatable) {
          $node
            ->language($language)->{$local_field_name}
            ->set($option->value);
        }
        else {
          $node->{$local_field_name}
            ->set($option->value);
        }
      }
      else {
        if ($is_translatable) {
          $node
            ->language($language)->{$local_field_name}
            ->set($option->name);
        }
        else {
          $node->{$local_field_name}
            ->set($option->name);
        }
      }
    }
  }
}