Exemplo n.º 1
0
 /**
  * Extends the set method to ensure that only Radios can be added to a RadioGroup
  *
  * @param  string $key
  * @param  mixed  $value
  *
  * @return $this
  *
  * @throws \InvalidArgumentException
  *
  * @since 2.0
  */
 public function set($key, $value)
 {
     if (!$value instanceof Radio) {
         throw new \InvalidArgumentException('Only Radios can be added to a RadioGroup');
     }
     return parent::set($key, $value);
 }
Exemplo n.º 2
0
 /**
  * Extends the set method to ensure that only Checkboxs can be added to a CheckboxGroup
  *
  * @param  string $key
  * @param  mixed  $value
  *
  * @return $this
  *
  * @throws \InvalidArgumentException
  *
  * @since 2.0
  */
 public function set($key, $value)
 {
     if (!$value instanceof Checkbox) {
         throw new \InvalidArgumentException('Only Checkboxs can be added to a CheckboxGroup');
     }
     return parent::set($key, $value);
 }
Exemplo n.º 3
0
 /**
  * @covers ::getName
  * @covers ::isAutoArray
  * @group  Fieldset
  */
 public function testChildNameSet()
 {
     $child = new Checkbox();
     $name = 'test[]';
     $this->object[] = $child;
     $this->object->setName($name);
     $this->assertEquals($name, $child->getName());
 }
Exemplo n.º 4
0
 /**
  * Renders a ToggleGroup into the table
  *
  * @param ToggleGroup $group
  *
  * @since 2.0
  */
 protected function renderToggleGroup(ToggleGroup $group)
 {
     $groupLabel = $group->getLabel();
     $this->table->addCell($groupLabel);
     // Build all the radios
     $toggles = '';
     foreach ($group as $toggle) {
         $toggles .= $toggle->getLabel() . $toggle->render($this);
     }
     $this->table->addCell($toggles);
     $this->table->addRow();
     return '';
 }