Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/element/propertyset/ |
<?php /** * Gets properties for a property set * * @package modx * @subpackage processors.element.propertyset */ if (!$modx->hasPermission('view_propertyset')) return $modx->error->failure($modx->lexicon('permission_denied')); if (empty($scriptProperties['id'])) return $modx->error->failure($modx->lexicon('propertyset_err_ns')); /** @var modPropertySet $set */ $set = $modx->getObject('modPropertySet',$scriptProperties['id']); if (empty($set)) return $modx->error->failure($modx->lexicon('propertyset_err_nf')); $properties = $set->get('properties'); if (!is_array($properties)) $properties = array(); if (!empty($scriptProperties['element']) && !empty($scriptProperties['element_class'])) { /** @var modElement $element */ $element = $modx->getObject($scriptProperties['element_class'],$scriptProperties['element']); if ($element) { $default = $element->get('properties'); } } $data = array(); /* put in default properties for element */ if (isset($default) && is_array($default)) { foreach ($default as $property) { $data[$property['name']] = array( $property['name'], $property['desc'], !empty($property['type']) ? $property['type'] : 'textfield', !empty($property['options']) ? $property['options'] : array(), $property['value'], !empty($property['lexicon']) ? $property['lexicon'] : '', 0, $property['desc_trans'], !empty($property['area']) ? $property['area'] : '', !empty($property['area_trans']) ? $property['area_trans'] : '', ); } } foreach ($properties as $property) { $overridden = 0; /* if overridden, set flag */ if (isset($data[$property['name']])) { $overridden = 1; } /* if completely new value, unique to set */ if (!isset($data[$property['name']]) && isset($scriptProperties['element'])) { $overridden = 2; } $data[$property['name']] = array( $property['name'], $modx->lexicon($property['desc']), $property['type'], !empty($property['options']) ? $property['options'] : array(), $property['value'], !empty($property['lexicon']) ? $property['lexicon'] : '', $overridden, !empty($property['desc_trans']) ? $property['desc_trans'] : '', !empty($property['area']) ? $property['area'] : '', !empty($property['area_trans']) ? $property['area_trans'] : $property['area'], ); } /* reformat data array for store */ $props = array_values($data); return $modx->error->success('',$props);