Jump to content

Copy FieldtypeTable contents


noodles
 Share

Recommended Posts

Hi there,

I am trying to move all Repeater fields to PageTable fields at one of our projects.

One of my Repeater fields contains Table fields (FieldtypeTable, from the ProFields package) and I somehow can't move the contents from a specific Repeater item to the destination Page.

A simple

$newPage->tableField = $repeaterElement->tableField;

doesn't work.

Anyone got any ideas?

 

Thanks!

Link to comment
Share on other sites

there are some discussions and instructions on how to do this in the forum somewhere; i think this was the recommended way:

        $cloneFromTable   = $page->repeater->table;
        $cloneToTable     = $page->table;

        foreach($cloneFromTable as $row) {
            $row->id = null;
            $cloneToTable->add($row);
        }

in other words i think you have to iterate the rows from the old table to the new table; AFAIK there is no way to copy the whole thing at once, unless something changed since the last time i needed to do this.

You might want to check over in the Profields Table forum about this specifically.

  • Like 1
Link to comment
Share on other sites

It seems like the title of your post doesn't match what you are asking. Repeater to PageTable is very different from copying FieldtypeTable contents.

I have scripts for both, but I assume you want the former based on what you wrote, so take a look at 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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...