PluginSeoTrait::addPluginSeo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 14
c 2
b 1
f 0
nc 1
nop 0
dl 0
loc 21
rs 9.7998
1
<?php
2
3
namespace Larrock\Core\Plugins;
4
5
use Larrock\Core\Helpers\FormBuilder\FormInput;
6
use Larrock\Core\Helpers\FormBuilder\FormTextarea;
7
8
trait PluginSeoTrait
9
{
10
    /**
11
     * Подключение плагина SEO.
12
     * @return $this
13
     */
14
    public function addPluginSeo()
15
    {
16
        $row = new FormInput('seo_title', 'Title материала');
17
        $this->rows['seo_title'] = $rows_plugin[] = $row->setTab('seo', 'Seo')->setValid('max:255')
0 ignored issues
show
Comprehensibility Best Practice introduced by
$rows_plugin was never initialized. Although not strictly required by PHP, it is generally a good practice to add $rows_plugin = array(); before regardless.
Loading history...
Bug Best Practice introduced by
The property rows does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
18
            ->setTypo()->setHelp('По-умолчанию равно заголовку материала');
19
20
        $row = new FormInput('seo_description', 'Description материала');
21
        $this->rows['seo_description'] = $rows_plugin[] = $row->setTab('seo', 'Seo')->setValid('max:255')
22
            ->setTypo()->setHelp('По-умолчанию равно заголовку материала');
23
24
        $row = new FormTextarea('seo_keywords', 'Keywords материала');
25
        $this->rows['seo_keywords'] = $rows_plugin[] = $row->setTab('seo', 'Seo')->setValid('max:255')
26
            ->setCssClass('not-editor uk-width-1-1');
27
28
        $this->plugins_backend['seo']['rows'] = $rows_plugin;
0 ignored issues
show
Bug Best Practice introduced by
The property plugins_backend does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
29
30
        $row = new FormInput('url', 'URL материала');
31
        $this->rows['url'] = $row->setTab('seo', 'SEO')
32
            ->setValid('max:155|required|unique:'.$this->table)->setCssClass('uk-width-1-1')->setFillable();
33
34
        return $this;
35
    }
36
}
37