2 namespace wcf\system\message\embedded\object;
3 use wcf\data\page\Page;
4 use wcf\data\page\PageCache;
7 * Parses embedded pages and outputs their link or title.
9 * @author Alexander Ebert
10 * @copyright 2001-2016 WoltLab GmbH
11 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
12 * @package WoltLabSuite\Core\System\Message\Embedded\Object
14 class PageMessageEmbeddedObjectHandler extends AbstractSimpleMessageEmbeddedObjectHandler {
18 public function loadObjects(array $objectIDs) {
21 foreach ($objectIDs as $objectID) {
22 $page = PageCache::getInstance()->getPage($objectID);
24 $pages[$objectID] = $page;
34 public function validateValues($objectType, $objectID, array $values) {
35 return array_filter($values, function($value) {
36 return (PageCache::getInstance()->getPage($value) !== null);
43 public function replaceSimple($objectType, $objectID, $value, array $attributes) {
44 /** @var Page $page */
45 $page = MessageEmbeddedObjectManager::getInstance()->getObject('com.woltlab.wcf.page', $value);
50 $return = (!empty($attributes['return'])) ? $attributes['return'] : 'link';
53 return $page->getTitle();
58 return $page->getLink();