Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
184 additions
and
31 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/field_row.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<tr> | ||
<td> | ||
<?php echo $view['form']->label($form, isset($label) ? $label : null) ?> | ||
</td> | ||
<td> | ||
<?php echo $view['form']->errors($form) ?> | ||
<?php echo $view['form']->widget($form) ?> | ||
</td> | ||
</tr> |
7 changes: 7 additions & 0 deletions
7
src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_errors.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php if (0 < count($errors)) : ?> | ||
<tr> | ||
<td colspan="2"> | ||
<?php echo $view['form']->renderBlock('field_errors'); ?> | ||
</td> | ||
</tr> | ||
<?php endif; ?> |
5 changes: 5 additions & 0 deletions
5
src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_widget.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<table <?php echo $view['form']->renderBlock('container_attributes') ?>> | ||
<?php echo $view['form']->renderBlock('field_rows') ?> | ||
<?php echo $view['form']->rest($form) ?> | ||
</table> | ||
|
6 changes: 6 additions & 0 deletions
6
src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/hidden_row.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<tr style="display: none"> | ||
<td colspan="2"> | ||
<?php echo $view['form']->widget($form) ?> | ||
</td> | ||
</tr> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper; | ||
|
||
require_once __DIR__.'/Fixtures/StubTemplateNameParser.php'; | ||
require_once __DIR__.'/Fixtures/StubTranslator.php'; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper; | ||
use Symfony\Bundle\FrameworkBundle\Templating\Helper\TranslatorHelper; | ||
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTemplateNameParser; | ||
use Symfony\Bundle\FrameworkBundle\Tests\Templating\Helper\Fixtures\StubTranslator; | ||
use Symfony\Component\Form\FormView; | ||
use Symfony\Component\Templating\PhpEngine; | ||
use Symfony\Component\Templating\TemplateNameParser; | ||
use Symfony\Component\Templating\Loader\FilesystemLoader; | ||
use Symfony\Tests\Component\Form\AbstractTableLayoutTest; | ||
|
||
class FormHelperTableTest extends AbstractTableLayoutTest | ||
{ | ||
protected $helper; | ||
|
||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$root = realpath(__DIR__.'/../../../Resources/views'); | ||
$rootCustom = realpath(__DIR__.'/Resources'); | ||
$templateNameParser = new StubTemplateNameParser($root, $rootCustom); | ||
$loader = new FilesystemLoader(array()); | ||
$engine = new PhpEngine($templateNameParser, $loader); | ||
|
||
$this->helper = new FormHelper($engine, array( | ||
'FrameworkBundle:Form', | ||
'FrameworkBundle:FormTable' | ||
)); | ||
|
||
$engine->setHelpers(array( | ||
$this->helper, | ||
new TranslatorHelper(new StubTranslator()), | ||
)); | ||
} | ||
|
||
protected function tearDown() | ||
{ | ||
$this->helper = null; | ||
} | ||
|
||
protected function renderEnctype(FormView $view) | ||
{ | ||
return (string)$this->helper->enctype($view); | ||
} | ||
|
||
protected function renderLabel(FormView $view, $label = null, array $vars = array()) | ||
{ | ||
return (string)$this->helper->label($view, $label, $vars); | ||
} | ||
|
||
protected function renderErrors(FormView $view) | ||
{ | ||
return (string)$this->helper->errors($view); | ||
} | ||
|
||
protected function renderWidget(FormView $view, array $vars = array()) | ||
{ | ||
return (string)$this->helper->widget($view, $vars); | ||
} | ||
|
||
protected function renderRow(FormView $view, array $vars = array()) | ||
{ | ||
return (string)$this->helper->row($view, $vars); | ||
} | ||
|
||
protected function renderRest(FormView $view, array $vars = array()) | ||
{ | ||
return (string)$this->helper->rest($view, $vars); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters