src/Template.php
public function fill($fields = [])
    {
        $url = self::resolveFullUrl([$this->id]);

        if(isset($this->properties['fillable_fields'])) {
            $fields = $this->properties['fillable_fields'];
        }

        foreach ($fields as $index => $field) {
            if (!is_array($field)) {
                continue;
            }

            unset($fields[$index]);

            if (!isset($field['name']) || !isset($field['value'])) {
                continue;
            }

            $name = $field['name'];
            $value = $field['value'];
            $type = isset($field['type']) ? $field['type'] : '';

            if ($type === self::TYPE_CHECKBOX) {
                $value = intval(boolval($value));
            }

            $fields[$name] = $value;
        }

        return static::post($this->client, $url, [
            'json' => [
                'fillable_fields' => $fields
            ]
        ]);
    }
public function fill($fields = [])
    {
        $url = self::resolveFullUrl([$this->id]);

        if(isset($this->properties['fillable_fields'])) {
            $fields = $this->properties['fillable_fields'];
        }

        foreach ($fields as $index => $field) {
            if (!is_array($field)) {
                continue;
            }

            unset($fields[$index]);

            if (!isset($field['name']) || !isset($field['value'])) {
                continue;
            }

            $name = $field['name'];
            $value = $field['value'];
            $type = isset($field['type']) ? $field['type'] : '';

            if ($type === self::TYPE_CHECKBOX) {
                $value = intval(boolval($value));
            }

            $fields[$name] = $value;
        }

        return static::post($this->client, $url, [
            'json' => [
                'fillable_fields' => $fields
            ]
        ]);
    }
public function fill ( $ fields = [ ] ) { $ url = self :: resolveFullUrl ( [ $ this -> id ] ) ; if ( isset ( $ this -> properties [ 'fillable_fields' ] ) ) { $ fields = $ this -> properties [ 'fillable_fields' ] ; } foreach ( $ fields as $ index => $ field ) { if ( ! is_array ( $ field ) ) { continue ; } unset ( $ fields [ $ index ] ) ; if ( ! isset ( $ field [ 'name' ] ) || ! isset ( $ field [ 'value' ] ) ) { continue ; } $ name = $ field [ 'name' ] ; $ value = $ field [ 'value' ] ; $ type = isset ( $ field [ 'type' ] ) ? $ field [ 'type' ] : '' ; if ( $ type === self :: TYPE_CHECKBOX ) { $ value = intval ( boolval ( $ value ) ) ; } $ fields [ $ name ] = $ value ; } return static :: post ( $ this -> client , $ url , [ 'json' => [ 'fillable_fields' => $ fields ] ] ) ; }
Fill template with named fields
@param array $fields
@return mixed
@throws Exceptions\InvalidQueryException
@throws Exceptions\InvalidRequestException
Fill template with named fields