-
- // add select for contact type
- $this->add('select', 'contact_types_a', ts('Contact Type A') . ' ',
- array(
- '' => ts('All Contacts'),
- ) + $contactTypes
- );
- $this->add('select', 'contact_types_b', ts('Contact Type B') . ' ',
- array(
- '' => ts('All Contacts'),
- ) + $contactTypes
- );
-
- //only selected field should be allow for edit, CRM-4888
- if ($this->_id &&
- CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_RelationshipType', $this->_id, 'is_reserved')
- ) {
- foreach (array('contactTypeA', 'contactTypeB', 'isActive') as $field) {
- $$field->freeze();
+ foreach (['contact_types_a' => ts('Contact Type A'), 'contact_types_b' => ts('Contact Type B')] as $name => $label) {
+ $element = $this->add('select', $name, $label . ' ',
+ array(
+ '' => ts('All Contacts'),
+ ) + $contactTypes
+ );
+ if ($isReserved) {
+ $element->freeze();