This feature was entirely unused.
{foreach from=$objects item=message}
<li class="gridListItem gridListItemMessage">
<div class="gridListItemImage">
- {assign var=_messageCustomIcon value=$customIcons[$message]}
- {if $_messageCustomIcon === ''}
- {if $message->getUserProfile()}
- {user object=$message->getUserProfile() type='avatar48' ariaHidden='true' tabindex='-1'}
- {else}
- {icon size=48 name='file'}
- {/if}
- {elseif $_messageCustomIcon|strpos:'fa-' === 0}
- <span class="icon icon48 {$_messageCustomIcon}"></span>
+ {if $message->getUserProfile()}
+ {user object=$message->getUserProfile() type='avatar48' ariaHidden='true' tabindex='-1'}
{else}
- <img src="{$_messageCustomIcon}" height="48" width="48" alt="">
+ {icon size=48 name='file'}
{/if}
</div>
+++ /dev/null
-<?php
-
-namespace wcf\data\search;
-
-/**
- * Extends the base search result objects with the ability to provide a custom image or icon
- * class name instead of the default avatar/icon.
- *
- * @author Alexander Ebert
- * @copyright 2001-2019 WoltLab GmbH
- * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
- * @package WoltLabSuite\Core\Data\Search
- * @since 5.2
- */
-interface ICustomIconSearchResultObject extends ISearchResultObject
-{
- /**
- * Returns either a FontAwesome icon name including the `fa-` prefix or
- * a string that is interpreted as an URL to an image that can be scaled
- * to 48x48. Returning an empty string will trigger the default behavior.
- *
- * @return string
- */
- public function getCustomSearchResultIcon();
-}
WCF::getTPL()->assign([
'objects' => $resultHandler->getSearchResults(),
- 'customIcons' => $resultHandler->getCustomIcons(),
'query' => $resultHandler->getQuery(),
]);
WCF::getTPL()->assign([
'objects' => $resultHandler->getSearchResults(),
- 'customIcons' => $resultHandler->getCustomIcons(),
'query' => $resultHandler->getQuery(),
]);
namespace wcf\page;
-use wcf\data\search\ICustomIconSearchResultObject;
use wcf\data\search\ISearchResultObject;
use wcf\data\search\Search;
use wcf\system\event\EventHandler;
*/
class SearchResultPage extends MultipleLinkPage
{
- /**
- * list of custom icons per message
- * @var string[]
- */
- public $customIcons = [];
-
/**
* @inheritDoc
*/
throw new ImplementationException(\get_class($message), ISearchResultObject::class);
}
- $customIcon = '';
- if ($message instanceof ICustomIconSearchResultObject) {
- $customIcon = $message->getCustomSearchResultIcon();
- }
-
$this->messages[] = $message;
- $this->customIcons[\spl_object_hash($message)] = $customIcon;
}
}
}
namespace wcf\system\search;
-use wcf\data\search\ICustomIconSearchResultObject;
use wcf\data\search\ISearchResultObject;
use wcf\data\search\Search;
use wcf\page\SearchResultPage;
*/
private $messages = [];
- /**
- * @var \SplObjectStorage
- */
- private $customIcons;
-
/**
* @var int
*/
$this->startIndex = $startIndex;
$this->limit = $limit;
$this->searchData = \unserialize($this->search->searchData);
- $this->customIcons = new \SplObjectStorage();
}
public function countSearchResults(): int
return $this->messages;
}
- public function getCustomIcons(): \SplObjectStorage
- {
- return $this->customIcons;
- }
-
private function cacheMessageData(): void
{
$types = [];
throw new ImplementationException(\get_class($message), ISearchResultObject::class);
}
- $customIcon = '';
- if ($message instanceof ICustomIconSearchResultObject) {
- $customIcon = $message->getCustomSearchResultIcon();
- }
-
$this->messages[] = $message;
- $this->customIcons[$message] = $customIcon;
}
}
}