1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\ManageBlock;
13
14 use ICanBoogie\I18n;
15
16 use Brickrouge\Element;
17
18 19 20
21 class EditDecorator extends \Brickrouge\Decorator
22 {
23 private $record;
24
25 public function __construct($component, $record)
26 {
27 parent::__construct($component);
28
29 $this->record = $record;
30 }
31
32 public function render()
33 {
34 $component = parent::render();
35 $record = $this->record;
36 $model = $record->model;
37 $primary = $model->primary;
38
39 return new Element
40 (
41 'a', array
42 (
43 Element::INNER_HTML => \Brickrouge\escape($component),
44
45 'class' => 'edit',
46 'href' => \ICanBoogie\Routing\contextualize("/admin/{$model->id}/{$record->$primary}/edit"),
47 'title' => I18n\t('manage.edit')
48 )
49 );
50 }
51 }