2017-12-11 1 views
0

나는 무시하려고 파일 응용 프로그램/코드/젠토/테마 /보기/프론트 엔드/layouts.xml젠토 2 : 나는 우선 어떻게 layouts.xml

내가 원하는,이 파일을 연장하지 않습니다 기본 디자인 레이아웃 중 일부를 관리자가 사용할 수 없도록이를 무시합니다. app/code/<Vendor>/Cms

만들기 파일 : 대신 layouts.xml를 오버라이드 (override)의

답변

0

나는 새로운 Module 만들기 다음

을하고 결국 app/code/<Vendor>/Cms/Model/PageLayout.php

<?php 

namespace <Vendor>\Cms\Model; 

use Magento\Cms\Model\Page\Source\PageLayout as BasePageLayout; 

class PageLayout extends BasePageLayout{ 

    public function toOptionArray() 
    { 
     $options = parent::toOptionArray(); 
     $remove = [ 
      "empty", 
      "1column", 
      "2columns-left", 
      "2columns-right", 
      "3columns", 
     ]; 

     foreach($options as $key => $layout){ 
      if(in_array($layout["value"], $remove)){ 
       unset($options[$key]); 
      } 
     } 

     return $options; 
    } 
} 

이는 $options를 가져온 다음 중 하나를 제거합니다을이 $option['value']

0123을 기반으로 한 $remove 배열에 있습니다. app/code/<Vendor>/Cms/view/adminhtml/ui_component/cms_page_form.xml

<?xml version="1.0" encoding="UTF-8" ?> 
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> 
    <fieldset name="design"> 
     <field name="page_layout"> 
      <argument name="data" xsi:type="array"> 
       <item name="options" xsi:type="object"><Vendor>\Cms\Model\PageLayout</item> 
      </argument> 
     </field> 
    </fieldset> 
</form> 

우리는 지금을 검색하는 우리의 새로운 모델을 사용하는 ui_component 필드를 말하고있다 :이 실행을하기 위해

, 당신은이 파일을 작성하려면 app/code/Magento/Cms/view/adminhtml/ui_component/cms_page_form.xml

의 일부를 오버라이드 (override) 할 필요가 옵션.

또한 파일을 만들 수 있습니다 app/code/<Vendor>/Cms/view/adminhtml/ui_component/cms_page_listing.xml

<?xml version="1.0" encoding="UTF-8"?> 
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"> 
    <columns name="cms_page_columns"> 
     <column name="page_layout"> 
      <argument name="data" xsi:type="array"> 
       <item name="options" xsi:type="object"><Vendor>\Cms\Model\PageLayout</item> 
      </argument> 
     </column> 
    </columns> 
</listing>