Skip to content

Commit

Permalink
Merge pull request #48 from ddinchev/master
Browse files Browse the repository at this point in the history
Made yii2-multilingual-behavior more extensible.
  • Loading branch information
OmgDef committed Feb 12, 2016
2 parents e33982b + 9e006b2 commit 93c1c3e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/MultilingualBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ class MultilingualBehavior extends Behavior
*/
public $langClassName;

/**
* @var string if $langClassName is not set, it will be assumed that $langClassName is
* get_class($this->owner) . $this->langClassSuffix
*/
public $langClassSuffix = 'Lang';

/**
* @var string the name of the foreign key field of the translation table related to base model table.
*/
Expand Down Expand Up @@ -87,7 +93,8 @@ class MultilingualBehavior extends Behavior
*/
public $abridge = true;

private $currentLanguage;
public $currentLanguage;

private $ownerClassName;
private $ownerPrimaryKey;
private $langClassShortName;
Expand Down Expand Up @@ -151,7 +158,7 @@ public function attach($owner)
}

if (!$this->langClassName) {
$this->langClassName = get_class($this->owner) . 'Lang';
$this->langClassName = get_class($this->owner) . $this->langClassSuffix;
}

$this->langClassShortName = $this->getShortClassName($this->langClassName);
Expand Down

0 comments on commit 93c1c3e

Please sign in to comment.