|
@@ 328-343 (lines=16) @@
|
| 325 |
|
* @param string $html HTML to parse for elements |
| 326 |
|
* @return array of SimpleXMLElement objects |
| 327 |
|
*/ |
| 328 |
|
public function findSelectedOptionElements($html) { |
| 329 |
|
$options = $this->findOptionElements($html); |
| 330 |
|
|
| 331 |
|
/* Find any elements that have the "selected" attribute and put them into a list */ |
| 332 |
|
$foundSelected = array(); |
| 333 |
|
foreach($options as $option) { |
| 334 |
|
$attributes = $option->attributes(); |
| 335 |
|
if($attributes) foreach($attributes as $attribute => $value) { |
| 336 |
|
if($attribute == 'selected') { |
| 337 |
|
$foundSelected[] = $option; |
| 338 |
|
} |
| 339 |
|
} |
| 340 |
|
} |
| 341 |
|
|
| 342 |
|
return $foundSelected; |
| 343 |
|
} |
| 344 |
|
|
| 345 |
|
/** |
| 346 |
|
* Find all the <OPTION> elements from a |
|
@@ 353-368 (lines=16) @@
|
| 350 |
|
* @param string $html HTML to parse for elements |
| 351 |
|
* @return array of SimpleXMLElement objects |
| 352 |
|
*/ |
| 353 |
|
public function findDisabledOptionElements($html) { |
| 354 |
|
$options = $this->findOptionElements($html); |
| 355 |
|
|
| 356 |
|
/* Find any elements that have the "disabled" attribute and put them into a list */ |
| 357 |
|
$foundDisabled = array(); |
| 358 |
|
foreach($options as $option) { |
| 359 |
|
$attributes = $option->attributes(); |
| 360 |
|
if($attributes) foreach($attributes as $attribute => $value) { |
| 361 |
|
if($attribute == 'disabled') { |
| 362 |
|
$foundDisabled[] = $option; |
| 363 |
|
} |
| 364 |
|
} |
| 365 |
|
} |
| 366 |
|
|
| 367 |
|
return $foundDisabled; |
| 368 |
|
} |
| 369 |
|
|
| 370 |
|
public function testValidation() { |
| 371 |
|
$field = DropdownField::create('Test', 'Testing', array( |