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\Element;
15 
16 class PopImage extends \Icybee\Modules\Nodes\PopNode
17 {
18     const THUMBNAIL_VERSION = '#popimage-thumbnail-version';
19 
20     static protected function add_assets(\Brickrouge\Document $document)
21     {
22         parent::add_assets($document);
23 
24         $document->js->add(DIR . 'public/module.js');
25         $document->css->add(DIR . 'public/module.css');
26     }
27 
28     public function __construct($attributes=array())
29     {
30         parent::__construct
31         (
32             $attributes + array
33             (
34                 self::T_CONSTRUCTOR => 'images',
35                 self::THUMBNAIL_VERSION => '$popimage',
36 
37                 'placeholder' => 'Sélectionner une image',
38 
39                 'data-adjust' => 'adjust-image'
40             )
41         );
42     }
43 
44     protected function alter_dataset(array $dataset)
45     {
46         return parent::alter_dataset
47         (
48             $dataset + array
49             (
50                 'widget-constructor' => 'PopImage',
51                 'thumbnail-version' => $this[self::THUMBNAIL_VERSION]
52             )
53         );
54     }
55 
56     protected function getEntry($model, $value)
57     {
58         return $model->where('path = ? OR title = ? OR slug = ?', $value, $value, $value)->order('created_at DESC')->one;
59     }
60 
61     protected function getPreview($record)
62     {
63         if (!$record)
64         {
65             return new Element('img');
66         }
67 
68         return $record->thumbnail($this[self::THUMBNAIL_VERSION])->to_element(array(
69 
70             'data-nid' => $record->nid,
71             'data-path' => $record->url('get')
72 
73         ));
74     }
75 }
Autodoc API documentation generated by ApiGen 2.8.0