November 30, 2016 6:40 am
image_round

How to add drop down system config tab in magento 2

<!----Introduction
Youre Company name = Ngage
Your Module name  = Testimonial --->

youre pathe is generate like this
app/code/Ngage/Ngage/etc/adminhtml/system.xml
app/code/Ngage/Ngage/Model/Config/Source/ListMode.php



Step 1 
first create system.xml file in following path
--> app/code/YourCompanyname/Modulename/etc/adminhtml/system.xml
-->copy past following code in your system.xml file
  
    <field id="list_mode" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
        <label>List Mode</label>
        <source_model>Companyname\Modulename\Model\Config\Source\listmode</source_model>
    </field>
------End step 1 ----------	
------Start Step 2 -------	
After then following Step 2


Create source model file in following path
app\code\Companyname\Modulename\Model\Config\Source\ListMode.php
--> copy past following code in your listmode.php

<?php 
  
namespace Companyname\Modulename\Model\Config\Source;	
class ListMode implements \Magento\Framework\Option\ArrayInterface
    {
    /**
     * {@inheritdoc}
     *
     * @codeCoverageIgnore
     */
    public function toOptionArray()
    {
        return [
            ['value' => 'grid', 'label' => __('Grid Only')],
            ['value' => 'list', 'label' => __('List Only')],
            ['value' => 'Slider', 'label' => __('Slider')],
        ];
    } 
    } 
  
?>

 
Free Download Module Magento 2 Ngage Studios

How to add drop down system config tab in magento 2

<!----Introduction
Youre Company name = Ngage
Your Module name  = Testimonial --->

youre pathe is generate like this
app/code/Ngage/Ngage/etc/adminhtml/system.xml
app/code/Ngage/Ngage/Model/Config/Source/ListMode.php



Step 1 
first create system.xml file in following path
--> app/code/YourCompanyname/Modulename/etc/adminhtml/system.xml
-->copy past following code in your system.xml file
  
    <field id="list_mode" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
        <label>List Mode</label>
        <source_model>Companyname\Modulename\Model\Config\Source\listmode</source_model>
    </field>
------End step 1 ----------	
------Start Step 2 -------	
After then following Step 2


Create source model file in following path
app\code\Companyname\Modulename\Model\Config\Source\ListMode.php
--> copy past following code in your listmode.php

<?php 
  
namespace Companyname\Modulename\Model\Config\Source;	
class ListMode implements \Magento\Framework\Option\ArrayInterface
    {
    /**
     * {@inheritdoc}
     *
     * @codeCoverageIgnore
     */
    public function toOptionArray()
    {
        return [
            ['value' => 'grid', 'label' => __('Grid Only')],
            ['value' => 'list', 'label' => __('List Only')],
            ['value' => 'Slider', 'label' => __('Slider')],
        ];
    } 
    } 
  
?>

 
Free Download Module Magento 2 Ngage Studios