This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// PCategory.php | |
// namespace App\Web; | |
// use Page; | |
use SilverStripe\Forms\NumericField; | |
use SilverStripe\Forms\CheckboxField; | |
use SilverStripe\Forms\DropdownField; | |
use SilverStripe\Forms\GridField\GridField; | |
use SilverStripe\Forms\GridField\GridFieldConfig_RelationEditor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/bummzack/translatable-dataobject/issues/24 | |
Similar situation here. | |
Though not tested yet, I think i will use something like this (in a DataExtension for Page or SiteTree), so i won't have to write special functions for every DataObject and every page link. | |
Maybe this helps somebody. | |
<?php | |
public function LocalizedMaster($fallbackToDefault=false) { | |
$master = $this->owner->Master(); | |
$currLocale = Translatable::get_current_locale(); | |
if($master && $master->hasTranslation($currLocale)){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Отримати сслику на головну сторінку сайту | |
// для локалі по замовчанню отримуєм / , для всіх інших /locale-alias/ | |
public function getBaseURL($locale = null){ | |
if(empty($locale)) $locale = Fluent::current_locale(); | |
// Build domain-specific base url | |
$base = Director::baseURL(); | |
if($locale === Fluent::default_locale()) return $base; |