Code Duplication    Length = 64-92 lines in 3 locations

typo3/sysext/backend/Classes/View/PageLayoutView.php 1 location

@@ 3149-3240 (lines=92) @@
3146
     * @param bool $formFields If TRUE, the search box is wrapped in its own form-tags
3147
     * @return string HTML for the search box
3148
     */
3149
    public function getSearchBox($formFields = true)
3150
    {
3151
        /** @var $iconFactory IconFactory */
3152
        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
3153
        $lang = $this->getLanguageService();
3154
        // Setting form-elements, if applicable:
3155
        $formElements = ['', ''];
3156
        if ($formFields) {
3157
            $formElements = [
3158
                '<form action="' . htmlspecialchars(
3159
                    $this->listURL('', '-1', 'firstElementNumber,search_field')
3160
                ) . '" method="post">',
3161
                '</form>'
3162
            ];
3163
        }
3164
        // Make level selector:
3165
        $opt = [];
3166
3167
        // "New" generation of search levels ... based on TS config
3168
        $config = BackendUtility::getPagesTSconfig($this->id);
3169
        $searchLevelsFromTSconfig = $config['mod.']['web_list.']['searchLevel.']['items.'];
3170
        $searchLevelItems = [];
3171
3172
        // get translated labels for search levels from pagets
3173
        foreach ($searchLevelsFromTSconfig as $keySearchLevel => $labelConfigured) {
3174
            $label = $lang->sL('LLL:' . $labelConfigured);
3175
            if ($label === '') {
3176
                $label = $labelConfigured;
3177
            }
3178
            $searchLevelItems[$keySearchLevel] = $label;
3179
        }
3180
3181
        foreach ($searchLevelItems as $kv => $label) {
3182
            $opt[] = '<option value="' . $kv . '"' . ($kv === $this->searchLevels ? ' selected="selected"' : '') . '>' . htmlspecialchars(
3183
                    $label
3184
                ) . '</option>';
3185
        }
3186
        $lMenu = '<select class="form-control" name="search_levels" title="' . htmlspecialchars(
3187
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.search_levels')
3188
            ) . '" id="search_levels">' . implode('', $opt) . '</select>';
3189
        // Table with the search box:
3190
        $content = '<div class="db_list-searchbox-form db_list-searchbox-toolbar module-docheader-bar module-docheader-bar-search t3js-module-docheader-bar t3js-module-docheader-bar-search" id="db_list-searchbox-toolbar" style="display: ' . ($this->searchString == '' ? 'none' : 'block') . ';">
3191
			' . $formElements[0] . '
3192
                <div id="typo3-dblist-search">
3193
                    <div class="panel panel-default">
3194
                        <div class="panel-body">
3195
                            <div class="row">
3196
                                <div class="form-group col-xs-12">
3197
                                    <label for="search_field">' . htmlspecialchars(
3198
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.label.searchString')
3199
            ) . ': </label>
3200
									<input class="form-control" type="search" placeholder="' . htmlspecialchars(
3201
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.enterSearchString')
3202
            ) . '" title="' . htmlspecialchars(
3203
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.searchString')
3204
            ) . '" name="search_field" id="search_field" value="' . htmlspecialchars($this->searchString) . '" />
3205
                                </div>
3206
                                <div class="form-group col-xs-12 col-sm-6">
3207
									<label for="search_levels">' . htmlspecialchars(
3208
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.label.search_levels')
3209
            ) . ': </label>
3210
									' . $lMenu . '
3211
                                </div>
3212
                                <div class="form-group col-xs-12 col-sm-6">
3213
									<label for="showLimit">' . htmlspecialchars(
3214
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.label.limit')
3215
            ) . ': </label>
3216
									<input class="form-control" type="number" min="0" max="10000" placeholder="10" title="' . htmlspecialchars(
3217
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.limit')
3218
            ) . '" name="showLimit" id="showLimit" value="' . htmlspecialchars(
3219
                ($this->showLimit ? $this->showLimit : '')
3220
            ) . '" />
3221
                                </div>
3222
                                <div class="form-group col-xs-12">
3223
                                    <div class="form-control-wrap">
3224
                                        <button type="submit" class="btn btn-default" name="search" title="' . htmlspecialchars(
3225
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.search')
3226
            ) . '">
3227
                                            ' . $iconFactory->getIcon('actions-search', Icon::SIZE_SMALL)->render(
