Switch Language
Permalink
Hi,
I'm trying to change the style and action for the Switch Language block but I'm not having much success. First, the default block (with select) does not work at all, the javascript does not even get executed. I then tried to change the view.php file and tried hard coding the $view->action('switch_language', $cID, '--language--') action and it does not return the correct ID. Is there a little more documentation somewhere about the Switch Language block, how it works and how to customize it?
I'm trying to change the style and action for the Switch Language block but I'm not having much success. First, the default block (with select) does not work at all, the javascript does not even get executed. I then tried to change the view.php file and tried hard coding the $view->action('switch_language', $cID, '--language--') action and it does not return the correct ID. Is there a little more documentation somewhere about the Switch Language block, how it works and how to customize it?
Well, I keep posting my progress in case it might help somebody else. Just figured that the view.js also has to be copied to the application/block/switch_language/ folder. Andrew's video about making a custom view wasn't clear about it ( to me anyway who is slow to understand the new 5.7 thinking ).
(cont.) I also modified the controller view function to add this:
$relatedID = Section::getRelatedCollectionIDForLocale( $currentcID, $otherLocale );
$this->set('otherLocale', $otherLocale);
$this->set('relatedID',$relatedID);
Therefore now in the view layer, I have access to the cID of the corresponding page in the other language.
$relatedID = Section::getRelatedCollectionIDForLocale( $currentcID, $otherLocale );
$this->set('otherLocale', $otherLocale);
$this->set('relatedID',$relatedID);
Therefore now in the view layer, I have access to the cID of the corresponding page in the other language.