/**
  * Membership image url
  *
  * @param string $image
  * @return string
  */
 public function __invoke($image)
 {
     return ApplicationService::getResourcesUrl() . MembershipBaseModel::getImagesDir() . $image;
 }
 /**
  * Get form instance
  *
  * @return \Application\Form\ApplicationCustomFormBuilder
  */
 public function getForm()
 {
     // get form builder
     if (!$this->form) {
         // get list of all ACL roles
         $aclRoles = [];
         foreach (AclService::getAclRoles() as $roleId => $roleName) {
             // skip all system ACL roles
             if (in_array($roleId, [AclBaseModel::DEFAULT_ROLE_ADMIN, AclBaseModel::DEFAULT_ROLE_GUEST, AclBaseModel::DEFAULT_ROLE_MEMBER])) {
                 continue;
             }
             $aclRoles[$roleId] = $roleName;
         }
         $this->formElements['role_id']['values'] = $aclRoles;
         // add preview for the image
         if ($this->image) {
             $this->formElements['image']['required'] = false;
             $this->formElements['image']['extra_options']['preview'] = true;
             $this->formElements['image']['extra_options']['file_url'] = ApplicationService::getResourcesUrl() . MembershipBaseModel::getImagesDir() . $this->image;
         }
         // add extra validators
         $this->formElements['expiration_notification']['validators'] = [['name' => 'callback', 'options' => ['callback' => [$this, 'validateExpirationNotification'], 'message' => 'The expiration notification value  must be less than role\'s lifetime']]];
         $this->form = new ApplicationCustomFormBuilder($this->formName, $this->formElements, $this->translator, $this->ignoredElements, $this->notValidatedElements, $this->method);
     }
     return $this->form;
 }