Merge "Add Wvui Config to show/hide thumbnails and descriptions"
This commit is contained in:
commit
b8e8655af3
|
@ -39,6 +39,19 @@ class Hooks {
|
|||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes config variables to skins.vector.search ResourceLoader module.
|
||||
* @param ResourceLoaderContext $context
|
||||
* @param Config $config
|
||||
* @return array
|
||||
*/
|
||||
public static function getVectorWvuiSearchResourceLoaderConfig(
|
||||
ResourceLoaderContext $context,
|
||||
Config $config
|
||||
) {
|
||||
return $config->get( 'VectorWvuiSearchOptions' );
|
||||
}
|
||||
|
||||
/**
|
||||
* BeforePageDisplayMobile hook handler
|
||||
*
|
||||
|
@ -354,7 +367,11 @@ class Hooks {
|
|||
],
|
||||
"packageFiles" => [
|
||||
"resources/skins.vector.search/skins.vector.search.js",
|
||||
"resources/skins.vector.search/App.vue"
|
||||
"resources/skins.vector.search/App.vue",
|
||||
[
|
||||
"name" => "resources/skins.vector.search/config.json",
|
||||
"callback" => "Vector\\Hooks::getVectorWvuiSearchResourceLoaderConfig"
|
||||
]
|
||||
],
|
||||
"dependencies" => [
|
||||
"wvui"
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
:button-label="$i18n( 'search' ).escaped()"
|
||||
:form-action="action"
|
||||
:search-language="language"
|
||||
:show-thumbnail="showThumbnail"
|
||||
:show-description="showDescription"
|
||||
>
|
||||
<input type="hidden"
|
||||
name="title"
|
||||
|
@ -80,6 +82,14 @@ module.exports = {
|
|||
*/
|
||||
searchQuery: {
|
||||
type: String
|
||||
},
|
||||
showThumbnail: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showDescription: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
// Placeholder for ResourceLoader Virutal Config which is populated from the server.
|
||||
// See `VectorWvuiSearchOptions` config in Vector/skin.json for the options that are included.
|
||||
export {};
|
|
@ -1,6 +1,7 @@
|
|||
var
|
||||
Vue = require( 'vue' ).default || require( 'vue' ),
|
||||
App = require( './App.vue' );
|
||||
App = require( './App.vue' ),
|
||||
config = require( './config.json' );
|
||||
|
||||
/**
|
||||
* @param {HTMLElement} searchForm
|
||||
|
@ -18,14 +19,17 @@ function initApp( searchForm, search ) {
|
|||
*/
|
||||
render: function ( createElement ) {
|
||||
return createElement( App, {
|
||||
props: {
|
||||
props: $.extend( {
|
||||
autofocusInput: search === document.activeElement,
|
||||
action: searchForm.getAttribute( 'action' ),
|
||||
searchAccessKey: search.getAttribute( 'accessKey' ),
|
||||
searchTitle: search.getAttribute( 'title' ),
|
||||
searchPlaceholder: search.getAttribute( 'placeholder' ),
|
||||
searchQuery: search.value
|
||||
}
|
||||
},
|
||||
// Pass additional config from server.
|
||||
config
|
||||
)
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
|
Loading…
Reference in New Issue