*/ class ConfigurationForm extends BaseForm { /** * @return void|null * @throws Beds24\Beds24Exception */ protected function buildForm() { $this->formBuilder // -- Username and passwords ------------------------------------------------------------------------------- ->add( 'api_key', 'text', [ 'constraints' => [new NotBlank()], 'required' => true, 'label' => $this->trans('Beds24 API Key '), 'label_attr' => [ 'help' => $this->trans('You\'ll find this key in your Beds24 account SETTINGS >> ACCOUNT >> ACCOUNT ACCESS.') ] ] ) ; $api = new Beds24\Beds24Request(); $properties = $api->getPropertyList(); if (! $api->hasError($properties)) { foreach ($properties as $property) { $this->formBuilder->add( 'prop_key_' . $property['id'], 'text', [ 'constraints' => [new NotBlank()], 'required' => true, 'label' => $this->trans('Key for property ' . $property['name'] . ' - ' . $property['id']), 'label_attr' => [ ] ] ); } } } protected function trans($string, $args = []) { return $this->translator->trans($string, $args, Beds24::DOMAIN_NAME); } public function getName() { return 'beds24_configuration_form'; } }