Server : Apache System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : palandch ( 1163) PHP Version : 7.1.33 Disable Function : NONE Directory : /home/palandch/www/core/model/modx/processors/workspace/lexicon/topic/ |
<?php /** * Gets a list of lexicon topics * * @param string $namespace (optional) Filters by this namespace. Defaults to * core. * @param string $name (optional) If set, will search by this name. * @param integer $start (optional) The record to start at. Defaults to 0. * @param integer $limit (optional) The number of records to limit to. Defaults * to 10. * * @package modx * @subpackage processors.workspace.lexicon.topic */ class modLexiconTopicGetListProcessor extends modProcessor { public function checkPermissions() { return $this->modx->hasPermission('lexicons'); } public function getLanguageTopics() { return array('lexicon'); } public function initialize() { $this->setDefaultProperties(array( 'limit' => 10, 'start' => 0, 'namespace' => 'core', 'language' => 'en', )); return parent::initialize(); } public function process() { $data = $this->getData(); $list = array(); foreach ($data['results'] as $topic) { $list[] = array( 'name' => $topic, ); } return $this->outputArray($list,$data['total']); } public function getData() { $data = array(); $data['results'] = $this->modx->lexicon->getTopicList($this->getProperty('language'),$this->getProperty('namespace')); $data['total'] = count($data['results']); $limit = $this->getProperty('limit'); if ($limit > 0) { $data['results'] = array_slice($data['results'],$this->getProperty('start'),$limit,true); } return $data; } } return 'modLexiconTopicGetListProcessor';