-
Notifications
You must be signed in to change notification settings - Fork 21
/
Menu.php
169 lines (150 loc) · 3.44 KB
/
Menu.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
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<?php
namespace ScandiPWA\MenuOrganizer\Model;
use ScandiPWA\MenuOrganizer\Api\Data\MenuInterface;
use Magento\Framework\DataObject\IdentityInterface;
/**
* @category ScandiPWA
* @package ScandiPWA\MenuOrganizer\Model
* @copyright Copyright (c) 2015 Scandiweb, Ltd (http://scandiweb.com)
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*
* Class Menu
*/
class Menu extends \Magento\Framework\Model\AbstractModel implements MenuInterface, IdentityInterface
{
/**
* CMS page cache tag
*/
const CACHE_TAG = 'sw_m';
/**
* @var string
*/
protected $_cacheTag = 'sw_m';
/**
* Prefix of model events names
*
* @var string
*/
protected $_eventPrefix = 'scandipwa_menuorganizer_menu';
/**
* Initialize resource model
*
* @return void
*/
protected function _construct()
{
$this->_init('ScandiPWA\MenuOrganizer\Model\ResourceModel\Menu');
}
/**
* Return unique ID(s) for each object in system
*
* @return array
*/
public function getIdentities()
{
return [self::CACHE_TAG . '_' . $this->getId()];
}
/**
* Get ID
*
* @return int|null
*/
public function getId()
{
return $this->getData(self::MENU_ID);
}
/**
* @return string
*/
public function getIdentifier()
{
return $this->getData(self::IDENTIFIER);
}
/**
* @return string|null
*/
public function getTitle()
{
return $this->getData(self::TITLE);
}
/**
* @return string|null
*/
public function getType()
{
return $this->getData(self::TYPE);
}
/**
* @return mixed
*/
public function getCssClass()
{
return $this->getData(self::CSS_CLASS);
}
/**
* @return bool|null
*/
public function isActive()
{
return (bool) $this->getData(self::IS_ACTIVE);
}
/**
* Set ID
*
* @param int $id
* @return \ScandiPWA\MenuOrganizer\Api\Data\MenuInterface
*/
public function setId($id)
{
return $this->setData(self::MENU_ID, $id);
}
/**
* Set URL Key
*
* @param string $identifier
* @return \ScandiPWA\MenuOrganizer\Api\Data\MenuInterface
*/
public function setIdentifier($identifier)
{
return $this->setData(self::IDENTIFIER, $identifier);
}
/**
* Set title
*
* @param string $title
* @return \ScandiPWA\MenuOrganizer\Api\Data\MenuInterface
*/
public function setTitle($title)
{
return $this->setData(self::TITLE, $title);
}
/**
* Set menu type
*
* @param string $type
* @return \ScandiPWA\MenuOrganizer\Api\Data\MenuInterface
*/
public function setType($type)
{
return $this->setData(self::TYPE, $type);
}
/**
* @param string $class
* @return \ScandiPWA\MenuOrganizer\Api\Data\MenuInterface
*/
public function setCssClass($class)
{
return $this->setData(self::CSS_CLASS, $class);
}
/**
* Set is active
*
* @param int|bool $is_active
* @return \ScandiPWA\MenuOrganizer\Api\Data\MenuInterface
*/
public function setIsActive($is_active)
{
return $this->setData(self::IS_ACTIVE, $is_active);
}
}