1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Contents;
13
14 use ICanBoogie\I18n\FormattedString;
15
16 17 18
19 class HomeIncludeOperation extends \ICanBoogie\Operation
20 {
21 22 23
24 protected function get_controls()
25 {
26 return [
27
28 self::CONTROL_PERMISSION => Module::PERMISSION_MAINTAIN,
29 self::CONTROL_RECORD => true,
30 self::CONTROL_OWNERSHIP => true
31
32 ] + parent::get_controls();
33 }
34
35 protected function validate(\ICanBoogie\Errors $errors)
36 {
37 return true;
38 }
39
40 protected function process()
41 {
42 $record = $this->record;
43 $record->is_home_excluded = false;
44 $record->save();
45
46 $this->response->message = new FormattedString('%title is now included in the home page', [ '%title' => $record->title ]);
47
48 return true;
49 }
50 }