-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP keep using fluent methods now based on CustomSchema class
- Loading branch information
1 parent
0743d45
commit e73fe3c
Showing
8 changed files
with
189 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace RalphJSmit\Laravel\SEO\Schema; | ||
|
||
use Closure; | ||
use Illuminate\Support\Collection; | ||
use RalphJSmit\Laravel\SEO\Support\SEOData; | ||
|
||
abstract class CustomPreDefinedSchema extends CustomSchema | ||
{ | ||
public array $markupTransformers = []; | ||
|
||
public function __construct(SEOData $SEOData, array $markupBuilders = []) | ||
{ | ||
$this->initializeMarkup($SEOData); | ||
|
||
// `$markupBuilders` are closures that modify this schema | ||
// tag object and can call methods on it to change items... | ||
foreach ($markupBuilders as $markupBuilder) { | ||
$markupBuilder($this, $SEOData); | ||
} | ||
|
||
parent::__construct($this->generateInner()); | ||
} | ||
|
||
abstract public function initializeMarkup(SEOData $SEOData): void; | ||
|
||
abstract public function generateInner(): Collection; | ||
|
||
public function markup(Closure $transformer): static | ||
{ | ||
$this->markupTransformers[] = $transformer; | ||
|
||
return $this; | ||
} | ||
} |
Oops, something went wrong.