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 */
|
||||
$nodeIds = $query
|
||||
->condition('type', self::NODE_TYPE)
|
||||
@ -198,14 +207,18 @@ class NodesController extends ControllerBase implements ContainerInjectionInterf
|
||||
->getStorage('node')
|
||||
->loadMultiple($nodeIds);
|
||||
|
||||
/* Response List */
|
||||
/* build the response list of nodes */
|
||||
$nodeList=[];
|
||||
foreach ($nodes as $node) {
|
||||
if ($node instanceof NodeInterface && $node->access('view')) {
|
||||
$tid = $node->id();
|
||||
$nodeList[$tid] = $node->hasTranslation($lang) ? $node->getTranslation($lang) : $node;
|
||||
$node->currentTranslation = $lang;
|
||||
$translatedNode = $node->hasTranslation($lang) ? $node->getTranslation($lang) : $node;
|
||||
$translatedNode->currentTranslation = $lang;
|
||||
$nodeList[$tid] = $translatedNode;
|
||||
}
|
||||
}
|
||||
return $nodeList;
|
||||
|
||||
}
|
||||
// \Drupal::logger('Bundle AAAAA')->notice(''.$some_var);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
DIR_PATH=${1}
|
||||
DIR=$(/usr/bin/basename ${DIR_PATH})
|
||||
LOG="${DIR}.log"
|
||||
LOG="${DIR}.backup.log"
|
||||
TIMESTAMP=$(/usr/bin/date +%Y/%m/%d' '%H:%M:%S)
|
||||
|
||||
#
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user