1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GinoPane\BlogTaxonomy\Controllers; |
4
|
|
|
|
5
|
|
|
use BackendMenu; |
6
|
|
|
use Backend\Classes\Controller; |
7
|
|
|
use GinoPane\BlogTaxonomy\Models\Series as SeriesModel; |
8
|
|
|
use GinoPane\BlogTaxonomy\Plugin; |
9
|
|
|
use Backend\Behaviors\FormController; |
10
|
|
|
use Backend\Behaviors\ListController; |
11
|
|
|
use Backend\Behaviors\RelationController; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class Series |
15
|
|
|
* |
16
|
|
|
* @package GinoPane\BlogTaxonomy\Controllers |
17
|
|
|
*/ |
18
|
|
|
class Series extends Controller |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Behaviours implemented by the controller |
22
|
|
|
* |
23
|
|
|
* @var array |
24
|
|
|
*/ |
25
|
|
|
public $implement = [ |
26
|
|
|
FormController::class, |
27
|
|
|
ListController::class, |
28
|
|
|
RelationController::class |
29
|
|
|
]; |
30
|
|
|
|
31
|
|
|
public $formConfig = 'config_form.yaml'; |
32
|
|
|
public $listConfig = 'config_list.yaml'; |
33
|
|
|
public $relationConfig = 'config_relation.yaml'; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Series constructor |
37
|
|
|
*/ |
38
|
|
|
public function __construct() |
39
|
|
|
{ |
40
|
|
|
parent::__construct(); |
41
|
|
|
|
42
|
|
|
BackendMenu::setContext(Plugin::REQUIRED_PLUGIN_RAINLAB_BLOG, 'blog', 'series'); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Controller "update" action used for updating existing model records. |
47
|
|
|
* This action takes a record identifier (primary key of the model) |
48
|
|
|
* to locate the record used for sourcing the existing form values. |
49
|
|
|
* |
50
|
|
|
* @param int $recordId Record identifier |
|
|
|
|
51
|
|
|
* @param string $context Form context |
|
|
|
|
52
|
|
|
* @return void |
53
|
|
|
*/ |
54
|
|
View Code Duplication |
public function update($recordId = null, $context = null) |
|
|
|
|
55
|
|
|
{ |
56
|
|
|
$series = SeriesModel::whereId($recordId)->first(); |
57
|
|
|
|
58
|
|
|
if ($series !== null) { |
59
|
|
|
$this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.edit_title', ['series' => $series->title]); |
60
|
|
|
} else { |
61
|
|
|
$this->pageTitle = trans(Plugin::LOCALIZATION_KEY . 'form.series.series_does_not_exist'); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
return $this->asExtension('FormController')->update($recordId, $context); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.