public static function getByHandle($akHandle) { $db = Loader::db(); $q = "SELECT ak.akID FROM AttributeKeys ak INNER JOIN AttributeKeyCategories akc ON ak.akCategoryID = akc.akCategoryID WHERE ak.akHandle = ? AND akc.akCategoryHandle = 'file'"; $akID = $db->GetOne($q, array($akHandle)); if ($akID > 0) { $ak = FileAttributeKey::getByID($akID); return $ak; } else { // else we check to see if it's listed in the initial registry $ia = FileTypeList::getImporterAttribute($akHandle); if (is_object($ia)) { // we create this attribute and return it. $at = AttributeType::getByHandle($ia->akType); $args = array( 'akHandle' => $akHandle, 'akName' => $ia->akName, 'akIsSearchable' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => $ia->akIsEditable ); return FileAttributeKey::add($at, $args); } } }
public static function getByHandle($akHandle) { $db = Loader::db(); $akID = $db->GetOne('select akID from AttributeKeys where akHandle = ?', array($akHandle)); if ($akID > 0) { $ak = FileAttributeKey::getByID($akID); return $ak; } else { // else we check to see if it's listed in the initial registry $ia = FileTypeList::getImporterAttribute($akHandle); if (is_object($ia)) { // we create this attribute and return it. $at = AttributeType::getByHandle($ia->akType); $args = array('akHandle' => $akHandle, 'akName' => $ia->akName, 'akIsSearchable' => 1, 'akIsAutoCreated' => 1, 'akIsEditable' => $ia->akIsEditable); return FileAttributeKey::add($at, $args); } } }