TypeRocket Form Elements

2019-08-28 23:32发布

TypeRocket v4 as mu-plugin on Wordpress 5.2 - PHP 7.3

I am having issues with creating a form using TypeRocket (v4)

<?php
    $form = tr_form('purchase', 'create');
    echo $form->open();
    // echo $form->field("Author");
    echo $form->close('Submit');
?>

Sending the form in this condition it will pass. When I uncomment field 'Author', I get ..

Argument 1 passed to TypeRocket\Elements\Form::field() must be an instance of TypeRocket\Elements\Fields\Field, string given

Why can I not just generate fields in TypeRocket view? What am I missing? I tried to understand this, but fail ..

标签: wordpress
1条回答
一纸荒年 Trace。
2楼-- · 2019-08-28 23:52

You need to use text instead of field

<?php
    $form = tr_form('purchase', 'create');
    echo $form->open();
    echo $form->text("Author");
    echo $form->close('Submit');
?>
查看更多
登录 后发表回答