1 <?php
2
3 4 5 6 7 8 9 10
11
12 namespace Icybee\Modules\Images;
13
14 use Brickrouge\Element;
15
16 class AdjustImage extends \Brickrouge\Widget\AdjustNode
17 {
18 static protected function add_assets(\Brickrouge\Document $document)
19 {
20 parent::add_assets($document);
21
22 $document->css->add(DIR . 'public/module.css');
23 $document->js->add(DIR . 'public/module.js');
24 }
25
26 public function __construct(array $attributes=array())
27 {
28 parent::__construct
29 (
30 $attributes + array
31 (
32 self::T_CONSTRUCTOR => 'images',
33 self::WIDGET_CONSTRUCTOR => 'AdjustImage',
34
35 'data-adjust' => 'adjust-image'
36 )
37 );
38 }
39
40 41 42
43 protected function alter_class_names(array $class_names)
44 {
45 return parent::alter_class_names($class_names) + array
46 (
47 'widget-adjust-image' => true
48 );
49 }
50
51 52 53
54 protected function get_records($constructor, array $options, $limit=16)
55 {
56 return parent::get_records($constructor, $options, $limit);
57 }
58
59 protected function render_record(\Icybee\Modules\Nodes\Node $record, $selected, array $range, array $options)
60 {
61 $nid = $record->nid;
62
63 return $record->thumbnail('$icon-m')->to_element
64 (
65 array
66 (
67 'alt' => $record->alt,
68 'title' => $record->title,
69
70 'data-nid' => $nid,
71 'data-popover-image' => $record->thumbnail('$popover')->url,
72 'data-popover-target' => '.widget-adjust-image',
73 'data-title' => $record->title,
74 'data-path' => $record->path
75 )
76 );
77 }
78
79 80 81
82 public function get_results(array $options=array(), $constructor='images')
83 {
84 return parent::get_results($options, $constructor);
85 }
86 }
87
88 namespace Brickrouge\Widget;
89
90 class AdjustImage extends \Icybee\Modules\Images\AdjustImage
91 {
92
93 }