Skip to content

Commit

Permalink
Change variable name for clarity (CFM-219)
Browse files Browse the repository at this point in the history
  • Loading branch information
arlen committed Mar 23, 2023
1 parent e88f7c9 commit ffa6760
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions app/src/View/Helper/FieldHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function control(string $fieldName,
$fieldSupplement = !empty($config['supplement']) ? $config['supplement'] : [];

// For special fields that should not include <label> markup, allow fields to make the label text only
$textOnlyLabel = !empty($config['textOnlyLabel']) ? $config['textOnlyLabel'] : false;
$labelIsTextOnly = !empty($config['labelIsTextOnly']) ? $config['labelIsTextOnly'] : false;

// Remove prefix from field value
if(isset($config['prefix'], $this->getView()->get('vv_obj')->$fieldName)) {
Expand Down Expand Up @@ -170,7 +170,7 @@ public function control(string $fieldName,
}

return $this->startLine($liClass)
. $this->formNameDiv($fieldName, $labelText, $fieldType, $textOnlyLabel)
. $this->formNameDiv($fieldName, $labelText, $fieldType, $labelIsTextOnly)
. ( !empty($config['prefix']) ?
$this->formInfoWithPrefixDiv($controlCode, $config['prefix'], $fieldSupplement) :
$this->formInfoDiv($controlCode, $fieldSupplement) )
Expand Down Expand Up @@ -344,11 +344,11 @@ protected function formInfoWithPrefixDiv(string $context, string $prefix, array
* @param string $fieldName Form field
* @param string $labelText Label text (fieldName language key used by default)
* @param string $fieldType Type of field (string, boolean, timestamp, etc)
* @param boolean $textOnlyLabel True if label should be text only. Otherwise false.
* @param boolean $labelIsTextOnly True if label should be text only. Otherwise false.
* @return string Form Name HTML
*/

protected function formNameDiv(string $fieldName, string $labelText=null, string $fieldType, bool $textOnlyLabel=false): string {
protected function formNameDiv(string $fieldName, string $labelText=null, string $fieldType, bool $labelIsTextOnly=false): string {
$label = $labelText;
$desc = null;

Expand Down Expand Up @@ -408,7 +408,7 @@ protected function formNameDiv(string $fieldName, string $labelText=null, string

return '<div class="field-name">
<div class="field-title">'
. ($this->editable && !($textOnlyLabel) && ($fieldType != 'boolean')
. ($this->editable && !($labelIsTextOnly) && ($fieldType != 'boolean')
? $this->Form->label($fn, $label)
: $label)
. ($this->editable
Expand Down Expand Up @@ -463,10 +463,10 @@ public function statusControl(string $fieldName,
}

// For special fields that should not include <label> markup, allow fields to make the label text only
$textOnlyLabel = !empty($config['textOnlyLabel']) ? $config['textOnlyLabel'] : false;
$labelIsTextOnly = !empty($config['labelIsTextOnly']) ? $config['labelIsTextOnly'] : false;

return $this->startLine()
. $this->formNameDiv($fieldName, $labelText, 'string', $textOnlyLabel)
. $this->formNameDiv($fieldName, $labelText, 'string', $labelIsTextOnly)
. $linkHtml
. $this->endLine();
}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/ApiUsers/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if($vv_action == 'add' || $vv_action == 'edit') {
'confirm' => __d('operation', 'api.key.generate.confirm')
];

$config = ['textOnlyLabel' => true];
$config = ['labelIsTextOnly' => true];
}

print $this->Field->statusControl('api_key',
Expand Down

0 comments on commit ffa6760

Please sign in to comment.