Skip to content

Commit 8a2af09

Browse files
committed
Get existing page data only on edit page
1 parent 727294d commit 8a2af09

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

app/code/Magento/Cms/Model/Page/DataProvider.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Cms\Model\Page;
77

@@ -215,12 +215,15 @@ public function getMeta()
215215

216216
$page = null;
217217
try {
218-
$page = $this->pageRepository->getById($this->getPageId());
219-
if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) {
220-
$options[] = ['label' => 'Use existing layout update XML', 'value' => '_existing_'];
221-
}
222-
foreach ($this->customLayoutManager->fetchAvailableFiles($page) as $layoutFile) {
223-
$options[] = ['label' => $layoutFile, 'value' => $layoutFile];
218+
$pageId = $this->getPageId();
219+
if ($pageId) {
220+
$page = $this->pageRepository->getById($pageId);
221+
if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) {
222+
$options[] = ['label' => 'Use existing layout update XML', 'value' => '_existing_'];
223+
}
224+
foreach ($this->customLayoutManager->fetchAvailableFiles($page) as $layoutFile) {
225+
$options[] = ['label' => $layoutFile, 'value' => $layoutFile];
226+
}
224227
}
225228
} catch (LocalizedException $e) {
226229
$this->logger->error($e->getMessage());

0 commit comments

Comments
 (0)