addBehavior('initWidgets', ['sabaWidget', 'setWidget']); class sabaWidget { public static function setWidget($w) { $w ->create( 'saba', __('Advanced search'), ['sabaWidget', 'getWidget'], null, __('Add more search options on public side') ) ->addTitle(__('Search')) ->setting( 'saba_filter_types', __('Disable filter on post types'), 0, 'check' ) ->setting('saba_remove_types', __('Hidden types:'), '') ->setting( 'saba_filter_options', __('Disable filter on post options'), 0, 'check' ) ->setting('saba_remove_options', __('Hidden options:'), '') ->setting( 'saba_filter_categories', __('Disable filter on categories'), 0, 'check' ) ->setting('saba_remove_categories', __('Hidden categories:'), '') ->setting( 'saba_filter_authors', __('Disable filter on authors'), 0, 'check' ) ->setting('saba_remove_authors', __('Hidden authors:'), '') ->setting( 'saba_filter_orders', __('Disable filter on order'), 0, 'check' ) ->setting( 'saba_filter_ages', __('Disable filter on age'), 0, 'check' ) ->addContentOnly() ->addClass() ->addOffline(); } public static function getWidget($w) { dcCore::app()->blog->settings->addNamespace('saba'); if (!dcCore::app()->blog->settings->saba->active) { return; } if (!dcCore::app()->blog->settings->saba->error && dcCore::app()->url->type == '404') { return; } if ($w->offline) { return; } $q = dcCore::app()->ctx->saba_otpion ?? ''; # title and search $res = ($w->title ? $w->renderTitle('') : '') . '
'; return $w->renderDiv($w->content_only, $w->class, 'id="search"', $res); } }