Internationalization Add-on - Put "Switch Language Block" into theme

Permalink Browser Info Environment
hi

I installed the Internationalization Add-on and everything works fine.
But I would like to add the "Switch Language Block" into my theme, similar to the autonav block you can directly write into your theme's template files.
Is this possible?

Thanks,
poetze

Type: Discussion
Status: New
poetze
View Replies:
GregJoyce replied on at Permalink Reply
GregJoyce
Yes, this should be possible since it's just another kind of block, you could follow the instructions on this conversation, you would just do it for the switch language block.

http://www.concrete5.org/index.php?cID=11798...

In your case the block's name is 'switch_language' and anything that is mentioned in those calls to $bt->controller is going to be located in packages/blocks/controller.php

If you run up against anything just post back to the thread.


edit: Changed "would" to "should" up there since I haven't personally tested this.
MattWaters replied on at Permalink Reply
MattWaters
Here's a good how-to on hard coding blocks into page types:

http://www.concrete5.org/documentation/how-tos/developers/hardcode-...

You could put something like this in your page type:
<?php
    $switchBT = BlockType::getByHandle('switch_language');
    $switchBT->render('view');
?>


But you'd also need to call the block's javascript, maybe in the header.
poetze replied on at Permalink Reply
poetze
thanks for the help.
I got the block into my template, but it didn't seem to work right, so I tried the other solution from the "How to hardcode.." tutorial: to insert a line of code that embeds a block you created and saved in your scrapbook.
That worked fine.
okp replied on at Permalink Reply
okp
indeed, and for those whoo want to inclide the flags display, choose the appropriate template :

<?php
    $switchBT = BlockType::getByHandle('switch_language');
    $switchBT->render('templates/flags/view');
?>
MattWaters replied on at Permalink Reply
MattWaters
Thanks for adding that. We've had a few folks ask how to add the flags (which are usually enabled by selecting the custom template) but it's good to have an example of how to hard-code them as well.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.