Can I set up the fields of editor with loop?

Can I set up the fields of editor with loop?

jschoijschoi Posts: 13Questions: 5Answers: 0

let editor = new Editor(db, 'TABLE', 'KEY_TABLE')
.fields(
new Field('PILE_ID')
, new Field('SHEET_ID')
, new Field('CHECK')
, new Field('CHECK_VALUE_1')
, new Field('CHECK_VALUE_2')
, new Field('CHECK_VALUE_3')
, new Field('CHECK_VALUE_4')
, new Field('CHECK_VALUE_5')
.
.
.
.
, new Field('CHECK_VALUE_80')
)

I coded as above check values 80 times....
Can I make a loop for above?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Sure.

    for ($i=1 ; $i<=80 ; $i++) {
      editor->field(Field::inst('CHECK_VALUE_' . i));
    }
    

    Allan

Sign In or Register to comment.