Skip to content

Add yoast_head_json and acf to Page.php #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"php": ">=7.2",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"symfony/config": "^4.4 || ^5.3 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.3 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.3 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.3 || ^6.0",
"symfony/config": "^4.4 || ^5.3 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^4.4 || ^5.3 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^4.4 || ^5.3 || ^6.0 || ^7.0",
"symfony/http-kernel": "^4.4 || ^5.3 || ^6.0 || ^7.0",
"twig/twig": "^2.14 || ^3.3"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('wordpress');
$root = $treeBuilder->getRootNode();
Expand Down
4 changes: 2 additions & 2 deletions src/DependencyInjection/WordpressExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class WordpressExtension extends Extension
/**
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$configuration = $this->getConfiguration($configs, $container);
$config = $this->processConfiguration($configuration, $configs);
Expand Down Expand Up @@ -53,7 +53,7 @@ public function load(array $configs, ContainerBuilder $container)
$this->configureParsers($container, $config['parser']);
}

private function configureParsers(ContainerBuilder $container, array $config)
private function configureParsers(ContainerBuilder $container, array $config): void
{
$parsers = ['image' => RewriteImageReferences::class, 'link' => RewriteLinks::class, 'url' => RewriteUrls::class];
foreach ($parsers as $key => $serviceId) {
Expand Down
57 changes: 52 additions & 5 deletions src/Model/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ class Page
private $categories;
/** @var array */
private $tags;
/** @var array */
private $acf;
/** @var array */
private $yoastHeadJson;

public function __construct(array $data = [])
{
Expand Down Expand Up @@ -83,12 +87,14 @@ public function __construct(array $data = [])
$this->featuredMedia = $data['featured_media'];
$this->commentStatus = $data['comment_status'];
$this->pingStatus = $data['ping_status'];
$this->sticky = $data['sticky'];
$this->sticky = $data['sticky'] ?? false;
$this->template = $data['template'];
$this->format = $data['format'];
$this->meta = $data['meta'];
$this->categories = $data['categories'];
$this->tags = $data['tags'];
$this->format = $data['format'] ?? null;
$this->meta = $data['meta'] ?? null;
$this->categories = $data['categories'] ?? null;
$this->tags = $data['tags'] ?? null;
$this->acf = $data['acf'] ?? [];
$this->yoastHeadJson = $data['yoast_head_json'] ?? [];
}

public function getId(): int
Expand Down Expand Up @@ -300,4 +306,45 @@ public function setTags(array $tags): void
{
$this->tags = $tags;
}

/**
* Get the value of acf
*/
public function getAcf(): ?array
{
return $this->acf;
}

/**
* Set the value of acf
*
* @return self
*/
public function setAcf(?array $acf)
{
$this->acf = $acf;

return $this;
}

/**
* Get the value of yoastHeadJson
*/
public function getYoastHeadJson(): ?array
{
return $this->yoastHeadJson;
}

/**
* Set the value of yoastHeadJson
*
* @return self
*/
public function setYoastHeadJson(?array $yoastHeadJson)
{
$this->yoastHeadJson = $yoastHeadJson;

return $this;
}

}