2021-03-11 10:16:57 +00:00
|
|
|
<?php namespace SureSoftware\PowerSEO\Components;
|
|
|
|
|
|
|
|
|
|
use Cms\Classes\ComponentBase;
|
|
|
|
|
use Event;
|
|
|
|
|
|
|
|
|
|
class BlogPost extends ComponentBase
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public $page;
|
|
|
|
|
public $seo_title;
|
|
|
|
|
public $seo_description;
|
|
|
|
|
public $seo_keywords;
|
|
|
|
|
public $canonical_url;
|
|
|
|
|
public $redirect_url;
|
|
|
|
|
public $robot_index;
|
|
|
|
|
public $robot_follow;
|
|
|
|
|
|
|
|
|
|
public function componentDetails()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'name' => 'suresoftware.powerseo::lang.component.blog.name',
|
|
|
|
|
'description' => 'suresoftware.powerseo::lang.component.blog.description'
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function defineProperties()
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
"post" => [
|
|
|
|
|
"title" => "data",
|
|
|
|
|
"default" => "post"
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
}
|
2021-11-01 12:34:49 +00:00
|
|
|
|
|
|
|
|
public function onRun(){
|
|
|
|
|
|
|
|
|
|
$post = $this->page->post;
|
|
|
|
|
//$post->title = 'test';
|
|
|
|
|
if($post){
|
|
|
|
|
$tags = $post->{'tags_'.$post->locale};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($tags and $tags->count()>0)
|
|
|
|
|
{
|
|
|
|
|
$this->page->tags = $tags->implode('name', ', ');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2021-03-11 10:16:57 +00:00
|
|
|
|
|
|
|
|
}
|