コード例 #1
0
ファイル: SelectViewHelper.php プロジェクト: mia3/expose
 /**
  * Renders an option tag
  *
  * @param string $value
  * @param null | string $label
  * @param bool $selected
  * @return string
  */
 private function renderOptionTag($value, $label = null, $selected = false)
 {
     $option = new TagBuilder("option");
     $option->addAttribute('value', $value);
     $option->setContent(!is_null($label) ? $label : $value);
     if ($selected) {
         $option->addAttribute('selected', 'selected');
     }
     return $option->render();
 }
コード例 #2
0
ファイル: TagBuilderTest.php プロジェクト: typo3/fluid
 /**
  * @test
  */
 public function tagContentCanBeOverridden()
 {
     $tagBuilder = new TagBuilder('foo', 'some content');
     $tagBuilder->setContent('');
     $this->assertEquals('<foo />', $tagBuilder->render());
 }