public function set_type_autocomplete($options, $attributes) {
        $this->type = 'autocomplete';

        $pairedoptions = [];
        foreach ($options as $key => $value) {
            $pairedoptions[] = [
                'key' => $key,
                'value' => $value,
            ];
        }
        $this->options = json_encode(['options' => $pairedoptions, 'attributes' => $attributes]);
        return $this;
    }
public function set_type_autocomplete($options, $attributes) {
        $this->type = 'autocomplete';

        $pairedoptions = [];
        foreach ($options as $key => $value) {
            $pairedoptions[] = [
                'key' => $key,
                'value' => $value,
            ];
        }
        $this->options = json_encode(['options' => $pairedoptions, 'attributes' => $attributes]);
        return $this;
    }
public function set_type_autocomplete ( $ options , $ attributes ) { $ this -> type = 'autocomplete' ; $ pairedoptions = [ ] ; foreach ( $ options as $ key => $ value ) { $ pairedoptions [ ] = [ 'key' => $ key , 'value' => $ value , ] ; } $ this -> options = json_encode ( [ 'options' => $ pairedoptions , 'attributes' => $ attributes ] ) ; return $ this ; }
Sets the element type to be an autocomplete field

@param array $options associative array with dropdown options
@param array $attributes associative array with attributes for autoselect field. See AMD module core/form-autocomplete.
@return self
Sets the element type to be an autocomplete field