mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-05 04:54:24 +02:00
In case createElements() would still return the elements while requiring the caller to add them to the form all form dependent configurations get lost. (displaygroups, belongTo, ...) Wizards or parent forms can still retrieve only input relevant fields by just calling createElements() and getElements(). refs #5525
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
namespace Icinga\Form\Config\Resource;
|
|
|
|
use Icinga\Web\Form;
|
|
use Icinga\Web\Form\Validator\ReadablePathValidator;
|
|
|
|
/**
|
|
* Form class for adding/modifying file resources
|
|
*/
|
|
class FileResourceForm extends Form
|
|
{
|
|
/**
|
|
* Initialize this form
|
|
*/
|
|
public function init()
|
|
{
|
|
$this->setName('form_config_resource_file');
|
|
}
|
|
|
|
/**
|
|
* @see Form::createElements()
|
|
*/
|
|
public function createElements(array $formData)
|
|
{
|
|
$this->addElement(
|
|
'text',
|
|
'filename',
|
|
array(
|
|
'required' => true,
|
|
'label' => t('Filepath'),
|
|
'description' => t('The filename to fetch information from'),
|
|
'validators' => array(new ReadablePathValidator())
|
|
)
|
|
);
|
|
$this->addElement(
|
|
'text',
|
|
'fields',
|
|
array(
|
|
'required' => true,
|
|
'label' => t('Pattern'),
|
|
'description' => t('The regular expression by which to identify columns')
|
|
)
|
|
);
|
|
|
|
return $this;
|
|
}
|
|
}
|