Skip to content

Commit

Permalink
Element "simple-html" mode update.
Browse files Browse the repository at this point in the history
  • Loading branch information
ivopetkov committed Dec 20, 2021
1 parent cb84032 commit 1ebc8f3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions components/searchBoxElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,22 @@

$app = App::get();

$outputType = (string) $component->getAttribute('output-type');
$outputType = isset($outputType[0]) ? $outputType : 'full-html';
$isFullHtmlOutputType = $outputType === 'full-html';

echo '<html>';
echo '<body>';

echo '<div class="bearcms-search-box-element" style="position:relative;">';
$buttonOnClick = 'var q=this.nextSibling.value;if(q.length>0){window.location.href="' . $app->urls->get('/s/') . '"+encodeURIComponent(q)+"/";}else{this.nextSibling.focus();}';
echo '<a title="' . htmlentities(__('bearcms/search-box-element-addon/ButtonTitle')) . '" onclick="' . htmlentities($buttonOnClick) . '" class="bearcms-search-box-element-button"></a>';
echo '<input onkeyup="if(event.keyCode==13){this.previousSibling.click();}" class="bearcms-search-box-element-input" autocomplete="off" placeholder="' . htmlentities(__('bearcms/search-box-element-addon/ButtonTitle')) . '"/>';
echo '</div>';
if ($isFullHtmlOutputType) {
echo '<div class="bearcms-search-box-element" style="position:relative;">';
$buttonOnClick = 'var q=this.nextSibling.value;if(q.length>0){window.location.href="' . $app->urls->get('/s/') . '"+encodeURIComponent(q)+"/";}else{this.nextSibling.focus();}';
echo '<a title="' . htmlentities(__('bearcms/search-box-element-addon/ButtonTitle')) . '" onclick="' . htmlentities($buttonOnClick) . '" class="bearcms-search-box-element-button"></a>';
echo '<input onkeyup="if(event.keyCode==13){this.previousSibling.click();}" class="bearcms-search-box-element-input" autocomplete="off" placeholder="' . htmlentities(__('bearcms/search-box-element-addon/ButtonTitle')) . '"/>';
echo '</div>';
} else {
echo '[' . __('bearcms/search-box-element-addon/ButtonTitle') . ']';
}

echo '</body>';
echo '</html>';

0 comments on commit 1ebc8f3

Please sign in to comment.