Using the language filter facility

General questions relating to Joomla! 2.5. Note: All 1.6 and 1.7 releases have reached end of life and should be updated to 2.5. There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Locked
danielgc101
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Sat Apr 23, 2011 3:19 pm

Using the language filter facility

Post by danielgc101 » Sat Apr 23, 2011 3:24 pm

I see there's no 'Using the language filter facility' tutorial on joomla documentation wiki.

As seen: http://docs.joomla.org/Developing_a_Mod ... _-_Part_01

Do anyone knows a tutorial to create filters and search fields on components?

Thanks in advance!
Last edited by imanickam on Sat Apr 23, 2011 5:31 pm, edited 1 time in total.
Reason: Your other post (http://forum.joomla.org/viewtopic.php?f=626&t=615134) on the same Topic in the forum Components has been deleted. In the future, please do not post any Topic multiple times in the same or different forum(s).

rgjoyce
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Thu Jun 15, 2006 2:03 am
Location: Russia
Contact:

Re: Using the language filter facility

Post by rgjoyce » Sat Jun 24, 2017 10:26 am

I have been trying to provide the instructions for this but the system won't let me post them.
So I will try attaching them in a file.
Step by step, how to add this functionality to your extension.
You do not have the required permissions to view the files attached to this post.

rgjoyce
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Thu Jun 15, 2006 2:03 am
Location: Russia
Contact:

Re: Using the language filter facility

Post by rgjoyce » Sat Jun 24, 2017 10:52 am

additional notes. sorry, I missed a bit.
add
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL"
description="COM_CONTENT_FIELD_LANGUAGE_DESC"
>
<option value="*">JALL</option>
</field>
to the main fieldset in the article.xml form file in the models/forms folder.
This will give you the language selector field when editing an item.

rgjoyce
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Thu Jun 15, 2006 2:03 am
Location: Russia
Contact:

Re: Using the language filter facility

Post by rgjoyce » Sat Jun 24, 2017 1:03 pm

ok, so the filters are all there but not working.
I found why.
In the articles.php file, in the getListQuery function, near the end where the 'where' clauses are added, you need to add:

Code: Select all

		// Filter on the language.
		if ($language = $this->getState('filter.language'))
		{
			if($this->getState('filter.language') != '*')
				$query->where($db->quoteName('a.language') . ' = ' . $db->quote($language));
		}

the * character repesents the ALL value in the selector.

Now it's working like a dream

rgjoyce
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Thu Jun 15, 2006 2:03 am
Location: Russia
Contact:

Re: Using the language filter facility

Post by rgjoyce » Sat Jun 24, 2017 1:06 pm

So, here is the full working set of instructions on how to add this.
It would be great if someone could add this to the end of the hello world tutorial.
You do not have the required permissions to view the files attached to this post.


Locked

Return to “General Questions/New to Joomla! 2.5”