Esempio n. 1
0
 /** @test */
 function it_creates_a_form_with_fields()
 {
     $builder = $this->getBuilder();
     $this->assertFileNotExists($builder->getClassFilePath('project'));
     $builder->build('project', Collection::make([NodeField::create(['name' => 'description', 'type' => 'text', 'description' => 'Some hints', 'label' => 'Project Description', 'rules' => '\'required|max:5000\'', 'default_value' => '\'Texty text\'', 'position' => 1, 'search_priority' => 10]), NodeField::create(['name' => 'type', 'type' => 'select', 'description' => 'Some hints for type', 'label' => 'Project Type', 'position' => 2, 'options' => "'choices' => [1 => 'Housing', 2 => 'Cultural'], 'selected' => function(\$data) {return 1;}, 'empty_value' => '---no type---'", 'search_priority' => 0])]));
     $this->assertFileExists($builder->getClassFilePath('project'));
 }
Esempio n. 2
0
 protected function getNodeField($attributes = [])
 {
     $attributes = !empty($attributes) ? $attributes : ['name' => 'area', 'label' => 'Area', 'description' => '', 'type' => 'text', 'position' => 1.0, 'search_priority' => 0];
     return NodeField::create($attributes);
 }