@@ -8,32 +8,32 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | |
11 | -$target = $this->config( 'admin/jsonadm/url/target' ); |
|
12 | -$cntl = $this->config( 'admin/jsonadm/url/controller', 'jsonadm' ); |
|
13 | -$action = $this->config( 'admin/jsonadm/url/action', 'get' ); |
|
14 | -$config = $this->config( 'admin/jsonadm/url/config', [] ); |
|
11 | +$target = $this->config('admin/jsonadm/url/target'); |
|
12 | +$cntl = $this->config('admin/jsonadm/url/controller', 'jsonadm'); |
|
13 | +$action = $this->config('admin/jsonadm/url/action', 'get'); |
|
14 | +$config = $this->config('admin/jsonadm/url/config', []); |
|
15 | 15 | |
16 | 16 | |
17 | 17 | $resources = $attributes = []; |
18 | -$site = $this->param( 'site', 'default' ); |
|
18 | +$site = $this->param('site', 'default'); |
|
19 | 19 | |
20 | -foreach( $this->get( 'resources', [] ) as $resource ) { |
|
21 | - $resources[$resource] = $this->url( $target, $cntl, $action, ['site' => $site, 'resource' => $resource], [], $config ); |
|
20 | +foreach ($this->get('resources', []) as $resource) { |
|
21 | + $resources[$resource] = $this->url($target, $cntl, $action, ['site' => $site, 'resource' => $resource], [], $config); |
|
22 | 22 | } |
23 | 23 | |
24 | -foreach( $this->get( 'attributes', [] ) as $attr ) { |
|
25 | - $attributes[$attr->getCode()] = $attr->toArray( true ); |
|
24 | +foreach ($this->get('attributes', []) as $attr) { |
|
25 | + $attributes[$attr->getCode()] = $attr->toArray(true); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | |
29 | 29 | ?> |
30 | 30 | { |
31 | 31 | "meta": { |
32 | - "prefix": <?= json_encode( $this->get( 'prefix' ) ); ?>, |
|
33 | - "resources": <?= json_encode( $resources ); ?>, |
|
34 | - "attributes": <?= json_encode( $attributes ); ?> |
|
32 | + "prefix": <?= json_encode($this->get('prefix')); ?>, |
|
33 | + "resources": <?= json_encode($resources); ?>, |
|
34 | + "attributes": <?= json_encode($attributes); ?> |
|
35 | 35 | |
36 | - <?php if( $this->csrf()->name() != '' ) : ?> |
|
36 | + <?php if ($this->csrf()->name() != '') : ?> |
|
37 | 37 | , "csrf": { |
38 | 38 | "name": "<?= $this->csrf()->name(); ?>", |
39 | 39 | "value": "<?= $this->csrf()->value(); ?>" |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | <?php endif; ?> |
42 | 42 | } |
43 | 43 | |
44 | - <?php if( isset( $this->errors ) ) : ?> |
|
44 | + <?php if (isset($this->errors)) : ?> |
|
45 | 45 | |
46 | - ,"errors": <?= $this->partial( $this->config( 'admin/jsonadm/partials/template-errors', 'partials/errors-standard' ), array( 'errors' => $this->errors ) ); ?> |
|
46 | + ,"errors": <?= $this->partial($this->config('admin/jsonadm/partials/template-errors', 'partials/errors-standard'), array('errors' => $this->errors)); ?> |
|
47 | 47 | |
48 | 48 | <?php endif; ?> |
49 | 49 |
@@ -8,19 +8,19 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | |
11 | -$data = $this->get( 'data', [] ); |
|
11 | +$data = $this->get('data', []); |
|
12 | 12 | $entries = []; |
13 | 13 | |
14 | -foreach( $data as $key => $value ) { |
|
15 | - $entries[] = array( 'id' => $key, 'type' => 'aggregate', 'attributes' => $value ); |
|
14 | +foreach ($data as $key => $value) { |
|
15 | + $entries[] = array('id' => $key, 'type' => 'aggregate', 'attributes' => $value); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | { |
20 | 20 | "meta": { |
21 | - "total": <?= count( $data ); ?> |
|
21 | + "total": <?= count($data); ?> |
|
22 | 22 | |
23 | - <?php if( $this->csrf()->name() != '' ) : ?> |
|
23 | + <?php if ($this->csrf()->name() != '') : ?> |
|
24 | 24 | , "csrf": { |
25 | 25 | "name": "<?= $this->csrf()->name(); ?>", |
26 | 26 | "value": "<?= $this->csrf()->value(); ?>" |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | |
30 | 30 | }, |
31 | 31 | |
32 | - <?php if( isset( $this->errors ) ) : ?> |
|
32 | + <?php if (isset($this->errors)) : ?> |
|
33 | 33 | |
34 | - "errors": <?= $this->partial( $this->config( $this->get( 'partial-errors', 'admin/jsonadm/partials/template-errors' ), 'partials/errors-standard' ), array( 'errors' => $this->errors ) ); ?> |
|
34 | + "errors": <?= $this->partial($this->config($this->get('partial-errors', 'admin/jsonadm/partials/template-errors'), 'partials/errors-standard'), array('errors' => $this->errors)); ?> |
|
35 | 35 | |
36 | - <?php elseif( isset( $this->data ) ) : ?> |
|
36 | + <?php elseif (isset($this->data)) : ?> |
|
37 | 37 | |
38 | - "data": <?= json_encode( $entries ); ?> |
|
38 | + "data": <?= json_encode($entries); ?> |
|
39 | 39 | |
40 | 40 | <?php endif; ?> |
41 | 41 | } |