[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Administrator 5 * @subpackage com_content 6 * 7 * @copyright (C) 2008 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Component\Content\Administrator\Model; 12 13 use Joomla\CMS\Component\ComponentHelper; 14 use Joomla\CMS\Factory; 15 use Joomla\CMS\Language\Associations; 16 use Joomla\CMS\Language\Text; 17 use Joomla\CMS\MVC\Model\ListModel; 18 use Joomla\CMS\Plugin\PluginHelper; 19 use Joomla\CMS\Table\Table; 20 use Joomla\Component\Content\Administrator\Extension\ContentComponent; 21 use Joomla\Database\ParameterType; 22 use Joomla\Registry\Registry; 23 use Joomla\Utilities\ArrayHelper; 24 25 // phpcs:disable PSR1.Files.SideEffects 26 \defined('_JEXEC') or die; 27 // phpcs:enable PSR1.Files.SideEffects 28 29 /** 30 * Methods supporting a list of article records. 31 * 32 * @since 1.6 33 */ 34 class ArticlesModel extends ListModel 35 { 36 /** 37 * Constructor. 38 * 39 * @param array $config An optional associative array of configuration settings. 40 * 41 * @since 1.6 42 * @see \Joomla\CMS\MVC\Controller\BaseController 43 */ 44 public function __construct($config = array()) 45 { 46 if (empty($config['filter_fields'])) { 47 $config['filter_fields'] = array( 48 'id', 'a.id', 49 'title', 'a.title', 50 'alias', 'a.alias', 51 'checked_out', 'a.checked_out', 52 'checked_out_time', 'a.checked_out_time', 53 'catid', 'a.catid', 'category_title', 54 'state', 'a.state', 55 'access', 'a.access', 'access_level', 56 'created', 'a.created', 57 'modified', 'a.modified', 58 'created_by', 'a.created_by', 59 'created_by_alias', 'a.created_by_alias', 60 'ordering', 'a.ordering', 61 'featured', 'a.featured', 62 'featured_up', 'fp.featured_up', 63 'featured_down', 'fp.featured_down', 64 'language', 'a.language', 65 'hits', 'a.hits', 66 'publish_up', 'a.publish_up', 67 'publish_down', 'a.publish_down', 68 'published', 'a.published', 69 'author_id', 70 'category_id', 71 'level', 72 'tag', 73 'rating_count', 'rating', 74 'stage', 'wa.stage_id', 75 'ws.title' 76 ); 77 78 if (Associations::isEnabled()) { 79 $config['filter_fields'][] = 'association'; 80 } 81 } 82 83 parent::__construct($config); 84 } 85 86 /** 87 * Get the filter form 88 * 89 * @param array $data data 90 * @param boolean $loadData load current data 91 * 92 * @return \Joomla\CMS\Form\Form|null The Form object or null if the form can't be found 93 * 94 * @since 3.2 95 */ 96 public function getFilterForm($data = array(), $loadData = true) 97 { 98 $form = parent::getFilterForm($data, $loadData); 99 100 $params = ComponentHelper::getParams('com_content'); 101 102 if (!$params->get('workflow_enabled')) { 103 $form->removeField('stage', 'filter'); 104 } else { 105 $ordering = $form->getField('fullordering', 'list'); 106 107 $ordering->addOption('JSTAGE_ASC', ['value' => 'ws.title ASC']); 108 $ordering->addOption('JSTAGE_DESC', ['value' => 'ws.title DESC']); 109 } 110 111 return $form; 112 } 113 114 /** 115 * Method to auto-populate the model state. 116 * 117 * Note. Calling getState in this method will result in recursion. 118 * 119 * @param string $ordering An optional ordering field. 120 * @param string $direction An optional direction (asc|desc). 121 * 122 * @return void 123 * 124 * @since 1.6 125 */ 126 protected function populateState($ordering = 'a.id', $direction = 'desc') 127 { 128 $app = Factory::getApplication(); 129 130 $forcedLanguage = $app->input->get('forcedLanguage', '', 'cmd'); 131 132 // Adjust the context to support modal layouts. 133 if ($layout = $app->input->get('layout')) { 134 $this->context .= '.' . $layout; 135 } 136 137 // Adjust the context to support forced languages. 138 if ($forcedLanguage) { 139 $this->context .= '.' . $forcedLanguage; 140 } 141 142 $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); 143 $this->setState('filter.search', $search); 144 145 $featured = $this->getUserStateFromRequest($this->context . '.filter.featured', 'filter_featured', ''); 146 $this->setState('filter.featured', $featured); 147 148 $published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', ''); 149 $this->setState('filter.published', $published); 150 151 $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level'); 152 $this->setState('filter.level', $level); 153 154 $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', ''); 155 $this->setState('filter.language', $language); 156 157 $formSubmitted = $app->input->post->get('form_submitted'); 158 159 // Gets the value of a user state variable and sets it in the session 160 $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access'); 161 $this->getUserStateFromRequest($this->context . '.filter.author_id', 'filter_author_id'); 162 $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id'); 163 $this->getUserStateFromRequest($this->context . '.filter.tag', 'filter_tag', ''); 164 165 if ($formSubmitted) { 166 $access = $app->input->post->get('access'); 167 $this->setState('filter.access', $access); 168 169 $authorId = $app->input->post->get('author_id'); 170 $this->setState('filter.author_id', $authorId); 171 172 $categoryId = $app->input->post->get('category_id'); 173 $this->setState('filter.category_id', $categoryId); 174 175 $tag = $app->input->post->get('tag'); 176 $this->setState('filter.tag', $tag); 177 } 178 179 // List state information. 180 parent::populateState($ordering, $direction); 181 182 // Force a language 183 if (!empty($forcedLanguage)) { 184 $this->setState('filter.language', $forcedLanguage); 185 $this->setState('filter.forcedLanguage', $forcedLanguage); 186 } 187 } 188 189 /** 190 * Method to get a store id based on model configuration state. 191 * 192 * This is necessary because the model is used by the component and 193 * different modules that might need different sets of data or different 194 * ordering requirements. 195 * 196 * @param string $id A prefix for the store id. 197 * 198 * @return string A store id. 199 * 200 * @since 1.6 201 */ 202 protected function getStoreId($id = '') 203 { 204 // Compile the store id. 205 $id .= ':' . $this->getState('filter.search'); 206 $id .= ':' . serialize($this->getState('filter.access')); 207 $id .= ':' . $this->getState('filter.published'); 208 $id .= ':' . serialize($this->getState('filter.category_id')); 209 $id .= ':' . serialize($this->getState('filter.author_id')); 210 $id .= ':' . $this->getState('filter.language'); 211 $id .= ':' . serialize($this->getState('filter.tag')); 212 213 return parent::getStoreId($id); 214 } 215 216 /** 217 * Build an SQL query to load the list data. 218 * 219 * @return \Joomla\Database\DatabaseQuery 220 * 221 * @since 1.6 222 */ 223 protected function getListQuery() 224 { 225 // Create a new query object. 226 $db = $this->getDatabase(); 227 $query = $db->getQuery(true); 228 $user = Factory::getUser(); 229 230 $params = ComponentHelper::getParams('com_content'); 231 232 // Select the required fields from the table. 233 $query->select( 234 $this->getState( 235 'list.select', 236 [ 237 $db->quoteName('a.id'), 238 $db->quoteName('a.asset_id'), 239 $db->quoteName('a.title'), 240 $db->quoteName('a.alias'), 241 $db->quoteName('a.checked_out'), 242 $db->quoteName('a.checked_out_time'), 243 $db->quoteName('a.catid'), 244 $db->quoteName('a.state'), 245 $db->quoteName('a.access'), 246 $db->quoteName('a.created'), 247 $db->quoteName('a.created_by'), 248 $db->quoteName('a.created_by_alias'), 249 $db->quoteName('a.modified'), 250 $db->quoteName('a.ordering'), 251 $db->quoteName('a.featured'), 252 $db->quoteName('a.language'), 253 $db->quoteName('a.hits'), 254 $db->quoteName('a.publish_up'), 255 $db->quoteName('a.publish_down'), 256 $db->quoteName('a.introtext'), 257 $db->quoteName('a.fulltext'), 258 $db->quoteName('a.note'), 259 $db->quoteName('a.images'), 260 $db->quoteName('a.metakey'), 261 $db->quoteName('a.metadesc'), 262 $db->quoteName('a.metadata'), 263 $db->quoteName('a.version'), 264 ] 265 ) 266 ) 267 ->select( 268 [ 269 $db->quoteName('fp.featured_up'), 270 $db->quoteName('fp.featured_down'), 271 $db->quoteName('l.title', 'language_title'), 272 $db->quoteName('l.image', 'language_image'), 273 $db->quoteName('uc.name', 'editor'), 274 $db->quoteName('ag.title', 'access_level'), 275 $db->quoteName('c.title', 'category_title'), 276 $db->quoteName('c.created_user_id', 'category_uid'), 277 $db->quoteName('c.level', 'category_level'), 278 $db->quoteName('c.published', 'category_published'), 279 $db->quoteName('parent.title', 'parent_category_title'), 280 $db->quoteName('parent.id', 'parent_category_id'), 281 $db->quoteName('parent.created_user_id', 'parent_category_uid'), 282 $db->quoteName('parent.level', 'parent_category_level'), 283 $db->quoteName('ua.name', 'author_name'), 284 $db->quoteName('wa.stage_id', 'stage_id'), 285 $db->quoteName('ws.title', 'stage_title'), 286 $db->quoteName('ws.workflow_id', 'workflow_id'), 287 $db->quoteName('w.title', 'workflow_title'), 288 ] 289 ) 290 ->from($db->quoteName('#__content', 'a')) 291 ->where($db->quoteName('wa.extension') . ' = ' . $db->quote('com_content.article')) 292 ->join('LEFT', $db->quoteName('#__languages', 'l'), $db->quoteName('l.lang_code') . ' = ' . $db->quoteName('a.language')) 293 ->join('LEFT', $db->quoteName('#__content_frontpage', 'fp'), $db->quoteName('fp.content_id') . ' = ' . $db->quoteName('a.id')) 294 ->join('LEFT', $db->quoteName('#__users', 'uc'), $db->quoteName('uc.id') . ' = ' . $db->quoteName('a.checked_out')) 295 ->join('LEFT', $db->quoteName('#__viewlevels', 'ag'), $db->quoteName('ag.id') . ' = ' . $db->quoteName('a.access')) 296 ->join('LEFT', $db->quoteName('#__categories', 'c'), $db->quoteName('c.id') . ' = ' . $db->quoteName('a.catid')) 297 ->join('LEFT', $db->quoteName('#__categories', 'parent'), $db->quoteName('parent.id') . ' = ' . $db->quoteName('c.parent_id')) 298 ->join('LEFT', $db->quoteName('#__users', 'ua'), $db->quoteName('ua.id') . ' = ' . $db->quoteName('a.created_by')) 299 ->join('INNER', $db->quoteName('#__workflow_associations', 'wa'), $db->quoteName('wa.item_id') . ' = ' . $db->quoteName('a.id')) 300 ->join('INNER', $db->quoteName('#__workflow_stages', 'ws'), $db->quoteName('ws.id') . ' = ' . $db->quoteName('wa.stage_id')) 301 ->join('INNER', $db->quoteName('#__workflows', 'w'), $db->quoteName('w.id') . ' = ' . $db->quoteName('ws.workflow_id')); 302 303 if (PluginHelper::isEnabled('content', 'vote')) { 304 $query->select( 305 [ 306 'COALESCE(NULLIF(ROUND(' . $db->quoteName('v.rating_sum') . ' / ' . $db->quoteName('v.rating_count') . ', 0), 0), 0)' 307 . ' AS ' . $db->quoteName('rating'), 308 'COALESCE(NULLIF(' . $db->quoteName('v.rating_count') . ', 0), 0) AS ' . $db->quoteName('rating_count'), 309 ] 310 ) 311 ->join('LEFT', $db->quoteName('#__content_rating', 'v'), $db->quoteName('a.id') . ' = ' . $db->quoteName('v.content_id')); 312 } 313 314 // Join over the associations. 315 if (Associations::isEnabled()) { 316 $subQuery = $db->getQuery(true) 317 ->select('COUNT(' . $db->quoteName('asso1.id') . ') > 1') 318 ->from($db->quoteName('#__associations', 'asso1')) 319 ->join('INNER', $db->quoteName('#__associations', 'asso2'), $db->quoteName('asso1.key') . ' = ' . $db->quoteName('asso2.key')) 320 ->where( 321 [ 322 $db->quoteName('asso1.id') . ' = ' . $db->quoteName('a.id'), 323 $db->quoteName('asso1.context') . ' = ' . $db->quote('com_content.item'), 324 ] 325 ); 326 327 $query->select('(' . $subQuery . ') AS ' . $db->quoteName('association')); 328 } 329 330 // Filter by access level. 331 $access = $this->getState('filter.access'); 332 333 if (is_numeric($access)) { 334 $access = (int) $access; 335 $query->where($db->quoteName('a.access') . ' = :access') 336 ->bind(':access', $access, ParameterType::INTEGER); 337 } elseif (is_array($access)) { 338 $access = ArrayHelper::toInteger($access); 339 $query->whereIn($db->quoteName('a.access'), $access); 340 } 341 342 // Filter by featured. 343 $featured = (string) $this->getState('filter.featured'); 344 345 if (\in_array($featured, ['0','1'])) { 346 $featured = (int) $featured; 347 $query->where($db->quoteName('a.featured') . ' = :featured') 348 ->bind(':featured', $featured, ParameterType::INTEGER); 349 } 350 351 // Filter by access level on categories. 352 if (!$user->authorise('core.admin')) { 353 $groups = $user->getAuthorisedViewLevels(); 354 $query->whereIn($db->quoteName('a.access'), $groups); 355 $query->whereIn($db->quoteName('c.access'), $groups); 356 } 357 358 // Filter by published state 359 $workflowStage = (string) $this->getState('filter.stage'); 360 361 if ($params->get('workflow_enabled') && is_numeric($workflowStage)) { 362 $workflowStage = (int) $workflowStage; 363 $query->where($db->quoteName('wa.stage_id') . ' = :stage') 364 ->bind(':stage', $workflowStage, ParameterType::INTEGER); 365 } 366 367 $published = (string) $this->getState('filter.published'); 368 369 if ($published !== '*') { 370 if (is_numeric($published)) { 371 $state = (int) $published; 372 $query->where($db->quoteName('a.state') . ' = :state') 373 ->bind(':state', $state, ParameterType::INTEGER); 374 } elseif (!is_numeric($workflowStage)) { 375 $query->whereIn( 376 $db->quoteName('a.state'), 377 [ 378 ContentComponent::CONDITION_PUBLISHED, 379 ContentComponent::CONDITION_UNPUBLISHED, 380 ] 381 ); 382 } 383 } 384 385 // Filter by categories and by level 386 $categoryId = $this->getState('filter.category_id', array()); 387 $level = (int) $this->getState('filter.level'); 388 389 if (!is_array($categoryId)) { 390 $categoryId = $categoryId ? array($categoryId) : array(); 391 } 392 393 // Case: Using both categories filter and by level filter 394 if (count($categoryId)) { 395 $categoryId = ArrayHelper::toInteger($categoryId); 396 $categoryTable = Table::getInstance('Category', 'JTable'); 397 $subCatItemsWhere = array(); 398 399 foreach ($categoryId as $key => $filter_catid) { 400 $categoryTable->load($filter_catid); 401 402 // Because values to $query->bind() are passed by reference, using $query->bindArray() here instead to prevent overwriting. 403 $valuesToBind = [$categoryTable->lft, $categoryTable->rgt]; 404 405 if ($level) { 406 $valuesToBind[] = $level + $categoryTable->level - 1; 407 } 408 409 // Bind values and get parameter names. 410 $bounded = $query->bindArray($valuesToBind); 411 412 $categoryWhere = $db->quoteName('c.lft') . ' >= ' . $bounded[0] . ' AND ' . $db->quoteName('c.rgt') . ' <= ' . $bounded[1]; 413 414 if ($level) { 415 $categoryWhere .= ' AND ' . $db->quoteName('c.level') . ' <= ' . $bounded[2]; 416 } 417 418 $subCatItemsWhere[] = '(' . $categoryWhere . ')'; 419 } 420 421 $query->where('(' . implode(' OR ', $subCatItemsWhere) . ')'); 422 } elseif ($level = (int) $level) { 423 // Case: Using only the by level filter 424 $query->where($db->quoteName('c.level') . ' <= :level') 425 ->bind(':level', $level, ParameterType::INTEGER); 426 } 427 428 // Filter by author 429 $authorId = $this->getState('filter.author_id'); 430 431 if (is_numeric($authorId)) { 432 $authorId = (int) $authorId; 433 $type = $this->getState('filter.author_id.include', true) ? ' = ' : ' <> '; 434 $query->where($db->quoteName('a.created_by') . $type . ':authorId') 435 ->bind(':authorId', $authorId, ParameterType::INTEGER); 436 } elseif (is_array($authorId)) { 437 // Check to see if by_me is in the array 438 if (\in_array('by_me', $authorId)) { 439 // Replace by_me with the current user id in the array 440 $authorId['by_me'] = $user->id; 441 } 442 443 $authorId = ArrayHelper::toInteger($authorId); 444 $query->whereIn($db->quoteName('a.created_by'), $authorId); 445 } 446 447 // Filter by search in title. 448 $search = $this->getState('filter.search'); 449 450 if (!empty($search)) { 451 if (stripos($search, 'id:') === 0) { 452 $search = (int) substr($search, 3); 453 $query->where($db->quoteName('a.id') . ' = :search') 454 ->bind(':search', $search, ParameterType::INTEGER); 455 } elseif (stripos($search, 'author:') === 0) { 456 $search = '%' . substr($search, 7) . '%'; 457 $query->where('(' . $db->quoteName('ua.name') . ' LIKE :search1 OR ' . $db->quoteName('ua.username') . ' LIKE :search2)') 458 ->bind([':search1', ':search2'], $search); 459 } elseif (stripos($search, 'content:') === 0) { 460 $search = '%' . substr($search, 8) . '%'; 461 $query->where('(' . $db->quoteName('a.introtext') . ' LIKE :search1 OR ' . $db->quoteName('a.fulltext') . ' LIKE :search2)') 462 ->bind([':search1', ':search2'], $search); 463 } else { 464 $search = '%' . str_replace(' ', '%', trim($search)) . '%'; 465 $query->where( 466 '(' . $db->quoteName('a.title') . ' LIKE :search1 OR ' . $db->quoteName('a.alias') . ' LIKE :search2' 467 . ' OR ' . $db->quoteName('a.note') . ' LIKE :search3)' 468 ) 469 ->bind([':search1', ':search2', ':search3'], $search); 470 } 471 } 472 473 // Filter on the language. 474 if ($language = $this->getState('filter.language')) { 475 $query->where($db->quoteName('a.language') . ' = :language') 476 ->bind(':language', $language); 477 } 478 479 // Filter by a single or group of tags. 480 $tag = $this->getState('filter.tag'); 481 482 // Run simplified query when filtering by one tag. 483 if (\is_array($tag) && \count($tag) === 1) { 484 $tag = $tag[0]; 485 } 486 487 if ($tag && \is_array($tag)) { 488 $tag = ArrayHelper::toInteger($tag); 489 490 $subQuery = $db->getQuery(true) 491 ->select('DISTINCT ' . $db->quoteName('content_item_id')) 492 ->from($db->quoteName('#__contentitem_tag_map')) 493 ->where( 494 [ 495 $db->quoteName('tag_id') . ' IN (' . implode(',', $query->bindArray($tag)) . ')', 496 $db->quoteName('type_alias') . ' = ' . $db->quote('com_content.article'), 497 ] 498 ); 499 500 $query->join( 501 'INNER', 502 '(' . $subQuery . ') AS ' . $db->quoteName('tagmap'), 503 $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id') 504 ); 505 } elseif ($tag = (int) $tag) { 506 $query->join( 507 'INNER', 508 $db->quoteName('#__contentitem_tag_map', 'tagmap'), 509 $db->quoteName('tagmap.content_item_id') . ' = ' . $db->quoteName('a.id') 510 ) 511 ->where( 512 [ 513 $db->quoteName('tagmap.tag_id') . ' = :tag', 514 $db->quoteName('tagmap.type_alias') . ' = ' . $db->quote('com_content.article'), 515 ] 516 ) 517 ->bind(':tag', $tag, ParameterType::INTEGER); 518 } 519 520 // Add the list ordering clause. 521 $orderCol = $this->state->get('list.ordering', 'a.id'); 522 $orderDirn = $this->state->get('list.direction', 'DESC'); 523 524 if ($orderCol === 'a.ordering' || $orderCol === 'category_title') { 525 $ordering = [ 526 $db->quoteName('c.title') . ' ' . $db->escape($orderDirn), 527 $db->quoteName('a.ordering') . ' ' . $db->escape($orderDirn), 528 ]; 529 } else { 530 $ordering = $db->escape($orderCol) . ' ' . $db->escape($orderDirn); 531 } 532 533 $query->order($ordering); 534 535 return $query; 536 } 537 538 /** 539 * Method to get all transitions at once for all articles 540 * 541 * @return array|boolean 542 * 543 * @since 4.0.0 544 */ 545 public function getTransitions() 546 { 547 // Get a storage key. 548 $store = $this->getStoreId('getTransitions'); 549 550 // Try to load the data from internal storage. 551 if (isset($this->cache[$store])) { 552 return $this->cache[$store]; 553 } 554 555 $db = $this->getDatabase(); 556 $user = Factory::getUser(); 557 558 $items = $this->getItems(); 559 560 if ($items === false) { 561 return false; 562 } 563 564 $stage_ids = ArrayHelper::getColumn($items, 'stage_id'); 565 $stage_ids = ArrayHelper::toInteger($stage_ids); 566 $stage_ids = array_values(array_unique(array_filter($stage_ids))); 567 568 $workflow_ids = ArrayHelper::getColumn($items, 'workflow_id'); 569 $workflow_ids = ArrayHelper::toInteger($workflow_ids); 570 $workflow_ids = array_values(array_unique(array_filter($workflow_ids))); 571 572 $this->cache[$store] = array(); 573 574 try { 575 if (count($stage_ids) || count($workflow_ids)) { 576 Factory::getLanguage()->load('com_workflow', JPATH_ADMINISTRATOR); 577 578 $query = $db->getQuery(true); 579 580 $query ->select( 581 [ 582 $db->quoteName('t.id', 'value'), 583 $db->quoteName('t.title', 'text'), 584 $db->quoteName('t.from_stage_id'), 585 $db->quoteName('t.to_stage_id'), 586 $db->quoteName('s.id', 'stage_id'), 587 $db->quoteName('s.title', 'stage_title'), 588 $db->quoteName('t.workflow_id'), 589 ] 590 ) 591 ->from($db->quoteName('#__workflow_transitions', 't')) 592 ->innerJoin( 593 $db->quoteName('#__workflow_stages', 's'), 594 $db->quoteName('t.to_stage_id') . ' = ' . $db->quoteName('s.id') 595 ) 596 ->where( 597 [ 598 $db->quoteName('t.published') . ' = 1', 599 $db->quoteName('s.published') . ' = 1', 600 ] 601 ) 602 ->order($db->quoteName('t.ordering')); 603 604 $where = []; 605 606 if (count($stage_ids)) { 607 $where[] = $db->quoteName('t.from_stage_id') . ' IN (' . implode(',', $query->bindArray($stage_ids)) . ')'; 608 } 609 610 if (count($workflow_ids)) { 611 $where[] = '(' . $db->quoteName('t.from_stage_id') . ' = -1 AND ' . $db->quoteName('t.workflow_id') . ' IN (' . implode(',', $query->bindArray($workflow_ids)) . '))'; 612 } 613 614 $query->where('((' . implode(') OR (', $where) . '))'); 615 616 $transitions = $db->setQuery($query)->loadAssocList(); 617 618 foreach ($transitions as $key => $transition) { 619 if (!$user->authorise('core.execute.transition', 'com_content.transition.' . (int) $transition['value'])) { 620 unset($transitions[$key]); 621 } 622 623 $transitions[$key]['text'] = Text::_($transition['text']); 624 } 625 626 $this->cache[$store] = $transitions; 627 } 628 } catch (\RuntimeException $e) { 629 $this->setError($e->getMessage()); 630 631 return false; 632 } 633 634 return $this->cache[$store]; 635 } 636 637 /** 638 * Method to get a list of articles. 639 * Overridden to add item type alias. 640 * 641 * @return mixed An array of data items on success, false on failure. 642 * 643 * @since 4.0.0 644 */ 645 public function getItems() 646 { 647 $items = parent::getItems(); 648 649 foreach ($items as $item) { 650 $item->typeAlias = 'com_content.article'; 651 652 if (isset($item->metadata)) { 653 $registry = new Registry($item->metadata); 654 $item->metadata = $registry->toArray(); 655 } 656 } 657 658 return $items; 659 } 660 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |