Skip to content

Commit

Permalink
FEATURE: Provide icon and description
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellienert committed Apr 3, 2020
1 parent 0e2bc9a commit 930aedc
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
26 changes: 26 additions & 0 deletions Classes/AssetSource/MediaWikiAssetSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@
* source code.
*/

use Neos\Flow\Annotations as Flow;
use DL\AssetSource\MediaWiki\Api\MediaWikiClient;
use Neos\Flow\ResourceManagement\ResourceManager;
use Neos\Media\Domain\Model\AssetSource\AssetProxyRepositoryInterface;
use Neos\Media\Domain\Model\AssetSource\AssetSourceInterface;
use Neos\Media\Domain\Model\AssetSource\Neos\NeosAssetProxyRepository;
use Neos\Utility\Arrays;

final class MediaWikiAssetSource implements AssetSourceInterface
{
/**
* @Flow\Inject
* @var ResourceManager
*/
protected $resourceManager;

/**
* @var MediaWikiClient
*/
Expand Down Expand Up @@ -138,4 +146,22 @@ public function getCopyRightNoticeTemplate(): string
{
return $this->copyRightNoticeTemplate;
}

/**
* Returns the resource path to Assetsources icon
*
* @return string
*/
public function getIconUri(): string
{
return $this->resourceManager->getPublicPackageResourceUriByPath($this->assetSourceOptions['icon']);
}

/**
* @return string
*/
public function getDescription(): string
{
return $this->getLabel() . ': ' . $this->getOption('domain');
}
}
3 changes: 2 additions & 1 deletion Configuration/Settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Neos:
wikipedia_de:
assetSource: 'DL\AssetSource\MediaWiki\AssetSource\MediaWikiAssetSource'
assetSourceOptions:
domain: de.wikipedia.org
label: Wikipedia (DE)
icon: 'resource://DL.AssetSource.MediaWiki/Public/Wikipedia-logo.svg'
domain: de.wikipedia.org
searchStrategy: DL\AssetSource\MediaWiki\Api\SearchStrategies\ArticleSearchStrategy
searchStrategyOptions:
articleLimit: 10
Expand Down
11 changes: 11 additions & 0 deletions Resources/Public/Wikipedia-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 930aedc

Please sign in to comment.