Only show CaptureMethod if there is more than 1 option

pull/4108/head
Isaac Connor 2024-07-25 12:37:45 -04:00
parent d1e8975e41
commit b613d562bf
1 changed files with 9 additions and 10 deletions

View File

@ -654,21 +654,20 @@ switch ($name) {
<?php echo ($monitor->Device() and isset($devices[$monitor->Device()]) ) ? 'style="display: none;"' : '' ?>
/>
</li>
<li>
<label><?php echo translate('CaptureMethod') ?></label>
<?php
<?php
$localMethods = array(
'v4l2' => 'Video For Linux version 2',
);
if (!ZM_HAS_V4L2)
unset($localMethods['v4l2']);
if (!isset($localMethods[$monitor->Method()])) $monitor->Method('v4l2');
echo htmlSelect('newMonitor[Method]', $localMethods,
((count($localMethods)==1) ? array_keys($localMethods)[0] : $monitor->Method()),
array('data-on-change'=>'submitTab', 'data-tab-name'=>$tab) );
?>
</li>
<?php
if (!isset($localMethods[$monitor->Method()])) $monitor->Method(array_keys($localMethods)[0]);
if (count($localMethods)>1) {
echo '<li><label>'.translate('CaptureMethod').'</label>';
echo htmlSelect('newMonitor[Method]', $localMethods, $monitor->Method(), ['data-on-change'=>'submitTab', 'data-tab-name'=>$tab] );
echo '</li>'.PHP_EOL;
} else {
echo '<input type="hidden" name="newMonitor[Method]" value="'.validHtmlStr($monitor->Method()).'"/>'.PHP_EOL;
}
if ( ZM_HAS_V4L2 && $monitor->Method() == 'v4l2' ) {
?>
<li>