/**
  * Renders a checkbox.
  *
  * @param \Core\Form\Element\Checkbox $box
  * @param null|string $class
  *
  * @return string
  */
 protected function renderCheckbox($box, $class = null)
 {
     /* @var $renderer \Zend\View\Renderer\PhpRenderer */
     $renderer = $this->getView();
     if (null !== $class) {
         $box->setAttribute('class', $box->getAttribute('class') . ' ' . $class);
     }
     $markup = $renderer->formCheckbox($box);
     if ($desc = $box->getOption('description')) {
         $desc = $this->getTranslator()->translate($desc, $this->getTranslatorTextDomain());
         $markup .= '<div class="alert alert-info"><p>' . $desc . '</p></div>';
     }
     return $markup;
 }
 /**
  * Creates a toggle checkbox.
  *
  * @param string $name
  * @param array  $options
  *
  * @return Checkbox
  */
 protected function createCheckbox($name, $options)
 {
     $box = new Checkbox($name, $options);
     $box->setAttribute('checked', true)->setAttribute('id', preg_replace(array('~\\[~', '~\\]~', '~--+~', '~-$~'), array('-', '', '-', ''), $name));
     return $box;
 }
示例#3
0
 public function testSetGetViewHelper()
 {
     $expected = "my/view/helper";
     $this->target->setViewHelper($expected);
     $this->assertEquals($expected, $this->target->getViewHelper());
 }