public getValue ( SelectorInterface $selector ) : string/array | ||
$selector | SelectorInterface | Criteria to apply. |
return | string/array |
public function getValue(SelectorInterface $selector)
{
for ($i = 0, $count = count($this->widgets); $i < $count; $i++) {
if ($selector->isMatch($this->widgets[$i])) {
return $this->widgets[$i]->getValue();
}
}
foreach ($this->buttons as $button) {
if ($selector->isMatch($button)) {
return $button->getValue();
}
}
return;
}
function testMultipleFieldsWithSameKey() { $form = new SimpleForm(new SimpleFormTag(array()), new SimpleUrl('htp://host')); $form->addWidget(new SimpleCheckboxTag(array('name' => 'a', 'type' => 'checkbox', 'value' => 'me'))); $form->addWidget(new SimpleCheckboxTag(array('name' => 'a', 'type' => 'checkbox', 'value' => 'you'))); $this->assertIdentical($form->getValue(new SimpleByName('a')), false); $this->assertTrue($form->setField(new SimpleByName('a'), 'me')); $this->assertIdentical($form->getValue(new SimpleByName('a')), 'me'); }