3228
            ) . ' ' . htmlspecialchars(
3229
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.search')
3230
            ) . '
3231
                                        </button>
3232
                                    </div>
3233
                                </div>
3234
                            </div>
3235
                        </div>
3236
                    </div>
3237
                </div>
3238
			' . $formElements[1] . '</div>';
3239
        return $content;
3240
    }
3241
3242
    /**
3243
     * Setting the field names to display in extended list.

typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php 1 location

@@ 595-658 (lines=64) @@
592
     * @return string HTML for the search box
593
     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10
594
     */
595
    public function getSearchBox($formFields = true)
596
    {
597
        /** @var $iconFactory IconFactory */
598
        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
599
        $lang = $this->getLanguageService();
600
        // Setting form-elements, if applicable:
601
        $formElements = ['', ''];
602
        if ($formFields) {
603
            $formElements = ['<form action="' . htmlspecialchars($this->listURL('', '-1', 'firstElementNumber,search_field')) . '" method="post">', '</form>'];
604
        }
605
        // Make level selector:
606
        $opt = [];
607
608
        // "New" generation of search levels ... based on TS config
609
        $config = BackendUtility::getPagesTSconfig($this->id);
610
        $searchLevelsFromTSconfig = $config['mod.']['web_list.']['searchLevel.']['items.'];
611
        $searchLevelItems = [];
612
613
        // get translated labels for search levels from pagets
614
        foreach ($searchLevelsFromTSconfig as $keySearchLevel => $labelConfigured) {
615
            $label = $lang->sL('LLL:' . $labelConfigured);
616
            if ($label === '') {
617
                $label = $labelConfigured;
618
            }
619
            $searchLevelItems[$keySearchLevel] = $label;
620
        }
621
622
        foreach ($searchLevelItems as $kv => $label) {
623
            $opt[] = '<option value="' . $kv . '"' . ($kv === $this->searchLevels ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>';
624
        }
625
        $lMenu = '<select class="form-control" name="search_levels" title="' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.search_levels')) . '" id="search_levels">' . implode('', $opt) . '</select>';
626
        // Table with the search box:
627
        $content = '<div class="db_list-searchbox-form db_list-searchbox-toolbar module-docheader-bar module-docheader-bar-search t3js-module-docheader-bar t3js-module-docheader-bar-search" id="db_list-searchbox-toolbar" style="display: ' . ($this->searchString == '' ? 'none' : 'block') . ';">
628
			' . $formElements[0] . '
629
                <div id="typo3-dblist-search">
630
                    <div class="panel panel-default">
631
                        <div class="panel-body">
632
                            <div class="row">
633
                                <div class="form-group col-xs-12">
634
                                    <label for="search_field">' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.label.searchString')) . ': </label>
635
									<input class="form-control" type="search" placeholder="' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.enterSearchString')) . '" title="' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.searchString')) . '" name="search_field" id="search_field" value="' . htmlspecialchars($this->searchString) . '" />
636
                                </div>
637
                                <div class="form-group col-xs-12 col-sm-6">
638
									<label for="search_levels">' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.label.search_levels')) . ': </label>
639
									' . $lMenu . '
640
                                </div>
641
                                <div class="form-group col-xs-12 col-sm-6">
642
									<label for="showLimit">' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.label.limit')) . ': </label>
643
									<input class="form-control" type="number" min="0" max="10000" placeholder="10" title="' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.limit')) . '" name="showLimit" id="showLimit" value="' . htmlspecialchars(($this->showLimit ? $this->showLimit : '')) . '" />
644
                                </div>
645
                                <div class="form-group col-xs-12">
646
                                    <div class="form-control-wrap">
647
                                        <button type="submit" class="btn btn-default" name="search" title="' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.search')) . '">
648
                                            ' . $iconFactory->getIcon('actions-search', Icon::SIZE_SMALL)->render() . ' ' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.search')) . '
649
                                        </button>
650
                                    </div>
651
                                </div>
652
                            </div>
653
                        </div>
654
                    </div>
655
                </div>
656
			' . $formElements[1] . '</div>';
657
        return $content;
658
    }
659
660
    /******************************
661
     *

typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php 1 location

@@ 3009-3100 (lines=92) @@
3006
     * @param bool $formFields If TRUE, the search box is wrapped in its own form-tags
3007
     * @return string HTML for the search box
3008
     */
3009
    public function getSearchBox($formFields = true)
