-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathrender.php
44 lines (39 loc) · 984 Bytes
/
render.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/**
* HTML for testing the router navigate function.
*
* @package gutenberg-test-interactive-blocks
* @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
*/
?>
<div data-wp-interactive data-wp-navigation-id="region-1">
<h2 data-testid="title"><?php echo $attributes['title']; ?></h2>
<output
data-testid="router navigations"
data-wp-text="state.router.navigations"
>NaN</output>
<output
data-testid="router status"
data-wp-text="state.router.status"
>undefined</output>
<?php
if ( isset( $attributes['links'] ) ) {
foreach ( $attributes['links'] as $key => $link ) {
$i = $key += 1;
echo <<<HTML
<a
data-testid="link $i"
data-wp-on--click="actions.router.navigate"
href="$link"
>link $i</a>
<a
data-testid="link $i with hash"
data-wp-on--click="actions.router.navigate"
data-force-navigation="true"
href="$link#link-$i-with-hash"
>link $i with hash</a>
HTML;
}
}
?>
</div>