0

I have component which has config.xml. It is render with the com_config/view/component/tmpl/default.php. I need to override this file in my component and create my custom layout. Red all the articles around but still can't understand how to do it. Can someone show me a little example of this or leads me to the correct way. Thank you! config.xml of my component:

<?xml version="1.0" encoding="utf-8"?>
<config>
    <fieldset label="COM_CARS_FORM_DEFAULT_FIELD_VALUES" name="cars">
        <field name="default_category" query="SELECT id, category&#13;&#10;FROM #__cars_categories &#13;&#10;WHERE state=1;" key_field="id" value_field="category" multiple="true" type="sql" label="COM_CARS_FORM_LBL_DEFAULT_CATEGORY" description="COM_CARS_FORM_DESC_DEFAULT_CATEGORY" hint="COM_CARS_FORM_LBL_DEFAULT_CATEGORY"/>
        <field name="default_make" query="SELECT id, make&#13;&#10;FROM #__cars_makes &#13;&#10;WHERE state=1;" key_field="id" value_field="make" header="- none selected -" type="sql" label="COM_CARS_FORM_LBL_DEFAULT_MAKE" description="COM_CARS_FORM_DESC_DEFAULT_MAKE" hint="COM_CARS_FORM_LBL_DEFAULT_MAKE"/>
        <field name="default_bodytype" query="SELECT id, bodytype&#13;&#10;FROM #__cars_bodytypes&#13;&#10;WHERE state=1;" key_field="id" value_field="bodytype" header="- none selected -" type="sql" label="COM_CARS_FORM_LBL_DEFAULT_BODYTYPE" description="COM_CARS_FORM_DESC_DEFAULT_BODYTYPE" hint="COM_CARS_FORM_LBL_DEFAULT_BODYTYPE"/>
        <field name="default_fueltype" query="SELECT id, fueltype&#13;&#10;FROM #__cars_fueltypes &#13;&#10;WHERE state=1;" key_field="id" value_field="fueltype" header="- none selected -" type="sql" label="COM_CARS_FORM_LBL_DEFAULT_FUELTYPE" description="COM_CARS_FORM_DESC_DEFAULT_FUELTYPE" hint="COM_CARS_FORM_LBL_DEFAULT_FUELTYPE"/>
        <field name="default_transmission" query="SELECT id, transmission&#13;&#10;FROM #__cars_transmissions &#13;&#10;WHERE state=1;" key_field="id" value_field="transmission" header="- none selected -" type="sql" label="COM_CARS_FORM_LBL_DEFAULT_TRANSMISSION" description="COM_CARS_FORM_DESC_DEFAULT_TRANSMISSION" hint="COM_CARS_FORM_LBL_DEFAULT_TRANSMISSION"/>
        <field name="default_emissionsclass" query="SELECT id, emissionsclass&#13;&#10;FROM #__cars_emissionsclasses &#13;&#10;WHERE state=1;" key_field="id" value_field="emissionsclass" header="- none selected -" type="sql" label="COM_CARS_FORM_LBL_DEFAULT_EMISSIONSCLASS" description="COM_CARS_FORM_DESC_DEFAULT_EMISSIONSCLASS" hint="COM_CARS_FORM_LBL_DEFAULT_EMISSIONSCLASS"/>
        <field name="default_interior" query="SELECT id, interior&#13;&#10;FROM #__cars_interiors&#13;&#10;WHERE state=1;" key_field="id" value_field="interior" header="- none selected -" type="sql" label="COM_CARS_FORM_LBL_DEFAULT_INTERIOR" description="COM_CARS_FORM_DESC_DEFAULT_INTERIOR" hint="COM_CARS_FORM_LBL_DEFAULT_INTERIOR"/>
        <field name="default_options" query="SELECT id, option&#13;&#10;FROM #__cars_options &#13;&#10;WHERE state=1;" key_field="id" value_field="option" multiple="true" type="sql" label="COM_CARS_FORM_LBL_DEFAULT_OPTIONS" description="COM_CARS_FORM_DESC_DEFAULT_OPTIONS" hint="COM_CARS_FORM_LBL_DEFAULT_OPTIONS"/>
        <field name="default_warranty" filter="string" type="text" label="COM_CARS_FORM_LBL_DEFAULT_WARRANTY" description="COM_CARS_FORM_DESC_DEFAULT_WARRANTY" hint="COM_CARS_FORM_LBL_DEFAULT_WARRANTY"/>
    </fieldset>
    <fieldset label="COM_CARS_FORM_IMG_SETTINGS" name="images">
        <field name="img_accepted_files" filter="string" type="text" default="image/jpeg,image/png,image/gif,image/jpg" label="COM_CARS_FORM_LBL_IMG_ACCEPTED_FILES" description="COM_CARS_FORM_DESC_IMG_ACCEPTED_FILES" hint="COM_CARS_FORM_LBL_IMG_ACCEPTED_FILES"/>
        <field name="img_maxwidth" maxlength="5" filter="unit" type="text" default="1600" label="COM_CARS_FORM_LBL_IMG_MAXWIDTH" description="COM_CARS_FORM_DESC_IMG_MAXWIDTH" hint="COM_CARS_FORM_LBL_IMG_MAXWIDTH"/>
        <field name="img_maxheight" maxlength="5" filter="unit" type="text" default="1000" label="COM_CARS_FORM_LBL_IMG_MAXHEIGHT" description="COM_CARS_FORM_DESC_IMG_MAXHEIGHT" hint="COM_CARS_FORM_LBL_IMG_MAXHEIGHT"/>
        <field name="img_aspect_ratio" default="8/5" type="list" label="COM_CARS_FORM_LBL_IMG_ASPECT_RATIO" description="COM_CARS_FORM_DESC_IMG_ASPECT_RATIO" hint="COM_CARS_FORM_LBL_IMG_ASPECT_RATIO">
            <option value="16/9">16:9</option>
            <option value="8/5">8:5</option>
            <option value="3/2">3:2</option>
            <option value="4/3">4:3</option>
        </field>
        <field name="img_size_large" maxlength="4" filter="unit" type="text" default="1200" label="COM_CARS_FORM_LBL_IMG_SIZE_LARGE" description="COM_CARS_FORM_DESC_IMG_SIZE_LARGE" hint="COM_CARS_FORM_LBL_IMG_SIZE_LARGE"/>
        <field name="img_size_medium" maxlength="4" filter="unit" type="text" default="600" label="COM_CARS_FORM_LBL_IMG_SIZE_MEDIUM" description="COM_CARS_FORM_DESC_IMG_SIZE_MEDIUM" hint="COM_CARS_FORM_LBL_IMG_SIZE_MEDIUM"/>
        <field name="img_size_small" maxlength="4" filter="unit" type="text" default="288" label="COM_CARS_FORM_LBL_IMG_SIZE_SMALL" description="COM_CARS_FORM_DESC_IMG_SIZE_SMALL" hint="COM_CARS_FORM_LBL_IMG_SIZE_SMALL"/>
        <field name="img_zoom" default="0.10" type="list" label="COM_CARS_FORM_LBL_IMG_ZOOM" description="COM_CARS_FORM_DESC_IMG_ZOOM" hint="COM_CARS_FORM_LBL_IMG_ZOOM">
            <option value="0.05">5%</option>
            <option value="0.10">10%</option>
            <option value="0.15">15%</option>
            <option value="0.20">20%</option>
            <option value="0.25">25%</option>
        </field>
        <field name="img_rotate" default="45" type="list" label="COM_CARS_FORM_LBL_IMG_ROTATE" description="COM_CARS_FORM_DESC_IMG_ROTATE" hint="COM_CARS_FORM_LBL_IMG_ROTATE">
            <option value="30">COM_CARS_FORM_IMG_ROTATE_OPTION_DEGREES_30</option>
            <option value="45">COM_CARS_FORM_IMG_ROTATE_OPTION_DEGREES_45</option>
            <option value="90">COM_CARS_FORM_IMG_ROTATE_OPTION_DEGREES_90</option>
        </field>

    </fieldset>

    <fieldset name="permissions" description="JCONFIG_PERMISSIONS_DESC" label="JCONFIG_PERMISSIONS_LABEL">
        <field name="rules" type="rules" component="com_cars" class="inputbox" filter="rules" validate="rules" label="JCONFIG_PERMISSIONS_LABEL" section="component" />
    </fieldset>

    <fieldset name="component">
        <field name="save_history" type="radio" class="btn-group btn-group-yesno" default="0" label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL" description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC">
            <option value="0">JNO</option>
            <option value="1">JYES</option>
        </field>

        <field name="history_limit" type="text" filter="integer" label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL" description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC" default="5"/>
    </fieldset>
    <fieldset label="COM_IMAGE_SLIDESHOWS" name="image_slideshows">

    </fieldset>

    <fieldset name="permissions" description="JCONFIG_PERMISSIONS_DESC" label="JCONFIG_PERMISSIONS_LABEL">
        <field name="rules" type="rules" component="com_cars" class="inputbox" filter="rules" validate="rules" label="JCONFIG_PERMISSIONS_LABEL" section="component" />
    </fieldset>

    <fieldset name="component">
        <field name="save_history" type="radio" class="btn-group btn-group-yesno" default="0" label="JGLOBAL_SAVE_HISTORY_OPTIONS_LABEL" description="JGLOBAL_SAVE_HISTORY_OPTIONS_DESC">
            <option value="0">JNO</option>
            <option value="1">JYES</option>
        </field>

        <field name="history_limit" type="text" filter="integer" label="JGLOBAL_HISTORY_LIMIT_OPTIONS_LABEL" description="JGLOBAL_HISTORY_LIMIT_OPTIONS_DESC" default="5"/>
    </fieldset>
