*
* Generated from xml/schema/CRM/Core/UFGroup.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a48f9522d0bd2e1d485064ebfc66f9a2)
+ * (GenCodeChecksum:d0a806459507dc6b32ba955e4e899358)
*/
/**
'title' => [
'name' => 'title',
'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Title'),
+ 'title' => ts('Profile Name'),
'description' => ts('Form title.'),
'required' => TRUE,
'maxlength' => 64,
'entity' => 'UFGroup',
'bao' => 'CRM_Core_BAO_UFGroup',
'localizable' => 1,
+ 'html' => [
+ 'type' => 'Text',
+ ],
],
'frontend_title' => [
'name' => 'frontend_title',
'type' => CRM_Utils_Type::T_STRING,
- 'title' => ts('Frontend Title'),
+ 'title' => ts('Public Title'),
'description' => ts('Profile Form Public title'),
'maxlength' => 64,
'size' => CRM_Utils_Type::BIG,
'entity' => 'UFGroup',
'bao' => 'CRM_Core_BAO_UFGroup',
'localizable' => 1,
+ 'html' => [
+ 'type' => 'Text',
+ ],
],
'description' => [
'name' => 'description',
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2018
- * $Id$
- *
*/
/**
- * This class is for UF Group
+ * This class is for UF Group (Profile) configuration.
*/
class CRM_UF_Form_Group extends CRM_Core_Form {
+ use CRM_Core_Form_EntityFormTrait;
+
+ /**
+ * Fields for the entity to be assigned to the template.
+ *
+ * Fields may have keys
+ * - name (required to show in tpl from the array)
+ * - description (optional, will appear below the field)
+ * - not-auto-addable - this class will not attempt to add the field using addField.
+ * (this will be automatically set if the field does not have html in it's metadata
+ * or is not a core field on the form's entity).
+ * - help (option) add help to the field - e.g ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact']]
+ * - template - use a field specific template to render this field
+ * - required
+ * - is_freeze (field should be frozen).
+ *
+ * @var array
+ */
+ protected $entityFields = [];
+
+ /**
+ * Set entity fields to be assigned to the form.
+ */
+ protected function setEntityFields() {
+ $this->entityFields = [
+ 'title' => ['name' => 'title'],
+ 'frontend_title' => ['name' => 'frontend_title'],
+ 'description' => ['name' => 'description', 'help' => ['id' => 'id-description', 'file' => 'CRM/UF/Form/Group.hlp']],
+ ];
+ }
+
+ /**
+ * Explicitly declare the entity api name.
+ */
+ public function getDefaultEntity() {
+ return 'UFGroup';
+ }
+
/**
* The form id saved to the session for an update.
*
/**
* Set variables up before form is built.
- *
- * @return void
*/
public function preProcess() {
// current form id
* @return void
*/
public function buildQuickForm() {
+ self::buildQuickEntityForm();
if ($this->_action & (CRM_Core_Action::DISABLE | CRM_Core_Action::DELETE)) {
if ($this->_action & (CRM_Core_Action::DISABLE)) {
$display = 'Disable Profile';
));
return;
}
- $this->applyFilter('__ALL__', 'trim');
-
- // title
- $this->add('text', 'title', ts('Profile Name'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'title'), TRUE);
- $this->add('text', 'frontend_title', ts('Public Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'frontend_title'));
- $this->add('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'description'));
//add checkboxes
$uf_group_type = array();
}
else {
// get the submitted form values.
- $params = $ids = array();
+ $ids = array();
$params = $this->controller->exportValues($this->_name);
if (!array_key_exists('is_active', $params)) {
CRM_Utils_System::updateCategories();
}
+ /**
+ * Set the delete message.
+ *
+ * We do this from the constructor in order to do a translation.
+ */
+ public function setDeleteMessage() {}
+
}
</div>
{else}
<table class="form-layout">
- <tr class="crm-uf_group-form-block-title">
- <td class="label">{$form.title.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_uf_group' field='title' id=$gid}{/if}</td>
- <td class="html-adjust">{$form.title.html}</td>
- </tr>
- <tr class="crm-uf_group-form-block-frontend_title">
- <td class="label">{$form.frontend_title.label}</td>
- <td class="html-adjust">{$form.frontend_title.html}</td>
- </tr>
- <tr class="crm-uf_group-form-block-description">
- <td class="label">{$form.description.label} {help id='id-description' file="CRM/UF/Form/Group.hlp"}</td>
- <td class="html-adjust">{$form.description.html}</td>
+ {foreach from=$entityFields item=fieldSpec}
+ {assign var=fieldName value=$fieldSpec.name}
+ <tr class="crm-{$entityInClassFormat}-form-block-{$fieldName}">
+ {include file="CRM/Core/Form/Field.tpl"}
</tr>
+ {/foreach}
<tr class="crm-uf_group-form-block-uf_group_type">
<td class="label">{$form.uf_group_type.label} {help id='id-used_for' file="CRM/UF/Form/Group.hlp"}</td>
<td class="html-adjust">{$form.uf_group_type.html} {$otherModuleString}</td>