Forum

Thread tagged as: Problem, Runway

New Runway pages not copying region options page set in master template?

Runway does not appear to copy the regions for the page set in the master page options. This feature works fine in Perch but not in Runway?

Martin Elliff

Martin Elliff 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

No, it's the same in both versions.

It does not appear to work Runway. I set the Master Page to copy the regions from a page that has already been created using that master template. e.g. Master page is called 'Standard', Article 1 uses the master template and has 1 region set to use the article template. I change the copy regions from setting to Article 1, then are Article 2 to use the Standard master page. Article 2 then has 1 region but is set to NEW and not the article template. I have seen someone else posted the same problem but there was no resolution to it.

I have used the similar option dozens of times in Perch and it works fine, but in runway there seems to be a bug.

I have had a look at the core stuff and although i obviously don't know how things are tied together the $CopyPage = $this->find($Template->optionsPageID()); bit only appears in the create_with_file function and not in the create_without_file function which i presume is runway? optionsPageID does not appear in any other places in the core, so assume it has been missed out of Runway?

Drew McLellan

Drew McLellan 2638 points
Perch Support

That code is the same for Perch and Runway, so if there's a bug it's not specific to Runway.

I'll take a look into it.

I added this to the function create_without_file($data) and it seems to fix it. It is the same block of code that is in create_with_file($data).

        // Set its position in the tree
        if (is_object($Page)) {
            $Page->update_tree_position($parentPageID);

            //// ELLIFF START
            // Grab the template this page uses
            $Templates = new PerchContent_PageTemplates;
            $Template  = $Templates->find($data['templateID']);

            if (is_object($Template)) {

                // Add to nav groups
                if ($Template->templateNavGroups()!='') {
                    $Page->update_navgroups(explode(',', $Template->templateNavGroups()));
                }

                // Copy page options?
                if ($Template->optionsPageID() != '0') {

                    $CopyPage = $this->find($Template->optionsPageID());

                    if (is_object($CopyPage)) {

                        $sql = 'INSERT INTO '.PERCH_DB_PREFIX.'content_regions (
                                pageID,
                                regionKey,
                                regionPage, 
                                regionHTML,
                                regionNew,
                                regionOrder,
                                regionTemplate,
                                regionMultiple,
                                regionSearchable,
                                regionEditRoles,
                                regionOptions
                            ) 
                            SELECT
                                '.$this->db->pdb($Page->id()).' AS pageID,
                                regionKey,
                                '.$this->db->pdb($r).' AS regionPage,
                                "<!-- Undefined content -->" AS regionHTML,
                                regionNew,
                                regionOrder,
                                regionTemplate,
                                regionMultiple,
                                regionSearchable,
                                regionEditRoles,
                                regionOptions
                            FROM '.PERCH_DB_PREFIX.'content_regions
                            WHERE regionPage!='.$this->db->pdb('*').' AND pageID='.$this->db->pdb((int)$CopyPage->id());

                        $this->db->execute($sql);
                    }
                }
            }
            //// ELLIFF END

            return $Page;
        }
Drew McLellan

Drew McLellan 2638 points
Perch Support

You're absolutely right. Should be fixed for 2.8.6.