public function init() { parent::init(); if (!is_array($this->languages)) { throw new InvalidConfigException(Module::t('metaTag', 'MetaTagBehavior::languages have to be array.')); } if (empty($this->languages)) { throw new InvalidConfigException(Module::t('metaTag', 'MetaTagBehavior::languages have to contains at least 1 item.')); } }
/** * @return string */ public function getMetaTagContent() { $content = $this->content; $page = Yii::$app->request->get('page'); if ($this->metaTag->name == MetaTag::META_TITLE_NAME || $this->metaTag->name == MetaTag::META_DESCRIPTION_NAME && isset($page) && $page > 1) { if (!empty($content)) { $content = Module::t('metaTag', 'Page') . ' ' . $page . '. ' . $content; } } return $content; }
/** * @inheritdoc */ public function attributeLabels() { return ['id' => Module::t('metaTag', 'ID'), 'name' => Module::t('metaTag', 'Meta tag name'), 'is_http_equiv' => Module::t('metaTag', 'Is HTTP equiv'), 'default_value' => Module::t('metaTag', 'Default value'), 'description' => Module::t('metaTag', 'Description'), 'is_active' => Module::t('metaTag', 'Registered on page'), 'position' => Module::t('metaTag', 'Position')]; }
/** * @inheritdoc */ public function attributeLabels() { return ['model_name' => Module::t('metaTag', 'Model name'), 'model_id' => Module::t('metaTag', 'Model ID'), 'language' => Module::t('metaTag', 'Language'), 'meta_tag_id' => Module::t('metaTag', 'Meta tag'), 'content' => Module::t('metaTag', 'Meta tag content')]; }