Is there a way to create a new Field Object?

Hello,

is there a way to create a new Field Object?
I want to use the functions like value on my object.
PS: The blueprint for that page already contains the field price.
I just want to globally override it.

class TourPagePage extends Page {

  public function price() {
    $field = new Field('price');
    $field->value("20");
    return $field;
  }

}

Thanks for your help!

You can create a new field object like this

 $field = new Field($page, $key, $value = '');
  public function price() {
    return new Field($this, 'price', '20');
  }

Ahhhh thank you!

I already tried new Field('key')but i think i forgot to assign it to a page.

Works :slight_smile: