Adding category parameter(s) - joomla

I'm developing extension, using native Joomla categories. I would like to add one additional parameter in category editor, which only be used when editing my extension's category.
The question:
Is it possible without overriding Joomla core files?

The previous answer (new XML file) is very close, but doesn't quite work in Joomla 3.x. To make it work I had to change the name attribute of the fields element to "params" as follows:
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="params">
<fieldset name="basic" label="Group settings">
<field name="group_id" type="list" default="" label="Select group:">
<option value=""></option>
<option value="1">Group 1</option>
<option value="2">Group 2</option>
<option value="3">Group 3</option>
</field>
</fieldset>
</fields>
</form>
This way, the custom options show in the options tab of the category edit screen.
Also, if you have more than one type of category in your component (for example, "com_mycomponent.mycategorytype"), you need to make the name of the XML file "category.mytype.xml".

Well actually after night of no sleep i was able to find an elegant native solution.
Unfortunately Joomla devs didn't documented it, but it appears that in your extension you create file:
/administrator/components/com_YourName/models/forms/category.xml and add there a fieldset "attribs" it automatically appears in your extension's category manager.
Sample code of category.xml here:
<?xml version="1.0" encoding="utf-8"?>
<form>
<fields name="attribs">
<fieldset name="attribs" label="Group settings">
<field name="group_id" type="list" default="" label="Select group:">
<option value=""></option>
<option value="1">Group 1</option>
<option value="2">Group 2</option>
<option value="3">Group 3</option>
</field>
</fieldset>
</fields>
</form>

UPDATED
Yes, this can also be done without hacking core files.
You can create a template override for the administrator com_categories component.
Copy this file:
administrator/components/com_categories/views/category/tmpl/edit.php
in this path (you need to create the corresponding directories):
administrator/templates/bluestork/html/com_categories/category/edit.php
In this new file you can work all your magic.
If you need something more advanced, you can use a plugin that allows you to override models and any other part of the component: Plugin Override

Related

Find an option tag with 'selected' attribute with robot framework

The application under text includes these option tags:
<option value="0" selected>Page 1</option>
<option value="1">Page 2</option>
<option value="2">Page 3</option>
etc.
Using Robot Framework, I would like to create a locator to find the option tag that contains or ends with "selected"
So far I've not been able to get one to work.
XPath for the selected option above is:
//*[#id="sfpagingation-dropdown"]/option[1]
CSS for same selcted option is:
#sfpagingation-dropdown > option:nth-child(1)
Maybe it's not possible?
Thanks for any assistance.
Figured it out, or at least, I have something that seems to be working:
${SELECTED}= xpath=//option[#selected=""]
"Wait until page contains element" is also necessary

Apply Kendo UI dropdown styles to a select element

My app is on an older version of Kendo UI ~V2014.
I need to create a drowdown list with a tree view which this version of kendo does not support.
I'm trying to determine what kendo css classes to apply to get my select element to look similar to the other drop downs on my site.
```
<select class="k-widget k-dropdown-wrap k-header">
<option value="" selected disabled hidden>- Select -</option>
<optgroup label="Swedish Cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
</select>
```
After further investigation I've determined this is not practical to do.
The Kendo drop-down module is built using spans not a select element, therefor the styles and behaviors do not exactly translate.
An alternative is to use two cascading drop-downs.

how to implement multi checkbox dropdown without any third party libraries

How to implement multi checkbox drop down without any third party libraries.
We want a dropdown having checkboxes not in jquery and javascript. we want pure server side control
.
Pure server side control means you will only rely on the HTML standards.
The HTML Select element has a multiple attribute which lets the user choose multiple values.
The HTML specification doesn't require a specific rendering layout which lets the browser free from any constraints. Most of the time, selected options are simply hightlighted, plus the multiple attribute makes the select element to loose its dropdown looking style (you can reduce its height using the size attribute).
<!-- The second value will be selected initially -->
<p>Maintain <kbd>Ctrl</kbd> key down to select multiple elements</p>
<select name="multi" multiple size="2">
<option value="value1">Value 1</option>
<option value="value2" selected>Value 2</option>
<option value="value3">Value 3</option>
<option value="value4">Value 4</option>
<option value="value5">Value 5</option>
<option value="value6">Value 6</option>
<option value="value7">Value 7</option>
<option value="value8">Value 8</option>
<option value="value9">Value 9</option>
<option value="value10">Value 10</option>
</select>
If you change your mind about using Javascript, you could implement what this well detailed answer suggests as it requires just very few additional Javascript and css and but no library.

Whats the easiest way to add custom style to the module parameters form at the admin in Joomla?

