/** * Removes bundle placement from form * * @param int $pn_placement_id Placement_id of placement to remove * @param array $pa_options Optional array of options. Supports the following options: * user_id = if specified then remove will fail if specified user does not have edit access for the form * @return bool Returns true on success, false on error */ public function removePlacement($pn_placement_id, $pa_options = null) { if (!($vn_form_id = $this->getPrimaryKey())) { return null; } $pn_user_id = isset($pa_options['user_id']) ? $pa_options['user_id'] : null; if ($pn_user_id && !$this->haveAccessToForm($pn_user_id, __CA_SEARCH_FORM_EDIT_ACCESS__)) { return null; } $t_placement = new ca_search_form_placements($pn_placement_id); if ($t_placement->getPrimaryKey() && $t_placement->get('form_id') == $vn_form_id) { $t_placement->setMode(ACCESS_WRITE); $t_placement->delete(true); if ($t_placement->numErrors()) { $this->errors = array_merge($this->errors, $t_placement->errors); return false; } unset(ca_search_forms::$s_placement_list_cache[$vn_form_id]); return true; } return false; }