public function removeMetadataElementFromType($pm_element_code_or_id, $pn_type_id) { require_once __CA_APP_DIR__ . '/models/ca_metadata_elements.php'; require_once __CA_APP_DIR__ . '/models/ca_metadata_type_restrictions.php'; if (!($t_element = $this->_getElementInstance($pm_element_code_or_id))) { return false; } $t_restriction = new ca_metadata_type_restrictions(); if ($t_restriction->load(array('element_id' => $t_element->getPrimaryKey(), 'type_id' => $pn_type_id, 'table_num' => $this->tableNum()))) { $t_restriction->setMode(ACCESS_WRITE); $t_restriction->delete(); if ($t_restriction->numErrors()) { $this->postError(1981, _t("Couldn't remove element from restriction list: %1", join('; ', $t_restriction->getErrors())), 'BaseModelWithAttributes->addMetadataElementToType()'); return false; } } return true; }