Magento 2: ประเภทฟิลด์ที่มีอยู่ใน system.xml


26

มีค่าอะไรบ้างสำหรับประเภทฟิลด์ในetc/system.xmlไฟล์กำหนดค่า:

<?xml version="1.0"?>
<config
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <section id="...">
            <group id="...">
                <field id="..." type="???">
                    ...
                </field>
            </group>
        </section>
    </system>
</config>

คำตอบ:


44

การกำหนดค่าระบบวีโอไอพี 2 ให้ด้านล่างประเภทสาขา

checkbox,
checkboxes,
column,
date,
editablemultiselect,
editor,
fieldset,
file,
gallery,
hidden,
image,
imagefile,
label,
link,
multiline,
multiselect,
note,
obscure,
password,
radio,
radios,
reset,
select,
submit,
text,
textarea,
time

ป้ายกำกับใช้งานไม่ได้
— Zorox

ความคิดเกี่ยวกับวิธีการทำปุ่มใช่ / ไม่ใช่ที่มีสีเขียว / สีเทา?
— Zeeshan Khuwaja

@ ZeeshanKhuwaja และผู้คนในอนาคตสิ่งนี้ไม่ได้เชื่อมโยงกับ Q แต่คุณต้องการผนวก <source_model> Magento \ Config \ Model \ Config \ Model \ Config \ Source \ Yesno </source_model> ลงในเขตข้อมูลของคุณ
— John

15

ดูไฟล์/lib/internal/Magento/Framework/Data/Form/Element/Factory.php(พบได้ที่นี่บน Github สำหรับ Magento 2.2 & 2.3) เราสามารถค้นหารายการองค์ประกอบเริ่มต้นดังต่อไปนี้ตามที่ Amit ระบุไว้ในคำตอบของเขา :

// Factory.php, lines 26-55
protected $_standardTypes = [
    'button',
    'checkbox',
    'checkboxes',
    'column',
    'date',
    'editablemultiselect',
    'editor',
    'fieldset',
    'file',
    'gallery',
    'hidden',
    'image',
    'imagefile',
    'label',
    'link',
    'multiline',
    'multiselect',
    'note',
    'obscure',
    'password',
    'radio',
    'radios',
    'reset',
    'select',
    'submit',
    'text',
    'textarea',
    'time',
];

หากนักแต่งเพลงถูกนำมาใช้เพื่อติดตั้ง Magento ข้อมูลอาจพบได้ใน/vendor/magento/framework/Data/Form/Element/Factory.phpตามที่ระบุไว้ในความคิดเห็นของ Mohit ด้านล่าง


2
ฉันขอโทษที่เพิ่มคำตอบใหม่มากกว่าแสดงความคิดเห็นใน Amit เมื่อโพสต์คำตอบนี้ฉันไม่มีชื่อเสียงพอที่จะแสดงความคิดเห็นในคำตอบของผู้อื่น
— RNanoware

ฉันคิดว่าคุณได้ตอบคำถามของ Amit โดยการเพิ่มรายละเอียดไฟล์จากโรงงาน โหวตขึ้นสำหรับสิ่งนี้
— Mohit Kumar Arora

3
แต่ Magento ของฉัน 2.2.3 ไม่มีเส้นทางดังกล่าว ฉันสามารถหาไฟล์ Factory.php ที่/vendor/magento/framework/Data/Form/Element/Factory.phpพา ธ
— Mohit Kumar Arora

2
@MohitKumarArora คุณถูกต้อง! ฉันคิดว่าเส้นทางไฟล์ที่แตกต่างกันนั้นเกี่ยวข้องกับวิธีการติดตั้ง Magento: การโคลนจาก Git ดูเหมือนว่าจะใช้/lib/internalในขณะที่นักแต่งเพลงเป็นที่รู้จักกันในการสร้าง/vendorโฟลเดอร์ ฉันจะอัปเดตคำตอบตามนั้น ขอบคุณ!
— RNanoware

ผู้ใดสามารถเพิ่ม / อธิบายชนิดของฟิลด์ด้วยโมเดล sorce ได้เช่นเดียวกับ yesno มีโมเดลต้นทาง Magento / config / model / config / source / yesno
— nagendra
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.