/** * Remove a form. * * @access public * * @param string $object_type Object type, set true to remove all forms. * @param string $id Form ID to remove, set true to remove all forms from an object. * @param string $object_name Object name (for post types and taxonomies), set true to remove to all objects from an object type. */ public function remove_form($object_type, $id, $object_name = null) { if (true === $object_type) { // Remove all forms self::$forms = array(); } elseif (true === $object_name) { // Remove all forms for an object type if (isset(self::$forms[$object_type])) { unset(self::$forms[$object_type]); } } else { if (empty($object_name) && !empty($object_type)) { $object_name = '_' . $object_type; // Default to _object_type for internal handling } if (true === $id && null !== $object_name) { // Remove all forms for an object type if (isset(self::$forms[$object_type][$object_name])) { unset(self::$forms[$object_type][$object_name]); } } elseif (isset(self::$forms[$object_type][$object_name][$id])) { // Remove form from object type and name unset(self::$forms[$object_type][$object_name][$id]); } } }