File tree 3 files changed +37
-2
lines changed
3 files changed +37
-2
lines changed Original file line number Diff line number Diff line change 6
6
7
7
interface HasSeo
8
8
{
9
- public function getSeo ( ): SeoManager ;
9
+ public function applySeo ( SeoManager $ manager ): SeoManager ;
10
10
}
Original file line number Diff line number Diff line change 3
3
namespace Elegantly \Seo ;
4
4
5
5
use Closure ;
6
+ use Elegantly \Seo \Concerns \HasSeo ;
6
7
use Elegantly \Seo \Contracts \Taggable ;
7
8
use Elegantly \Seo \OpenGraph \Locale ;
8
9
use Elegantly \Seo \OpenGraph \OpenGraph ;
@@ -43,6 +44,25 @@ public function current(): static
43
44
return $ this ;
44
45
}
45
46
47
+ public function apply (HasSeo $ class ): self
48
+ {
49
+ return $ class ->applySeo ($ this );
50
+ }
51
+
52
+ /**
53
+ * @return $this
54
+ */
55
+ public function set (SeoManager $ manager ): static
56
+ {
57
+ return $ this
58
+ ->setStandard ($ manager ->standard )
59
+ ->setOpengraph ($ manager ->opengraph )
60
+ ->setTwitter ($ manager ->twitter )
61
+ ->setWebpage ($ manager ->webpage )
62
+ ->setSchemas ($ manager ->schemas )
63
+ ->setCustomTags ($ manager ->customTags );
64
+ }
65
+
46
66
/**
47
67
* @param null|Standard|(Closure(Standard):(null|Standard)) $value
48
68
* @return $this
@@ -118,6 +138,21 @@ public function setSchemas(null|array|Closure $value): static
118
138
return $ this ;
119
139
}
120
140
141
+ /**
142
+ * @param null|SeoTags|(Closure(SeoTags):(null|SeoTags)) $value
143
+ * @return $this
144
+ */
145
+ public function setCustomTags (null |SeoTags |Closure $ value ): static
146
+ {
147
+ if ($ value instanceof Closure) {
148
+ $ this ->customTags = $ value ($ this ->customTags ?? new SeoTags );
149
+ } else {
150
+ $ this ->customTags = $ value ;
151
+ }
152
+
153
+ return $ this ;
154
+ }
155
+
121
156
/**
122
157
* @return $this
123
158
*/
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ function seo(null|HasSeo|SeoManager $value = null): SeoManager
11
11
}
12
12
13
13
if ($ value instanceof HasSeo) {
14
- return $ value -> getSeo ( );
14
+ return \ Elegantly \ Seo \ Facades \SeoManager:: current ()-> apply ( $ value );
15
15
}
16
16
17
17
return $ value ;
You can’t perform that action at this time.
0 commit comments