X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FMember%2FForm.php;h=602a54da655fac772328854ad7bdbfb175fd9fa4;hb=36c538fd50b7244d9be783cd86e1010a57f5f0fd;hp=2d2a757264135909b5722b58ae41c452a82d441d;hpb=7e22e037f1447981918400a0743c44ea15704e99;p=civicrm-core.git diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php index 2d2a757264..602a54da65 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2018 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2018 + * @copyright CiviCRM LLC (c) 2004-2019 */ /** @@ -37,6 +37,7 @@ */ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { + use CRM_Core_Form_EntityFormTrait; /** * The id of the object being edited / created * @@ -91,6 +92,29 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { return 'Membership'; } + /** + * @var array + */ + protected $statusMessage = []; + + /** + * Add to the status message. + * + * @param $message + */ + protected function addStatusMessage($message) { + $this->statusMessage[] = $message; + } + + /** + * Get the status message. + * + * @return string + */ + protected function getStatusMessage() { + return implode(' ', $this->statusMessage); + } + /** * Values submitted to the form, processed along the way. * @@ -98,6 +122,24 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { */ protected $_params = array(); + /** + * 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 = []; + public function preProcess() { // Check for edit permission. if (!CRM_Core_Permission::checkActionPermission('CiviMember', $this->_action)) {