55 */
66namespace Magento \Catalog \Model \Product \Attribute \Source ;
77
8- use Magento \Framework \App \Cache \Type \Layout as LayoutCache ;
9- use Magento \Framework \App \ObjectManager ;
10-
118/**
129 * Catalog product landing page attribute source
10+ *
11+ * @author Magento Core Team <[email protected] > 1312 */
1413class Layout extends \Magento \Eav \Model \Entity \Attribute \Source \AbstractSource
1514{
@@ -18,40 +17,22 @@ class Layout extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
1817 */
1918 protected $ pageLayoutBuilder ;
2019
21- /**
22- * @var LayoutCache
23- */
24- private $ layoutCache ;
25-
2620 /**
2721 * @param \Magento\Framework\View\Model\PageLayout\Config\BuilderInterface $pageLayoutBuilder
28- * @param LayoutCache|null $layoutCache
2922 */
30- public function __construct (
31- \Magento \Framework \View \Model \PageLayout \Config \BuilderInterface $ pageLayoutBuilder ,
32- LayoutCache $ layoutCache = null
33- ) {
23+ public function __construct (\Magento \Framework \View \Model \PageLayout \Config \BuilderInterface $ pageLayoutBuilder )
24+ {
3425 $ this ->pageLayoutBuilder = $ pageLayoutBuilder ;
35- $ this ->layoutCache = $ layoutCache ?? ObjectManager::getInstance ()->get (LayoutCache::class);
3626 }
3727
3828 /**
39- * Get list of available layouts
40- *
4129 * @return array
4230 */
4331 public function getAllOptions ()
4432 {
4533 if (!$ this ->_options ) {
46- $ layoutCacheKey = __CLASS__ ;
47- if ($ data = $ this ->layoutCache ->load ($ layoutCacheKey )) {
48- return $ this ->_options = unserialize ($ data );
49- } else {
50- $ this ->_options = $ this ->pageLayoutBuilder ->getPageLayoutsConfig ()->toOptionArray ();
51- array_unshift ($ this ->_options , ['value ' => '' , 'label ' => __ ('No layout updates ' )]);
52- $ this ->layoutCache ->save (serialize ($ this ->_options ), $ layoutCacheKey );
53- }
54-
34+ $ this ->_options = $ this ->pageLayoutBuilder ->getPageLayoutsConfig ()->toOptionArray ();
35+ array_unshift ($ this ->_options , ['value ' => '' , 'label ' => __ ('No layout updates ' )]);
5536 }
5637 return $ this ->_options ;
5738 }
0 commit comments