Skip to content

Commit d5b4aa0

Browse files
authored
Merge pull request #14 from magefan/4645-blog-author-graph-ql
Add fields to schema for blog extra
2 parents 15a9fa2 + a89258b commit d5b4aa0

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Model/Resolver/DataProvider/Author.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Framework\App\Area;
1212
use Magento\Framework\App\Config\ScopeConfigInterface;
1313
use Magento\Framework\App\State;
14+
use Magento\Framework\Exception\NoSuchEntityException;
1415
use Magento\Framework\View\DesignInterface;
1516
use Magento\Framework\View\Design\Theme\ThemeProviderInterface;
1617
use Magento\Store\Model\ScopeInterface;
@@ -80,12 +81,17 @@ public function __construct(
8081
/**
8182
* @param string $authorId
8283
* @return array
84+
* @throws NoSuchEntityException
8385
*/
8486
public function getData(string $authorId): array
8587
{
8688
$author = $this->authorRepository->getFactory()->create();
8789
$author->getResource()->load($author, $authorId);
8890

91+
if (!$author->isActive()) {
92+
throw new NoSuchEntityException();
93+
}
94+
8995
$data = [];
9096
$this->state->emulateAreaCode(
9197
Area::AREA_FRONTEND,
@@ -123,6 +129,9 @@ public function getDynamicData($author, $fields = null)
123129
'name',
124130
'title',
125131
'identifier',
132+
'featured_image',
133+
'filtered_content',
134+
'short_filtered_content'
126135
];
127136

128137
$data['author_id'] = $author->getId();

etc/schema.graphqls

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,23 @@ type BlogAuthor {
209209
author_url: String @doc(description: "Blog Author Author url")
210210
is_active: Int @doc(description: "Blog Author Is active")
211211
creation_time: String @doc(description: "Blog Author Created")
212+
role : String @doc(description: "")
213+
featured_image : String @doc(description: "")
214+
content : String @doc(description: "")
215+
filtered_content : String @doc(description: "")
216+
short_content : String @doc(description: "")
217+
short_filtered_content : String @doc(description: "")
218+
facebook_page_url: String @doc(description: "")
219+
twitter_page_url: String @doc(description: "")
220+
instagram_page_url: String @doc(description: "")
221+
linkedin_page_url: String @doc(description: "")
222+
page_layout: String @doc(description: "")
223+
layout_update_xml: String @doc(description: "")
224+
custom_theme: String @doc(description: "")
225+
custom_layout: String @doc(description: "")
226+
custom_theme_from: String @doc(description: "")
227+
custom_theme_to: String @doc(description: "")
228+
custom_layout_update_xml: String @doc(description: "")
212229
}
213230

214231
input BlogCommentsFilterInput {

0 commit comments

Comments
 (0)