Skip to content

Commit

Permalink
lib: Ignore required attribute on lists an checkboxes
Browse files Browse the repository at this point in the history
References RSS-Bridge#1014
  • Loading branch information
logmanoriginal committed Jan 22, 2019
1 parent 42a1cc1 commit e5d050f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/BridgeCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ private static function getNumberInput($entry, $id, $name) {
* @return string The list input field
*/
private static function getListInput($entry, $id, $name) {
if(isset($entry['required'])) {
Debug::log('The "required" attribute is not supported for lists.');
unset($entry['required']);
}

$list = '<select '
. self::getInputAttributes($entry)
. ' id="'
Expand Down Expand Up @@ -267,6 +272,11 @@ private static function getListInput($entry, $id, $name) {
* @return string The checkbox input field
*/
private static function getCheckboxInput($entry, $id, $name) {
if(isset($entry['required'])) {
Debug::log('The "required" attribute is not supported for checkboxes.');
unset($entry['required']);
}

return '<input '
. self::getInputAttributes($entry)
. ' id="'
Expand Down
5 changes: 4 additions & 1 deletion lib/ParameterValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ public function getQueriedContext($data, $parameters){
if(isset($data[$id]) && !empty($data[$id])) {
$queriedContexts[$context] = true;
} elseif(isset($properties['required'])
&& $properties['required'] === true) {
&& $properties['required'] === true
&& isset($properties['type'])
&& $properties['type'] !== 'checkbox'
&& $properties['type'] !== 'list') {
$queriedContexts[$context] = false;
break;
}
Expand Down

0 comments on commit e5d050f

Please sign in to comment.