Skip to content

Commit

Permalink
Merge pull request #8 from dauskonzept/feature-adds-permalink
Browse files Browse the repository at this point in the history
[FEATURE] Add Permalink to news when importing
  • Loading branch information
svenpet90 authored Nov 25, 2024
2 parents 73de3f5 + 7f54667 commit 4e38e0b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
12 changes: 12 additions & 0 deletions Classes/Domain/Model/NewsInstagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class NewsInstagram extends News

protected string $mediaType = '';

protected string $permalink = '';

public function getInstagramId(): string
{
return $this->instagramId;
Expand Down Expand Up @@ -51,4 +53,14 @@ public function setMediaType(string $mediaType): self

return $this;
}

public function getPermalink(): string
{
return $this->permalink;
}

public function setPermalink(string $permalink): void
{
$this->permalink = $permalink;
}
}
3 changes: 2 additions & 1 deletion Classes/Service/PostUpserter.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public function upsertPost(PostDTO $dto, int $storagePid, ApiClientInterface $ap
$newsItem
->setInstagramId($dto->getId())
->setPostedBy($apiClient->getFeed()->getUsername())
->setMediaType($dto->getMediaType());
->setMediaType($dto->getMediaType())
->setPermalink($dto->getPermalink());

/** @var \DateTimeImmutable $postedAt */
$postedAt = $dto->getTimestamp();
Expand Down
10 changes: 9 additions & 1 deletion Configuration/TCA/Overrides/tx_news_domain_model_news.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,20 @@
'size' => 30,
],
],
'permalink' => [
'exclude' => 1,
'label' => 'Permalink',
'config' => [
'type' => 'input',
'size' => 30,
],
],
];

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette(
'tx_news_domain_model_news',
'tx_instagram2news_fields',
'instagram_id, posted_by, media_type'
'instagram_id, posted_by, media_type, permalink'
);

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tx_news_domain_model_news', $fields);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"phpstan/extension-installer": "^1.2",
"phpstan/phpstan": "^1.4",
"typo3/coding-standards": "^0.6.1",
"typo3/testing-framework": "^6.16"
"typo3/testing-framework": "^8"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 0 additions & 1 deletion ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
'className' => \DSKZPT\Instagram2News\Domain\Model\NewsInstagram::class,
];


//\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class)
// ->registerImplementation(
// \GeorgRinger\News\Domain\Model\News::class,
Expand Down
1 change: 1 addition & 0 deletions ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ CREATE TABLE tx_news_domain_model_news
instagram_id varchar(255) DEFAULT '' NOT NULL,
posted_by varchar(255) DEFAULT '' NOT NULL,
media_type varchar(255) DEFAULT '' NOT NULL,
permalink varchar(255) DEFAULT '' NOT NULL,
);

0 comments on commit 4e38e0b

Please sign in to comment.