fixed the default base page lang code bug
This commit is contained in:
parent
e993963e1c
commit
59e02b93ee
|
@ -62,7 +62,7 @@ class Base extends ControllerBase {
|
||||||
$entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
$entity_storage = \Drupal::entityTypeManager()->getStorage('node');
|
||||||
$this->query = $entity_storage->getQuery()
|
$this->query = $entity_storage->getQuery()
|
||||||
->condition('type', 'materiau')
|
->condition('type', 'materiau')
|
||||||
// ->condition('status', '1')
|
->condition('status', '1')
|
||||||
->range($this->offset, $this->limit)
|
->range($this->offset, $this->limit)
|
||||||
->accessCheck(TRUE)
|
->accessCheck(TRUE)
|
||||||
->sort('changed', 'DESC');
|
->sort('changed', 'DESC');
|
||||||
|
@ -72,7 +72,7 @@ class Base extends ControllerBase {
|
||||||
$this->count_query = $entity_storage->getQuery()
|
$this->count_query = $entity_storage->getQuery()
|
||||||
->condition('type', 'materiau')
|
->condition('type', 'materiau')
|
||||||
->accessCheck(TRUE)
|
->accessCheck(TRUE)
|
||||||
// ->condition('status', '1')
|
->condition('status', '1')
|
||||||
->count();
|
->count();
|
||||||
$this->count = $this->count_query->execute();
|
$this->count = $this->count_query->execute();
|
||||||
}
|
}
|
||||||
|
@ -143,9 +143,21 @@ class Base extends ControllerBase {
|
||||||
$this->defaultQuery();
|
$this->defaultQuery();
|
||||||
// $uuids = [];
|
// $uuids = [];
|
||||||
$nids = [];
|
$nids = [];
|
||||||
|
// Using entityTypeManager
|
||||||
|
// Get a node storage object.
|
||||||
|
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
|
||||||
|
|
||||||
foreach ($this->results as $result) {
|
foreach ($this->results as $result) {
|
||||||
// $uuids[] = $result->getField('uuid')->getValues()[0];
|
$lang = \Drupal::languageManager()->getCurrentLanguage()->getId();
|
||||||
$nids[] = $result;
|
// Load a single node.
|
||||||
|
$node = $node_storage->load($result);
|
||||||
|
// check if has translation
|
||||||
|
|
||||||
|
if ($node->hasTranslation($lang)) {
|
||||||
|
// $uuids[] = $result->getField('uuid')->getValues()[0];
|
||||||
|
$nids[] = $result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// $resp['uuids'] = $uuids;
|
// $resp['uuids'] = $uuids;
|
||||||
$resp['nids'] = $nids;
|
$resp['nids'] = $nids;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
||||||
|
* This devtool is not neither made for production nor for readable output files.
|
||||||
|
* It uses "eval()" calls to create a separate source file in the browser devtools.
|
||||||
|
* If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
|
||||||
|
* or disable the default devtool with "devtool: false".
|
||||||
|
* If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
|
||||||
|
*/
|
||||||
|
/******/ (() => { // webpackBootstrap
|
||||||
|
/******/ "use strict";
|
||||||
|
/******/ var __webpack_modules__ = ({
|
||||||
|
|
||||||
|
/***/ "./web/themes/custom/materiotheme/assets/styles/print.scss":
|
||||||
|
/*!*****************************************************************!*\
|
||||||
|
!*** ./web/themes/custom/materiotheme/assets/styles/print.scss ***!
|
||||||
|
\*****************************************************************/
|
||||||
|
/*! namespace exports */
|
||||||
|
/*! exports [not provided] [no usage info] */
|
||||||
|
/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
|
||||||
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
eval("__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://materio.com/./web/themes/custom/materiotheme/assets/styles/print.scss?");
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
/******/ });
|
||||||
|
/************************************************************************/
|
||||||
|
/******/ // The module cache
|
||||||
|
/******/ var __webpack_module_cache__ = {};
|
||||||
|
/******/
|
||||||
|
/******/ // The require function
|
||||||
|
/******/ function __webpack_require__(moduleId) {
|
||||||
|
/******/ // Check if module is in cache
|
||||||
|
/******/ if(__webpack_module_cache__[moduleId]) {
|
||||||
|
/******/ return __webpack_module_cache__[moduleId].exports;
|
||||||
|
/******/ }
|
||||||
|
/******/ // Create a new module (and put it into the cache)
|
||||||
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||||
|
/******/ // no module.id needed
|
||||||
|
/******/ // no module.loaded needed
|
||||||
|
/******/ exports: {}
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // Execute the module function
|
||||||
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
||||||
|
/******/
|
||||||
|
/******/ // Return the exports of the module
|
||||||
|
/******/ return module.exports;
|
||||||
|
/******/ }
|
||||||
|
/******/
|
||||||
|
/************************************************************************/
|
||||||
|
/******/ /* webpack/runtime/make namespace object */
|
||||||
|
/******/ (() => {
|
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = (exports) => {
|
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
|
/******/ }
|
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
/******/ };
|
||||||
|
/******/ })();
|
||||||
|
/******/
|
||||||
|
/************************************************************************/
|
||||||
|
/******/ // startup
|
||||||
|
/******/ // Load entry module
|
||||||
|
/******/ __webpack_require__("./web/themes/custom/materiotheme/assets/styles/print.scss");
|
||||||
|
/******/ // This entry module used 'exports' so it can't be inlined
|
||||||
|
/******/ })()
|
||||||
|
;
|
|
@ -1,5 +1,6 @@
|
||||||
fragment SearchResultFields on SearchResult {
|
fragment SearchResultFields on SearchResult {
|
||||||
id
|
id
|
||||||
|
uuid
|
||||||
bundle
|
bundle
|
||||||
title
|
title
|
||||||
short_description
|
short_description
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<span>Loading ...</span>
|
<span>Loading ...</span>
|
||||||
</div>
|
</div>
|
||||||
<ul v-else>
|
<ul v-else>
|
||||||
<li v-for="item in items" v-bind:key="item.uuid">
|
<li v-for="item in items" v-bind:key="item.id">
|
||||||
<Card v-if="item.bundle == 'materiau'" :item="item"/>
|
<Card v-if="item.bundle == 'materiau'" :item="item"/>
|
||||||
<CardThematique v-if="item.bundle == 'thematique'" :item="item"/>
|
<CardThematique v-if="item.bundle == 'thematique'" :item="item"/>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -40,7 +40,11 @@ export default {
|
||||||
state.uuids = []
|
state.uuids = []
|
||||||
},
|
},
|
||||||
setResults (state, items) {
|
setResults (state, items) {
|
||||||
state.items = state.items.concat(items)
|
// console.log('setResults, items', items);
|
||||||
|
if(items){ // avoid bug like items = [null]
|
||||||
|
state.items = state.items.concat(items)
|
||||||
|
}
|
||||||
|
// console.log('setResults, state.items', state.items);
|
||||||
},
|
},
|
||||||
resetItems (state) {
|
resetItems (state) {
|
||||||
state.items = []
|
state.items = []
|
||||||
|
@ -131,7 +135,7 @@ export default {
|
||||||
${ searchresultGQL }
|
${ searchresultGQL }
|
||||||
`
|
`
|
||||||
MGQ.post('', { query: print(ast) })
|
MGQ.post('', { query: print(ast) })
|
||||||
.then(( resp ) => {
|
.then(resp => {
|
||||||
console.log('loadSearchResultsGQL resp', resp )
|
console.log('loadSearchResultsGQL resp', resp )
|
||||||
dispatch("loadSearchResultsCallBack", { items: resp.data.data.searchresults})
|
dispatch("loadSearchResultsCallBack", { items: resp.data.data.searchresults})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue