Skip to content

Commit 24e3689

Browse files
Merge pull request #70 from TheDragonCode/1.x
Added `@mixed` directive to docs
2 parents 09fa763 + e9e3548 commit 24e3689

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace App\Feeds\Items;
6+
7+
use DragonCode\LaravelFeed\Feeds\Items\FeedItem;
8+
9+
class UserFeedItem extends FeedItem
10+
{
11+
protected ?string $name = 'users';
12+
13+
public function toArray(): array
14+
{
15+
return [
16+
'foo' => 'bar',
17+
18+
'some' => [
19+
'@mixed' => <<<XML
20+
<first>value</first>
21+
<second>value</second>
22+
XML,
23+
],
24+
];
25+
}
26+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<user>
2+
<foo>bar</foo>
3+
<some>
4+
<first>value</first>
5+
<second>value</second>
6+
</some>
7+
</user>

docs/topics/advanced-usage.topic

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,22 @@
106106
</chapter>
107107
</chapter>
108108

109+
<chapter title="Directives" id="directives">
110+
<chapter title="Mixed" id="mixed">
111+
<p>
112+
To insert XML fragments “as is”, use the <code>@mixed</code> directive:
113+
</p>
114+
115+
<code-block lang="php" src="advanced-directive-mixed.php" include-lines="5-" />
116+
117+
<p>
118+
Result:
119+
</p>
120+
121+
<code-block lang="xml" src="advanced-directive-mixed.xml" />
122+
</chapter>
123+
</chapter>
124+
109125
<chapter title="Location &amp; filename" id="location_and_filename">
110126
<p>
111127
By default, feeds will be stored in the <code>public</code> storage,

0 commit comments

Comments
 (0)