3010
    {
3011
        /** @var $iconFactory IconFactory */
3012
        $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
3013
        $lang = $this->getLanguageService();
3014
        // Setting form-elements, if applicable:
3015
        $formElements = ['', ''];
3016
        if ($formFields) {
3017
            $formElements = [
3018
                '<form action="' . htmlspecialchars(
3019
                    $this->listURL('', '-1', 'firstElementNumber,search_field')
3020
                ) . '" method="post">',
3021
                '</form>'
3022
            ];
3023
        }
3024
        // Make level selector:
3025
        $opt = [];
3026
3027
        // "New" generation of search levels ... based on TS config
3028
        $config = BackendUtility::getPagesTSconfig($this->id);
3029
        $searchLevelsFromTSconfig = $config['mod.']['web_list.']['searchLevel.']['items.'];
3030
        $searchLevelItems = [];
3031
3032
        // get translated labels for search levels from pagets
3033
        foreach ($searchLevelsFromTSconfig as $keySearchLevel => $labelConfigured) {
3034
            $label = $lang->sL('LLL:' . $labelConfigured);
3035
            if ($label === '') {
3036
                $label = $labelConfigured;
3037
            }
3038
            $searchLevelItems[$keySearchLevel] = $label;
3039
        }
3040
3041
        foreach ($searchLevelItems as $kv => $label) {
3042
            $opt[] = '<option value="' . $kv . '"' . ($kv === $this->searchLevels ? ' selected="selected"' : '') . '>' . htmlspecialchars(
3043
                    $label
3044
                ) . '</option>';
3045
        }
3046
        $lMenu = '<select class="form-control" name="search_levels" title="' . htmlspecialchars(
3047
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.search_levels')
3048
            ) . '" id="search_levels">' . implode('', $opt) . '</select>';
3049
        // Table with the search box:
3050
        $content = '<div class="db_list-searchbox-form db_list-searchbox-toolbar module-docheader-bar module-docheader-bar-search t3js-module-docheader-bar t3js-module-docheader-bar-search" id="db_list-searchbox-toolbar" style="display: ' . ($this->searchString == '' ? 'none' : 'block') . ';">
3051
			' . $formElements[0] . '
3052
                <div id="typo3-dblist-search">
3053
                    <div class="panel panel-default">
3054
                        <div class="panel-body">
3055
                            <div class="row">
3056
                                <div class="form-group col-xs-12">
3057
                                    <label for="search_field">' . htmlspecialchars(
3058
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.label.searchString')
3059
            ) . ': </label>
3060
									<input class="form-control" type="search" placeholder="' . htmlspecialchars(
3061
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.enterSearchString')
3062
            ) . '" title="' . htmlspecialchars(
3063
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.searchString')
3064
            ) . '" name="search_field" id="search_field" value="' . htmlspecialchars($this->searchString) . '" />
3065
                                </div>
3066
                                <div class="form-group col-xs-12 col-sm-6">
3067
									<label for="search_levels">' . htmlspecialchars(
3068
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.label.search_levels')
3069
            ) . ': </label>
3070
									' . $lMenu . '
3071
                                </div>
3072
                                <div class="form-group col-xs-12 col-sm-6">
3073
									<label for="showLimit">' . htmlspecialchars(
3074
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.label.limit')
3075
            ) . ': </label>
3076
									<input class="form-control" type="number" min="0" max="10000" placeholder="10" title="' . htmlspecialchars(
3077
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.limit')
3078
            ) . '" name="showLimit" id="showLimit" value="' . htmlspecialchars(
3079
                ($this->showLimit ? $this->showLimit : '')
3080
            ) . '" />
3081
                                </div>
3082
                                <div class="form-group col-xs-12">
3083
                                    <div class="form-control-wrap">
3084
                                        <button type="submit" class="btn btn-default" name="search" title="' . htmlspecialchars(
3085
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.title.search')
3086
            ) . '">
3087
                                            ' . $iconFactory->getIcon('actions-search', Icon::SIZE_SMALL)->render(
3088
            ) . ' ' . htmlspecialchars(
3089
                $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.search')
3090
            ) . '
3091
                                        </button>
3092
                                    </div>
3093
                                </div>
3094
                            </div>
3095
                        </div>
3096
                    </div>
3097
                </div>
3098
			' . $formElements[1] . '</div>';
3099
        return $content;
3100
    }
3101
3102
    /**
3103
     * Setting the field names to display in extended list.