<?xml version="1.0" encoding="UTF-8"?> <model package="cms" baseClass="xPDOObject" platform="mysql" defaultEngine="MyISAM" version="1.1"> <object class="Content" table="content" extends="xPDOSimpleObject"> <field key="content_name" dbtype="varchar" precision="200" phptype="string" null="true" /> <field key="content_description" dbtype="varchar" precision="512" phptype="string" null="true" /> <field key="content_text" dbtype="longtext" phptype="string" null="true" /> <field key="deleted" dbtype="int" precision="11" phptype="integer" null="false" default="0" /> <field key="published" dbtype="int" precision="11" phptype="integer" null="false" default="1" /> <index alias="id" name="id" primary="false" unique="true" type="BTREE" > <column key="id" length="" collation="A" null="false" /> </index> <composite alias="ContentPhoto" class="ContentPhoto" local="id" foreign="photo_content_id" cardinality="many" owner="local" /> </object> <object class="ContentPhoto" table="content_photo" extends="xPDOSimpleObject"> <field key="photo_name" dbtype="varchar" precision="255" phptype="string" null="true" /> <field key="photo_content_id" dbtype="int" precision="11" phptype="integer" null="true" /> <field key="photo_file" dbtype="varchar" precision="20" phptype="string" null="true" /> <field key="deleted" dbtype="int" precision="11" phptype="integer" null="false" default="0" /> <field key="published" dbtype="int" precision="11" phptype="integer" null="false" default="1" /> <index alias="id" name="id" primary="false" unique="true" type="BTREE" > <column key="id" length="" collation="A" null="false" /> </index> <aggregate alias="Content" class="Content" local="photo_content_id" foreign="id" cardinality="one" owner="foreign" /> </object> </model>
$resource_id = $modx->getOption('resource_id', $scriptProperties, false);
$resource_id = !empty($co_id) ? $co_id : $resource_id;This question has been answered by Bruno17. See the first response.
[[migxObjectMediaPath? &pathTpl=`assets/res/{id}/`]]
<?php
$pathTpl = $modx->getOption('pathTpl', $scriptProperties, '');
$objectid = $modx->getOption('objectid', $scriptProperties, '');
$createfolder = $modx->getOption('createFolder', $scriptProperties, '1');
$path = '';
$createpath = false;
if (empty($objectid) && $modx->getPlaceholder('objectid')) {
// placeholder was set by some script on frontend for example
$objectid = $modx->getPlaceholder('objectid');
}
if (empty($objectid)) {
//set Session - var in fields.php - processor
if (isset($_SESSION['migxWorkingObjectid'])) {
$objectid = $_SESSION['migxWorkingObjectid'];
$createpath = !empty($createfolder);
}
}
$path = str_replace('{id}', $objectid, $pathTpl);
$fullpath = $modx->getOption('base_path') . $path;
if ($createpath && !file_exists($fullpath)) {
mkdir($fullpath, 0755, true);
}
return $path;
[{"x":"300","y":"300","alias":"small"},{"x":"500","y":"500","alias":"middle"},{"x":"800","y":"800","alias":"big"}]
<?php
if (isset($_REQUEST['iframeTpl']) && $_REQUEST['iframeTpl']=='ajaxupload.html'){
$_REQUEST['resource_id'] = '1';// we need any resource-id of a resource in the correct context, just to get the context
$_REQUEST['tv_name'] = 'objectimage';// we need a image-tv with the correct mediasource in this context
}
$_SESSION['migxWorkingObjectid'] = $object_id;
$_SESSION['migxWorkingObjectid'] = $modx->getOption('co_id',$_REQUEST,'undefined');
4. Create a copy of the migx/processors/mgr/default/fields.php
to
cms/processors/mgr/default/fields.php
and change this line:
$_SESSION['migxWorkingObjectid'] = $object_id;
to:
$_SESSION['migxWorkingObjectid'] = $modx--->getOption('co_id',$_REQUEST,'undefined');
$_SESSION['migxWorkingObjectid'] = $object_id;
//handle json fields $record = $object->toArray();
$_SESSION['migxWorkingObjectid'] = $modx->getOption('co_id',$_REQUEST,'undefined');