PluginProbe ʕ •ᴥ•ʔ
Kirki – Freeform Page Builder, Website Builder & Customizer / 6.0.13
Kirki – Freeform Page Builder, Website Builder & Customizer v6.0.13
6.1.1 6.1.0 6.0.14 6.0.13 6.0.12 6.0.11 6.0.10 6.0.9 6.0.8 6.0.7 6.0.6 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 4.0.19 4.0.20 4.0.21 4.0.22 4.0.23 4.0.24 4.1 4.2.0 5.0.0 5.1.0 5.1.1 5.2.0 5.2.1 5.2.2 5.2.3 6.0.0 trunk 3.0.40 3.0.41 3.0.42 3.0.43 3.0.44 3.0.45 3.1.0 3.1.1 3.1.2
kirki / app / Resources / Collection / CollectionResource.php
kirki / app / Resources / Collection Last commit date
CollectionResource.php 3 weeks ago
CollectionResource.php
47 lines
1 <?php
2
3 namespace Kirki\App\Resources\Collection;
4
5 use Kirki\Framework\Resource;
6
7 class CollectionResource extends Resource
8 {
9 /**
10 * Convert the collection resource to an array.
11 *
12 * @return array The collection data as an associative array.
13 */
14 public function to_array()
15 {
16 $basic_fields = $this->basic_fields ? ($this->basic_fields->meta_value ?? null) : null;
17
18 if (empty($basic_fields)) {
19 $basic_fields = [
20 'post_title' => ['title' => 'Name', 'help_text' => ''],
21 'post_name' => ['title' => 'Slug', 'help_text' => ''],
22 ];
23 }
24
25 return [
26 'ID' => (int) $this->ID,
27 'post_author' => (int) $this->post_author,
28 'post_date' => $this->post_date,
29 'post_content' => $this->post_content,
30 'post_title' => $this->post_title,
31 'post_excerpt' => $this->post_excerpt,
32 'post_status' => $this->post_status,
33 'post_name' => $this->post_name,
34 'post_modified' => $this->post_modified,
35 'post_parent' => (int) $this->post_parent,
36 'url' => home_url('?p=' . $this->ID),
37 'menu_order' => (int) $this->menu_order,
38 'post_type' => $this->post_type,
39 'comment_count' => (int) $this->comment_count,
40
41 'fields' => !empty($this->fields->meta_value) ? $this->fields->meta_value : [],
42 'item_count' => $this->items_count ?? 0,
43 'basic_fields' => $basic_fields,
44 ];
45 }
46 }
47