/** * Returns the output of the field type. * * @return string */ public function getField($aField) { $_sInputForEncodedVelue = ''; if (is_callable($this->getElement($aField, array('callback', 'search')))) { $_sInputForEncodedVelue = $this->_getChildInputByKey('encoded', $aField); $aField['attributes'] = $this->_getAttributesUpdatedForAJAX($aField); } $_aOptions = $this->_getSelect2OptionsFormatted($aField['options'], $aField); $aField['attributes']['select'] = array('data-type' => 'select2', 'data-field_id' => $aField['field_id'], 'data-section_id' => $aField['section_id']) + $this->getDataAttributeArray($_aOptions) + $this->getElementAsArray($aField, array('attributes', 'select')); return parent::getField($aField) . $_sInputForEncodedVelue; // a nested input that stores an encoded selection value. }