'templates' => array( 'b4home' => array( 'category' => 'bootstrap4plus', 'description' => 'Bootstrap4 homepage sample', 'static' => false, 'propertySets' => array( 'bootstrap4plus1', ), ), ),
<?php $properties = array( array( 'name' => 'b4navbar_sticky', 'desc' => 'b4navbar_sticky_property_desc', 'type' => 'combo-boolean', 'options' => '', 'value' => '1', 'lexicon' => 'bootstrap4plus:properties', ), array( 'name' => 'b4navbar_behaviour', 'desc' => 'b4navbar_behaviour_property_desc', 'type' => 'list', 'options' => array( array( 'name' => 'Fixed', 'value' => 'fixtop', 'menu' => '', ), array( 'name' => 'Default', 'value' => 'default', 'menu' => '', ), ), 'value' => 'fixed', 'lexicon' => 'bootstrap4plus:properties', ), array( 'name' => 'b4navbar_container', 'desc' => 'b4navbar_container_desc', 'type' => 'list', 'options' => array( array( 'name' => 'Normal', 'value' => '0', 'menu' => '', ), array( 'name' => 'Fluid', 'value' => '1', 'menu' => '', ), ), 'value' => '1', 'lexicon' => 'bootstrap4plus:properties', ), ); return $properties;
if (!function_exists('getNameAlias')) { function getNameAlias($elementType) { switch ($elementType) { case 'modTemplate': $nameAlias = 'templatename'; break; case 'modCategory': $nameAlias = 'category'; break; case 'modResource': $nameAlias = 'pagetitle'; break; default: $nameAlias = 'name'; break; } return $nameAlias; } } if (!function_exists('checkFields')) { function checkFields($required, $objectFields) { global $modx; $fields = explode(',', $required); foreach ($fields as $field) { if (!isset($objectFields[$field])) { $modx->log(modX::LOG_LEVEL_ERROR, '[PropertySet Resolver] Missing field: ' . $field); return false; } } return true; } } if ($object->xpdo) { $modx =& $object->xpdo; switch ($options[xPDOTransport::PACKAGE_ACTION]) { case xPDOTransport::ACTION_INSTALL: case xPDOTransport::ACTION_UPGRADE: $intersects = array ( 1 => array ( //Change the fields below 'element' => 'Template2', 'element_class' => 'modTemplate', 'property_set' => 'PropertySet2', ), ); if (is_array($intersects)) { foreach ($intersects as $k => $fields) { /* make sure we have all fields */ if (!checkFields('element,element_class,property_set', $fields)) { continue; } $elementObj = $modx->getObject($fields['element_class'], array(getNameAlias($fields['element_class']) => $fields['element'])); $propertySetObj = $modx->getObject('modPropertySet', array('name' => $fields['property_set'])); if (!$elementObj || !$propertySetObj) { $modx->log(xPDO::LOG_LEVEL_ERROR, 'Could not find Element and/or Property Set ' . $fields['element'] . ' - ' . $fields['property_set']); continue; } $fields['element'] = $elementObj->get('id'); $fields['property_set'] = $propertySetObj->get('id'); $tvt = $modx->getObject('modElementPropertySet', $fields); if (!$tvt) { $tvt = $modx->newObject('modElementPropertySet'); } if ($tvt) { foreach($fields as $key => $value) { $tvt->set($key, $value); } if (!$tvt->save()) { $modx->log(xPDO::LOG_LEVEL_ERROR, 'Unknown error creating elementPropertySet intersect for ' . $fields['element'] . ' - ' . $fields['property_set']); } } else { $modx->log(xPDO::LOG_LEVEL_ERROR, 'Unknown error creating elementPropertySet intersect for ' . $fields['element'] . ' - ' . $fields['property_set']); } } } break; case xPDOTransport::ACTION_UNINSTALL: break; } } return true;
First, did you run ExportObjects after creating the property set and attaching it to the Template? That's where the resolver gets created.
Is there a property set resolver in _build/resolvers?
0 => array ( 'element' => 'b4home', 'element_class' => 'modTemplate', 'property_set' => 'bootstrap4plus1', ),