</config>
6
  • Welcome to JSE. Please take our tour. If you have "tried something" please show it to us, this way volunteers don't need to deliver a complete tutorial which includes things you already understand. To receive the quickest / most helpful support, always try to narrow your question as much as possible.
    – mickmackusa
    Feb 1 '20 at 1:10
  • 1
    Hi Toma! It's rather unclear what you are trying to achieve. Is this a custom component you are developing, or an existing or core component? How the config.xml is related to the view? Usually, we do template overrides by copying the template file inside the current template's "html" folder. There is a lot of documentation regarding these overrides. Could you be more specific about your actual problem?
    – FFrewin
    Feb 1 '20 at 13:53
  • I am trying to make custom view for the component configuration. I am new in joomla and maybe can't explain it well.
    – Toma Tomov
    Feb 2 '20 at 8:47
  • 1
    Are you sure that's what's rendering it? com_config should never be rendering a file from another component. Unless somehow you named your own component the same name as com_config, which you really shouldn't do (never a good idea to name something the same name as core components). Might be useful to go into more detail about what's in the .xml file you're referring to, and the name of component. The problem could be as simple as you choosing the wrong name for your config.xml file.
    – Arlen
    Feb 3 '20 at 21:26
  • 2
    If those config options are intended to be what gets shown after you click on the options button in the top right, of your component's admin pages, those are supposed to be handled by com_config, not by your component. Notice when you click that button (from any component) you get access to all of the various component configs from the left nav, and every one of them looks the same. The only way around that is to avoid the joomla config system completely and write your own by creating your own model and controller to view/edit them. That's a lot of work for minimal gain, I think.
    – Arlen
    Feb 3 '20 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.