Jump to content

How to iterate through repeater fields' subfields?


Recommended Posts

I know that say I have a repeater field engines, I can do foreach($page->engines) or $page->engine_field... but is there any way to do like

foreach($page->engines as $e) {
    foreach($e->field as $field) {
        echo $field->val;

That itself doesn't work. But is there some way of iterating through a repeater field's subfields? I'm trying to add repeater field support to Import Pages CSV module... If not I may just have to figure out how to write a separate module specifically for imports of a particular page template... if I can... I can try...

Anybody know about this?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Yannick Albert
      How could we add a repeater-field to our module configuration pages? I tried to add it like any other input field, but no success! (Just as a sidenote: Unfortunately my php skills are really restricted)
      This is my current state, but it just throws an exception:
      Error: Exception: Unknown column 'field_title.count' in 'field list' (in wire\core\Database.php line 118) public static function getModuleConfigInputfields(array $data) { $data = array_merge(self::getDefaultData(), $data); $inputfields = new InputfieldWrapper(); ... $field = wire("fields")->get("title"); $field->type = $modules->get("FieldtypeRepeater"); $repeater = wire("modules")->get("InputfieldRepeater"); $repeater->name = "somethingUnique"; $repeater->add($field); $repeater->page = wire("page"); $inputfields->add($repeater); ... return $inputfields; } Any idea what I'm doing wrong, or how we could achive this?
    • By thomas
      when I delete a page with repeater fields, the fields data stays in the DB. Is there a way to delete these or a way to find out which data in the "pages" table is from repeaters? I added and deleted about 4000 pages via a script and now my "pages" table is a mess ...
  • Create New...