Skip to content

Commit

Permalink
Custom field admin form reform
Browse files Browse the repository at this point in the history
This overhauls the custom field administration form:
- Gets rid of the difficult-to-use hierarchcal select
- Removes changeFieldType as a separate form
- Allows changing field type on the main form, with improved validation
- Fixes up some metadata
- Improves choosing default values
  • Loading branch information
colemanw committed Sep 11, 2020
1 parent 9aea3ce commit 9b85cd3
Show file tree
Hide file tree
Showing 12 changed files with 247 additions and 669 deletions.
4 changes: 2 additions & 2 deletions CRM/Core/BAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ public static function bulkSave($bulkParams, $defaults = []) {
* Fetch object based on array of properties.
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
* An assoc array of name/value pairs.
* @param array $defaults
* (reference ) an assoc array to hold the flattened values.
*
* @return CRM_Core_DAO_CustomField
*/
public static function retrieve(&$params, &$defaults) {
public static function retrieve($params, &$defaults) {
return CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomField', $params, $defaults);
}

Expand Down
7 changes: 6 additions & 1 deletion CRM/Core/DAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/CustomField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:4ded3c0d1a8e34502a5957ee74c4480a)
* (GenCodeChecksum:b74179ea5553c544931562d6aac5641e)
*/

/**
Expand Down Expand Up @@ -365,6 +365,7 @@ public static function &fields() {
'localizable' => 0,
'html' => [
'type' => 'Select',
'label' => ts("Data Type"),
],
'pseudoconstant' => [
'callback' => 'CRM_Core_BAO_CustomField::dataType',
Expand All @@ -384,6 +385,10 @@ public static function &fields() {
'entity' => 'CustomField',
'bao' => 'CRM_Core_BAO_CustomField',
'localizable' => 0,
'html' => [
'type' => 'Select',
'label' => ts("Field Input Type"),
],
'pseudoconstant' => [
'callback' => 'CRM_Core_SelectValues::customHtmlType',
],
Expand Down
1 change: 0 additions & 1 deletion CRM/Core/SelectValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ public static function customHtmlType() {
'RichTextEditor' => ts('Rich Text Editor'),
'Autocomplete-Select' => ts('Autocomplete-Select'),
'Link' => ts('Link'),
'ContactReference' => ts('Autocomplete-Select'),
];
}

Expand Down
5 changes: 0 additions & 5 deletions CRM/Core/xml/Menu/Admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@
<title>Custom Field - Move</title>
<page_callback>CRM_Custom_Form_MoveField</page_callback>
</item>
<item>
<path>civicrm/admin/custom/group/field/changetype</path>
<title>Custom Field - Change Type</title>
<page_callback>CRM_Custom_Form_ChangeFieldType</page_callback>
</item>
<item>
<path>civicrm/admin/uf/group</path>
<title>Profiles</title>
Expand Down
309 changes: 0 additions & 309 deletions CRM/Custom/Form/ChangeFieldType.php

This file was deleted.

Loading

0 comments on commit 9b85cd3

Please sign in to comment.