Jump to content

How to push new item in field type options?

Recommended Posts


if I have an options field type:


And I need to push several new items like:

for ($i=0; $i < (date("n")); $i++) {
  // or

But all of this returns an error "... not an allowed type..". As i understand an options field type is a WireArray so it should support such methods?

Thanks, Alejandro.

Share this post

Link to post
Share on other sites

Well, I figured a way:

$array = array();
for ($i=0; $i < (date("n")); $i++) {
  $array[] = $i;
  $field->months = $array;

But, just for the knowledge, is there a way to add $array to $field->months ?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...