Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_news
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_news
Commits
093afddc
Commit
093afddc
authored
4 years ago
by
Stefan Galinski
Browse files
Options
Downloads
Patches
Plain Diff
[BUGFIX] Fix metadata for author related pages
parent
5a5e18d4
No related branches found
Branches containing commit
Tags
2.0.9
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/Controller/NewsByAuthorController.php
+11
-4
11 additions, 4 deletions
Classes/Controller/NewsByAuthorController.php
with
11 additions
and
4 deletions
Classes/Controller/NewsByAuthorController.php
+
11
−
4
View file @
093afddc
...
...
@@ -26,15 +26,16 @@ namespace SGalinski\SgNews\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use
SGalinski\SgNews\Domain\Model\Author
;
use
SGalinski\SgNews\Domain\Model\Category
;
use
SGalinski\SgNews\Domain\Model\News
;
use
SGalinski\SgNews\Domain\Repository\AuthorRepository
;
use
SGalinski\SgNews\Domain\Repository\CategoryRepository
;
use
SGalinski\SgNews\Domain\Repository\NewsRepository
;
use
SGalinski\SgNews\Service\HeaderMetaDataService
;
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
/**
*
Controller that handles the news single view page
*
News Author List Controller
*/
class
NewsByAuthorController
extends
AbstractController
{
/**
...
...
@@ -45,7 +46,7 @@ class NewsByAuthorController extends AbstractController {
* @throws \InvalidArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
*/
public
function
listAction
(
$authorId
=
0
)
{
public
function
listAction
(
$authorId
=
0
)
:
void
{
if
(
$authorId
)
{
$newsAuthorsIds
[]
=
$authorId
;
}
else
{
...
...
@@ -58,11 +59,17 @@ class NewsByAuthorController extends AbstractController {
$authors
=
[];
$authorRepository
=
$this
->
objectManager
->
get
(
AuthorRepository
::
class
);
foreach
(
$newsAuthorsIds
as
$newsAuthorsId
)
{
/** @var Author $author */
$author
=
$authorRepository
->
findByUid
(
$newsAuthorsId
);
if
(
!
$author
)
{
continue
;
}
$GLOBALS
[
'TSFE'
]
->
page
[
'titlebyextension'
]
=
$author
->
getName
();
$GLOBALS
[
'TSFE'
]
->
page
[
'description'
]
=
\strip_tags
(
\substr
(
$author
->
getDescription
(),
0
,
200
));
$GLOBALS
[
'TSFE'
]
->
page
[
'extensionArgumentsForCanonicalAndHrefLang'
]
=
'&tx_sgnews_newsbyauthor[authorId]='
.
$author
->
getUid
();
$authors
[]
=
$author
;
}
...
...
@@ -88,6 +95,7 @@ class NewsByAuthorController extends AbstractController {
$categoryId
=
$newsEntry
->
getPid
();
if
(
!
isset
(
$categories
[
$categoryId
]))
{
/** @var Category $category */
$category
=
$categoryRepository
->
findByUid
(
$categoryId
);
if
(
!
$category
)
{
continue
;
...
...
@@ -100,7 +108,6 @@ class NewsByAuthorController extends AbstractController {
}
}
$this
->
view
->
assign
(
'newsMetaData'
,
$newsMetaData
);
$this
->
view
->
assign
(
'authors'
,
$authors
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment