7
7
8
8
use Magento \Framework \App \Cache \Type \Layout as LayoutCache ;
9
9
use Magento \Framework \App \ObjectManager ;
10
- use Magento \Framework \Serialize \SerializerInterface ;
11
- use Magento \Framework \Serialize \Serializer \Json ;
12
10
13
11
/**
14
12
* Catalog product landing page attribute source
@@ -25,44 +23,36 @@ class Layout extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
25
23
*/
26
24
private $ layoutCache ;
27
25
28
- /**
29
- * @var SerializerInterface
30
- */
31
- private $ serializer ;
32
-
33
26
/**
34
27
* @param \Magento\Framework\View\Model\PageLayout\Config\BuilderInterface $pageLayoutBuilder
35
28
* @param LayoutCache|null $layoutCache
36
- * @param SerializerInterface|null $serializer
37
29
*/
38
30
public function __construct (
39
31
\Magento \Framework \View \Model \PageLayout \Config \BuilderInterface $ pageLayoutBuilder ,
40
- LayoutCache $ layoutCache = null ,
41
- SerializerInterface $ serializer = null
32
+ LayoutCache $ layoutCache = null
42
33
) {
43
34
$ this ->pageLayoutBuilder = $ pageLayoutBuilder ;
44
35
$ this ->layoutCache = $ layoutCache ?? ObjectManager::getInstance ()->get (LayoutCache::class);
45
- $ this ->serializer = $ serializer ?? ObjectManager::getInstance ()->get (Json::class);
46
36
}
47
37
48
38
/**
49
39
* Get list of available layouts
50
40
*
51
41
* @return array
52
- * @throws \InvalidArgumentException
53
42
*/
54
43
public function getAllOptions ()
55
44
{
56
45
if (!$ this ->_options ) {
57
46
$ layoutCacheKey = __CLASS__ ;
58
47
if ($ data = $ this ->layoutCache ->load ($ layoutCacheKey )) {
59
- return $ this ->_options = $ this -> serializer -> unserialize ($ data );
48
+ return $ this ->_options = unserialize ($ data );
60
49
} else {
61
50
$ this ->_options = $ this ->pageLayoutBuilder ->getPageLayoutsConfig ()->toOptionArray ();
62
- $ this ->layoutCache ->save ($ this ->serializer ->serialize ($ this ->_options ), $ layoutCacheKey );
51
+ array_unshift ($ this ->_options , ['value ' => '' , 'label ' => __ ('No layout updates ' )]);
52
+ $ this ->layoutCache ->save (serialize ($ this ->_options ), $ layoutCacheKey );
63
53
}
54
+
64
55
}
65
- array_unshift ($ this ->_options , ['value ' => '' , 'label ' => __ ('No layout updates ' )]);
66
56
return $ this ->_options ;
67
57
}
68
58
}
0 commit comments