_id = $this->get('id'); $defaults = array(); $params = array('id' => $this->_id); CRM_Core_BAO_CustomField::retrieve($params, $defaults); $this->_title = CRM_Utils_Array::value('label', $defaults); $this->assign('title', $this->_title); CRM_Utils_System::setTitle(ts('Confirm Custom Field Delete')); } /** * Function to actually build the form * * @param null * * @return void * @access public */ public function buildQuickForm() { $this->addButtons(array( array( 'type' => 'next', 'name' => ts('Delete Custom Field'), 'isDefault' => TRUE, ), array( 'type' => 'cancel', 'name' => ts('Cancel'), ), ) ); } /** * Process the form when submitted * * @param null * * @return void * @access public */ public function postProcess() { $field = new CRM_Core_DAO_CustomField(); $field->id = $this->_id; $field->find(TRUE); CRM_Core_BAO_CustomField::deleteField($field); // also delete any profiles associted with this custom field CRM_Core_Session::setStatus(ts('The custom field \'%1\' has been deleted.', array(1 => $field->label)), '', 'success'); } }