protected function installCoreAttributeItems() { $cakc = AttributeKeyCategory::getByHandle('collection'); if (is_object($cakc)) { return false; } $cakc = AttributeKeyCategory::add('collection'); $uakc = AttributeKeyCategory::add('user'); $fakc = AttributeKeyCategory::add('file'); $tt = AttributeType::add('text', t('Text')); $textareat = AttributeType::add('textarea', t('Text Area')); $boolt = AttributeType::add('boolean', t('Checkbox')); $dtt = AttributeType::add('date_time', t('Date/Time')); $ift = AttributeType::add('image_file', t('Image/File')); $nt = AttributeType::add('number', t('Number')); $rt = AttributeType::add('rating', t('Rating')); $st = AttributeType::add('select', t('Select')); $addresst = AttributeType::add('address', t('Address')); // assign collection attributes $cakc->associateAttributeKeyType($tt); $cakc->associateAttributeKeyType($textareat); $cakc->associateAttributeKeyType($boolt); $cakc->associateAttributeKeyType($dtt); $cakc->associateAttributeKeyType($ift); $cakc->associateAttributeKeyType($nt); $cakc->associateAttributeKeyType($rt); $cakc->associateAttributeKeyType($st); // assign user attributes $uakc->associateAttributeKeyType($tt); $uakc->associateAttributeKeyType($textareat); $uakc->associateAttributeKeyType($boolt); $uakc->associateAttributeKeyType($dtt); $uakc->associateAttributeKeyType($nt); $uakc->associateAttributeKeyType($st); $uakc->associateAttributeKeyType($addresst); // assign file attributes $fakc->associateAttributeKeyType($tt); $fakc->associateAttributeKeyType($textareat); $fakc->associateAttributeKeyType($boolt); $fakc->associateAttributeKeyType($dtt); $fakc->associateAttributeKeyType($nt); $fakc->associateAttributeKeyType($rt); $fakc->associateAttributeKeyType($st); }
protected function importAttributeCategories(SimpleXMLElement $sx) { if (isset($sx->attributecategories)) { foreach($sx->attributecategories->category as $akc) { $pkg = ContentImporter::getPackageObject($akc['package']); $akx = AttributeKeyCategory::add($akc['handle'], $akc['allow-sets'], $pkg); } } }