Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • AdjustImage
  • AdjustThumbnail
  • EditBlock
  • GalleryBlock
  • GalleryController
  • Hooks
  • Image
  • ImageUpload
  • ManageBlock
  • Model
  • Module
  • NodeRelation
  • PopImage
  • PopOrUploadImage
  • SaveOperation
  • Thumbnail
  • ThumbnailDecorator
  • ThumbnailOperation
  • UploadImage
  • UploadOperation
 1 <?php
 2 
 3 /*
 4  * This file is part of the Icybee package.
 5  *
 6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
 7  *
 8  * For the full copyright and license information, please view the LICENSE
 9  * file that was distributed with this source code.
10  */
11 
12 namespace Icybee\Modules\Images;
13 
14 use Brickrouge\A;
15 use Brickrouge\Decorator;
16 
17 /**
18  * Decorates a component with a thumbnail.
19  */
20 class ThumbnailDecorator extends Decorator
21 {
22     /**
23      * The source of the thumbnail.
24      *
25      * @var Image
26      */
27     protected $record;
28 
29     /**
30      * The rendering options.
31      *
32      * @var array
33      */
34     protected $options = array
35     (
36         'version' => '$icon',
37         'no-lightbox' => false
38     );
39 
40     /**
41      * Initializes the {@link $record} and {@link $options} properties.
42      *
43      * @param mixed $component The component to decorate.
44      * @param Image $record The source of the thumbnail.
45      * @param array $options Options.
46      */
47     public function __construct($component, Image $record, array $options=array())
48     {
49         $this->record = $record;
50         $this->options = $options + $this->options;
51 
52         parent::__construct($component);
53     }
54 
55     public function render()
56     {
57         $record = $this->record;
58         $thumbnail = $record->thumbnail($this->options['version'])->to_element
59         (
60             array
61             (
62                 'data-popover-image' => $record->thumbnail('$popover')->url
63             )
64         );
65 
66         if (!$this->options['no-lightbox'])
67         {
68             $thumbnail = new A($thumbnail, $record->path, array('rel' => "lightbox[thumbnail-decorator]"));
69         }
70 
71         return $thumbnail . parent::render();
72     }
73 }
Autodoc API documentation generated by ApiGen 2.8.0