本文整理汇总了PHP中CRM_Core_BAO_CustomField::deleteField方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomField::deleteField方法的具体用法?PHP CRM_Core_BAO_CustomField::deleteField怎么用?PHP CRM_Core_BAO_CustomField::deleteField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomField
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomField::deleteField方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
/**
* Process the form when submitted.
*
* @return void
*/
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');
}
示例2: testDeleteCustomfield
function testDeleteCustomfield()
{
$customGroup = Custom::createGroup(array(), 'Individual');
$fields = array('groupId' => $customGroup->id, 'dataType' => 'Memo', 'htmlType' => 'TextArea');
$customField = Custom::createField(array(), $fields);
CRM_Core_BAO_CustomField::deleteField($customField);
$this->assertDBNull('CRM_Core_DAO_CustomField', $customGroup->id, 'id', 'custom_group_id', 'Database check for deleted Custom Field.');
Custom::deleteGroup($customGroup);
}
示例3: testDeleteCustomField
public function testDeleteCustomField()
{
$customGroup = $this->customGroupCreate(array('extends' => 'Individual'));
$fields = array('custom_group_id' => $customGroup['id'], 'label' => 'Throwaway Field', 'dataType' => 'Memo', 'htmlType' => 'TextArea');
$customField = $this->customFieldCreate($fields);
$fieldObject = new CRM_Core_BAO_CustomField();
$fieldObject->id = $customField['id'];
$fieldObject->find(TRUE);
CRM_Core_BAO_CustomField::deleteField($fieldObject);
$this->assertDBNull('CRM_Core_DAO_CustomField', $customGroup['id'], 'id', 'custom_group_id', 'Database check for deleted Custom Field.');
$this->customGroupDelete($customGroup['id']);
}
示例4: civicrm_api3_custom_field_delete
/**
* Use this API to delete an existing custom group field.
*
* @param $params Array id of the field to be deleted
*
* @return array
* @example CustomFieldDelete.php
*
* {@example CustomFieldDelete.php 0}
* {@getfields CustomField_delete}
* @access public
**/
function civicrm_api3_custom_field_delete($params)
{
$field = new CRM_Core_BAO_CustomField();
$field->id = $params['id'];
$field->find(TRUE);
$customFieldDelete = CRM_Core_BAO_CustomField::deleteField($field);
civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1));
return $customFieldDelete ? civicrm_api3_create_error('Error while deleting custom field') : civicrm_api3_create_success();
}
示例5: deleteGroup
/**
* Delete the Custom Group.
*
* @param CRM_Core_BAO_CustomGroup $group
* Custom group object.
* @param bool $force
* whether to force the deletion, even if there are custom fields.
*
* @return bool
* False if field exists for this group, true if group gets deleted.
*/
public static function deleteGroup($group, $force = FALSE)
{
//check whether this contain any custom fields
$customField = new CRM_Core_DAO_CustomField();
$customField->custom_group_id = $group->id;
$customField->find();
// return early if there are custom fields and we're not
// forcing the delete, otherwise delete the fields one by one
while ($customField->fetch()) {
if (!$force) {
return FALSE;
}
CRM_Core_BAO_CustomField::deleteField($customField);
}
// drop the table associated with this custom group
CRM_Core_BAO_SchemaHandler::dropTable($group->table_name);
//delete custom group
$group->delete();
CRM_Utils_Hook::post('delete', 'CustomGroup', $group->id, $group);
return TRUE;
}
示例6: postProcess
/**
* Process the form when submitted
*
* @return void
* @access public
*/
public function postProcess()
{
// step 1: copy and create dstField and column
require_once 'CRM/Core/BAO/CustomField.php';
$field = new CRM_Core_DAO_CustomField();
$field->id = $this->_srcFID;
if (!$field->find(true)) {
CRM_Core_Error::fatal();
}
// now change the field group ID and save it, also unset the id
unset($field->id);
// step 2: copy data from srcColumn to dstColumn
$query = "\nINSERT INTO {$dstTable} ( {$entityID}, {$dstColumn} )\nSELECT {$entityID}, {$srcColumn}\nFROM {$srcTable}\nON DUPLICATE KEY UPDATE {$dstColumn} = {$srcColumn}";
CRM_Core_DAO::query($query, CRM_Core_DAO::$_nullArray);
// step 3: remove srcField (which should also delete the srcColumn
require_once 'CRM/Core/BAO/CustomField.php';
$field = new CRM_Core_DAO_CustomField();
$field->id = $this->_srcFID;
CRM_Core_BAO_CustomField::deleteField($field);
}
示例7: deleteField
/**
* Helper function to delete custom field
* @deprecated use function on parent class
* @param object of Custom Field to delete
*/
static function deleteField($params)
{
require_once 'CRM/Core/BAO/CustomField.php';
CRM_Core_BAO_CustomField::deleteField($params);
}
示例8: postProcess
/**
* 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
require_once "CRM/Core/BAO/UFField.php";
CRM_Core_BAO_UFField::delUFField($this->_id);
CRM_Core_Session::setStatus(ts('The custom field \'%1\' has been deleted.', array(1 => $field->label)));
CRM_Utils_Weight::correctDuplicateWeights('CRM_Core_DAO_CustomField');
}
示例9: civicrm_custom_field_delete
/**
* Use this API to delete an existing custom group field.
*
* @param $params Array id of the field to be deleted
*
*
* @access public
**/
function civicrm_custom_field_delete($params)
{
_civicrm_initialize();
if (!is_array($params)) {
return civicrm_create_error('Params is not an array');
}
if (!CRM_Utils_Array::value('customFieldId', $params['result'])) {
return civicrm_create_error('Invalid or no value for Custom Field ID');
}
require_once 'CRM/Core/DAO/CustomField.php';
$field = new CRM_Core_DAO_CustomField();
$field->id = $params['result']['customFieldId'];
$field->find(true);
require_once 'CRM/Core/BAO/CustomField.php';
$customFieldDelete = CRM_Core_BAO_CustomField::deleteField($field);
return $customFieldDelete ? civicrm_create_error('Error while deleting custom field') : civicrm_create_success();
}
示例10: deleteField
/**
* Helper function to delete custom field.
*
* @deprecated use function on parent class
*
* @param $params
*/
public static function deleteField($params)
{
CRM_Core_BAO_CustomField::deleteField($params);
}