My simple module using 3 field, 2 text input and a tinymce textarea, but the textarea looks broken. http://img151.imageshack.us/img151/8648/joomla464.jpg
This is my config:
<config>
<fields name="params">
<fieldset name="basic">
<field name="moduleclass_sfx" type="text" default="" label="Module Class Suffix" description="PARAMMODULECLASSSUFFIX" />
<field name="url" type="text" default="" label="Paste the url" description="" />
<field style="clear:both;float:left;background-color:red;" name="description" type="editor" default="default" rows="20" cols="40" />
</fieldset>
</fields>
</config>
ty
You could add your css to
administrator/templates/bluestork/css/template.css (That is if your using the default administration template)
but there is a risk when joomla updates you will lose your css... you could alwasy copiy the template... give it a diffrent name and update the css there. so your copie wont be affected by any joomla update.
so adding your css there you just need to use the right css selector.
Otherwise i would use an artical selector or category selector
<field
name="category_id"
type="category"
description="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_DESC"
extension="com_content"
label="JGLOBAL_FIELD_CATEGORIES_CHOOSE_CATEGORY_LABEL"
show_root="true"
required="true" />
And put what ever content you need in an artical.. you dont have much room to put the editor on the right for the modules configurations anyway.

Joomla component not appearing in the menu item types

I just followed the joomla tutorials on how to create the "perfect" MVC joomla component. However, my problem is that I don't know yet how to assign it to a menu. I thought that my component would then just show up when I select a "menu item type", but my component is not on this list. I've made some research on Google, but I cannot find the answer... Do I have to create a metadata.xml file or something similar ?
Thanks in advance for your answers !!
To create "views" for your component, you have to create some xml files.
Inside the templates folder in the frontend part of your component (usually something like /components/com_yourcomponent/views/someview/tmpl), if you had a template named default.php and form.php, you can create a default.xml file and a form.xml file to make these menu items available from the administrator.
You can take a look at other components to see the structure of these xml files, but what you should put inside is:
1) A name and a description for four view
2) The params the user will be able to change from the administrator (it works like module/plugin params)
3) You can also set "hidden" request variables for that menu item. It means that those vars will be added to the request in that particular menu item, but the user won't be able to change its value.
Here's a complete example for a component (Joomla 1.7):
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_AGMTAGS_TAG_VIEW_DEFAULT_TITLE">
<message>COM_AGMTAGS_TAG_VIEW_DEFAULT_DESC</message>
</layout>
<fields name="request" addfieldpath="/administrator/components/com_agmtags/models/fields">
<fieldset name="request">
<field name="tag_id" type="agmtag"
label="COM_AGMTAGS_TAG_FIELD_NAME_LABEL"
description="COM_AGMTAGS_TAG_FIELD_NAME_DESC"
/>
</fieldset>
</fields>
<fields name="params">
<fieldset name="basic" label="COM_AGMTAGS_TAG_OPTIONS">
<field name="layout_type" type="hidden" default="blog" />
<field name="show_tag_name" type="list"
label="COM_AGMTAGS_SHOW_TAG_NAME"
description="COM_AGMTAGS_SHOW_TAG_NAME_DESC"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="show_tag_description" type="list"
description="COM_AGMTAGS_SHOW_TAG_DESCRIPTION_DESC"
label="COM_AGMTAGS_SHOW_TAG_DESCRIPTION_LABEL"
>
<option value="">JGLOBAL_USE_GLOBAL</option>
<option value="0">JHIDE</option>
<option value="1">JSHOW</option>
</field>
<field name="items_per_page" type="text" default="" />
<field name="container_class" type="text" default="agmtags-list" />
</fieldset>
</fields>
</metadata>
I hope it helped!
If you simply want to add the view link to the list create a xml file called default.xml inside the com_yourcomponent/views/yourviewname/tmpl/
The xml code below takes two language strings used to display your menu item link in the list
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_YOURCOMPONENT_FRONPAGE_TITLE">
<message>COM_YOURCOMPONENT_FRONPAGE_MSG</message>
</layout>
</metadata>
save the file and the link should appear in the list of menu items
Apparently, you also need the administration menu tags in your installation XML file.
http://forum.joomla.org/viewtopic.php?p=706714
This worked for me
<administration>
<menu>COM_COMPONET</menu>
<submenu>
etc...
</submenu>
Think this is what Panayiotis was trying to say
Additionally there is also another catch.
In the installation XML file of the component,
in the section, the tags must
be present, even if you do not need the menu.
If these are missing, then you'll never be given
the option to add this component to a menu item,
because the type wont be there :-)
In additional, your alternative view file names MUST NOT be written with underscores.
table_catalog.xml
table_catalog.php
table_catalog_item.php
didn't work - there wasn't new option in "menu item type" list. But
tablecatalog.xml
tablecatalog.php
tablecatalog_item.php
file names work perfectly. I've lost an hour revealing a problem.

Resources