more good code
This commit is contained in:
parent
31d1c745b8
commit
b718cd36e3
@ -187,6 +187,15 @@ class NodesController extends ControllerBase implements ContainerInjectionInterf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* pager: ?offset=0&limit=3 */
|
||||||
|
$offset = $request->get('offset');
|
||||||
|
$limit = $request->get('limit');
|
||||||
|
if (isset($offset) && isset($limit)) {
|
||||||
|
$offset = intval($offset);
|
||||||
|
$limit = intval($limit);
|
||||||
|
$query->range($offset, $limit);
|
||||||
|
}
|
||||||
|
|
||||||
/* execute query to get node ids */
|
/* execute query to get node ids */
|
||||||
$nodeIds = $query
|
$nodeIds = $query
|
||||||
->condition('type', self::NODE_TYPE)
|
->condition('type', self::NODE_TYPE)
|
||||||
@ -198,14 +207,18 @@ class NodesController extends ControllerBase implements ContainerInjectionInterf
|
|||||||
->getStorage('node')
|
->getStorage('node')
|
||||||
->loadMultiple($nodeIds);
|
->loadMultiple($nodeIds);
|
||||||
|
|
||||||
/* Response List */
|
/* build the response list of nodes */
|
||||||
$nodeList=[];
|
$nodeList=[];
|
||||||
foreach ($nodes as $node) {
|
foreach ($nodes as $node) {
|
||||||
|
if ($node instanceof NodeInterface && $node->access('view')) {
|
||||||
$tid = $node->id();
|
$tid = $node->id();
|
||||||
$nodeList[$tid] = $node->hasTranslation($lang) ? $node->getTranslation($lang) : $node;
|
$translatedNode = $node->hasTranslation($lang) ? $node->getTranslation($lang) : $node;
|
||||||
$node->currentTranslation = $lang;
|
$translatedNode->currentTranslation = $lang;
|
||||||
|
$nodeList[$tid] = $translatedNode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $nodeList;
|
return $nodeList;
|
||||||
|
|
||||||
}
|
}
|
||||||
// \Drupal::logger('Bundle AAAAA')->notice(''.$some_var);
|
// \Drupal::logger('Bundle AAAAA')->notice(''.$some_var);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
DIR_PATH=${1}
|
DIR_PATH=${1}
|
||||||
DIR=$(/usr/bin/basename ${DIR_PATH})
|
DIR=$(/usr/bin/basename ${DIR_PATH})
|
||||||
LOG="${DIR}.log"
|
LOG="${DIR}.backup.log"
|
||||||
TIMESTAMP=$(/usr/bin/date +%Y/%m/%d' '%H:%M:%S)
|
TIMESTAMP=$(/usr/bin/date +%Y/%m/%d' '%H:%M:%S)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user