Forum

Thread tagged as: Problem, Runway, Field-Types

Can dataselect reference content in a Shared region?

I have a region that I want to reference with a dataselect but the region needs to be shared as it's the same for all pages in the site.

When the content region isn't set as shared, the dataselect works fine. If set the region to shared though it doesn't work and in the Admin area I get the following error next to the dropdown:

Warning: array_unshift() expects parameter 1 to be array, null given in /Users/paul/Repositories/Lille/lille-core-site/build/admin/core/lib/PerchFieldTypes.class.php on line 1836

Am I just trying to do something with dataselect that it can't do or is there something I need to change to make it work for a Shared region?

Content Create

<?php
perch_content_create('Product Finder (en-gb)', array(
    'template'  =>  'products/product-finder/step.html',
    'multiple'  =>  false,
    'edit-mode' => 'listdetail',
    'sort'      => 'step_note',
    'columns'   => 'step_note, _id, step_type, heading',
    'shared'    =>  true,
));
?>
<?php perch_content('Product Finder (en-gb)'); ?>

Step.html

<div class="remodal product-finder" data-remodal-id="popup-product-finder" role="dialog" aria-labelledby="popup-product-finder-title"
     +      aria-describedby="popup-product-finder-title" data-remodal-options="hashTracking: false, closeOnOutsideClick: true"">
    <div class="card">
        <div class="card__header">
            <h1 class="product-finder__heading" id="popup-product-finder-title">Product Finder</h1>
        </div>
        <div class="card__inner">

        <div id="product-finder-<perch:content id="_id" type="hidden"/>" name="product-finder-<perch:content id="_id" type="hidden"/>">
            <h2 class="product-finder__question"><perch:content id="heading" label="Heading" type="text" size="xl"/> <perch:content id="step_type" supress="true" label="Step type" type="select" options="Question|Q, Recommendations|R" divider-after="Only add a block for a Question OR a Recommendation - multiple blocks after the 1st one will be ignored"/> / <perch:content id="_id" type="hidden" suppress="true" /></h2>
            <perch:content id="step_note" supress="true" label="Step Note" type="text" size="xl" help="CMS notes on step (not displayed on website Product Finder)"/><p><perch:content id="summary" label="Summary" type="textarea" size="s"/></p>

            <perch:blocks>
                <perch:block type="answers" label="Answer Options">

                    <perch:repeater id="pf_answers">
                        <perch:before>
                            <ul class="product-finder__answers"></perch:before>
                        <li class="product-finder__answer">
                            <perch:if exists="pf_next_step_id"><a href="#product-finder-<perch:content id="pf_next_step_id" label="Go Next Test" type="dataselect" page="/en/gb/products/index.php" region="Product Finder (en-gb)" options="step_note" values="_id" allowempty="true" order="2" />"></perch:if>
                                <perch:content id="pf_answer_option" label="Answer option" type="text" size="xl" order="1" />
                            <perch:if exists="pf_next_step_id"></a> (<perch:content id="pf_next_step_id" label="Next step id" hidden="true" />)</perch:if>
                        </li>
                        <perch:after></ul></perch:after>
                    </perch:repeater>

                </perch:block>
                <perch:block type="recommendation" label="Product Recommendation">

                    <perch:repeater id="pf_recs">
                        <perch:before>
                            <ul>
                        </perch:before>
                        <li><a href="<perch:content id="product_link" label="Link to page" type="pagelist"/>"><perch:content id="recommendation_text" label="Recommendation text" type="text" size="l"/></a></li>
                        <perch:after>
                            </ul>
                        </perch:after>
                    </perch:repeater>

                </perch:block>
            </perch:blocks>

            <button class="action">Back</button>
        </div>

        </div>
    </div>
</div>

Diagnostics Report

Perch Runway: 2.8.24, PHP: 5.4.42, MySQL: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $, with PDO
Server OS: Darwin, cgi-fcgi
Installed apps: content (2.8.24), assets (2.8.24), categories (2.8.24)
App runtimes: <?php $apps_list = array( 'content', 'categories', );
PERCH_LOGINPATH: /admin
PERCH_PATH: /Users/paul/Repositories/REDACTED/REDACTED-core-site/build/admin
PERCH_CORE: /Users/paul/Repositories/REDACTED/REDACTED-core-site/build/admin/core
PERCH_RESFILEPATH: /Users/paul/Repositories/REDACTED/REDACTED-core-site/build/admin/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: dc1fef2ad0fcd9f943c02ebb43d85dbc
Resource folder writeable: Yes
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
REQUEST_URI: /admin/core/settings/diagnostics/
DOCUMENT_ROOT: /Users/paul/Repositories/REDACTED/REDACTED-core-site/build
HTTP_HOST: REDACTED.local
Paul Wilson

Paul Wilson 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

For a shared region, you might get away with setting page="*" on the data select tag.

Thanks Drew. That seems to work perfectly at the moment.

Many thanks for your help.

Kindest regards

Paul