-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathContentType.php
More file actions
executable file
·91 lines (85 loc) · 2.38 KB
/
ContentType.php
File metadata and controls
executable file
·91 lines (85 loc) · 2.38 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/**
* Content type lets you define the structure or
* blueprint of a page or a section of your web or
* mobile property.
*
* PHP version 5
*
* @category PHP
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
namespace Contentstack\Stack;
use Contentstack\Stack\ContentType\Entry;
use Contentstack\Stack\ContentType\Query;
use Contentstack\Support\Utility;
/**
* Class ContentType
*
* @category PHP
* @package Contentstack
* @author Uttam K Ukkoji <uttamukkoji@gmail.com>
* @author Rohit Mishra <rhtmishra4545@gmail.com>
* @copyright 2012-2021 Contentstack. All Rights Reserved
* @license https://github.com/contentstack/contentstack-php/blob/master/LICENSE.txt MIT Licence
* @link https://pear.php.net/package/contentstack
* */
#[\AllowDynamicProperties]
class ContentType
{
var $uid = '';
var $stack = '';
/**
* ContentType
* ContentType Class to initalize your ContentType
*
* @param string $uid - valid content type uid
* @param Stack $stack - Stack Instance
* */
public function __construct($uid = '', $stack = '')
{
$this->uid = $uid;
$this->stack = $stack;
$this->type = 'contentType';
}
/**
* Entry object to create the "Query" on the specified ContentType
*
* @param string $entry_uid - Entry uid to get details
*
* @return Entry
* */
public function Entry($entry_uid = '')
{
return new Entry($entry_uid, $this);
}
/**
* Fetch the specific contenttypes
*
* @param object $params - Parameters to fetch content
*
* @return Request
* */
public function fetch($params = null)
{
if ($params) {
$myArray = json_decode($params, true);
$this->_query = $myArray;
}
return Utility::contentstackRequest($this->stack, $this);
}
/**
* Query object to create the "Query" on the specified ContentType
*
* @return Query
* */
public function Query()
{
return new Query($this, $this->type);
}
}