use variable to avoid multiple method calls
This commit is contained in:
parent
e442ca6249
commit
3241583542
1 changed files with 7 additions and 4 deletions
|
@ -191,22 +191,25 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Is this the default profile?
|
||||||
|
$is_default = $this->profile->is_default();
|
||||||
|
|
||||||
// Assign template variables.
|
// Assign template variables.
|
||||||
$this->assign('op', $this->_op);
|
$this->assign('op', $this->_op);
|
||||||
$this->assign('profile_name', $profile_name);
|
$this->assign('profile_name', $profile_name);
|
||||||
$this->assign('is_default', $this->profile->is_default());
|
$this->assign('is_default', $is_default);
|
||||||
|
|
||||||
// Add form elements.
|
// Add form elements.
|
||||||
$this->add(
|
$this->add(
|
||||||
'text', // field type
|
'text', // field type
|
||||||
'name', // field name
|
'name', // field name
|
||||||
E::ts('Profile name'),
|
E::ts('Profile name'),
|
||||||
['class' => 'huge'] + ($this->profile->is_default() && $this->_op == 'edit' ? ['readonly'] : []),
|
['class' => 'huge'] + ($is_default && $this->_op == 'edit' ? ['readonly'] : []),
|
||||||
!$this->profile->is_default()
|
!$is_default
|
||||||
);
|
);
|
||||||
|
|
||||||
// Do only display selector if this is not the default profile
|
// Do only display selector if this is not the default profile
|
||||||
if (!$this->profile->is_default()) {
|
if (!$is_default) {
|
||||||
$this->add(
|
$this->add(
|
||||||
'text', // field type
|
'text', // field type
|
||||||
'selector', // field name
|
'selector', // field name
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue