private function handle_multi_input($field, $st_context)
 {
     $snh = new GFML_String_Name_Helper();
     $snh->field = $field;
     foreach ($field->choices as $index => $choice) {
         $snh->field_choice = $choice;
         $string_name = $snh->get_field_multi_input_choice_text();
         $field->choices[$index]['text'] = icl_t($st_context, $string_name, $choice['text']);
         if (isset($choice['price'])) {
             $field->choices[$index]['price'] = icl_t($st_context, $snh->get_field_multi_input_choice_price(), $choice['price']);
         }
     }
     return $field;
 }
Ejemplo n.º 2
0
 protected function register_strings_field_option($form_package, $form, $form_field)
 {
     $snh = new GFML_String_Name_Helper();
     $snh->field = $form_field;
     // Price fields can be single or multi-option field type
     if (in_array($form_field->inputType, array('singleproduct', 'singleshipping'), true) && $form_field->basePrice != '') {
         $this->register_gf_string($form_field->basePrice, "{$form_field->type}-{$form_field->id}-basePrice", $form_package, "{$form_field->type}-{$form_field->id}-basePrice");
     } else {
         if (in_array($form_field->inputType, array('select', 'checkbox', 'list', 'radio', 'hiddenproduct'), true) && is_array($form_field->choices)) {
             foreach ($form_field->choices as $index => $choice) {
                 $snh->field_choice = $choice;
                 if (isset($choice['price'])) {
                     $string_name = $snh->get_field_multi_input_choice_price();
                     $string_title = $this->build_string_title($form_field, $choice['price'], $form_field['label']);
                     $this->register_gf_string($choice['price'], $string_name, $form_package, $string_title);
                 }
             }
         }
     }
 }