system/modules/pct_iconpicker/PCT/IconPicker/AttributeIconPicker.php line 39

Open in your IDE?
  1. <?php
  2. /**
  3.  * Contao Open Source CMS
  4.  * 
  5.  * Copyright (C) 2005-2013 Leo Feyer
  6.  * 
  7.  * @copyright    Tim Gatzky 2013, Premium Contao Webworks, Premium Contao Themes
  8.  * @author        Tim Gatzky <info@tim-gatzky.de>
  9.  * @package        pct_customelements
  10.  * @link        http://contao.org
  11.  */
  12. /**
  13.  * Namespace
  14.  */
  15. namespace PCT\IconPicker;
  16. /**
  17.  * Class file
  18.  * AttributeIconPicker
  19.  */
  20. class AttributeIconPicker extends \PCT\CustomElements\Core\Attribute
  21. {
  22.     /**
  23.      * Data Array
  24.      * @var array
  25.      */
  26.     protected $arrData = array();
  27.     
  28.     /**
  29.      * Create new instance
  30.      * @param array
  31.      */ 
  32.     public function __construct($arrData=array())
  33.     {
  34.         if(version_compare(PCT_CUSTOMELEMENTS_VERSION'2.0''>='))
  35.         {
  36.             return parent::__construct($arrData);
  37.         }
  38.         
  39.         if(count($arrData) > 0)
  40.         {
  41.             foreach($arrData as $strKey => $varValue)
  42.             {
  43.                 $this->arrData[$strKey] = \Contao\StringUtil::deserialize($varValue);
  44.             }
  45.         }
  46.     }    
  47.     
  48.     /**
  49.      * Return the field definition
  50.      * @return array
  51.      */
  52.     public function getFieldDefinition()
  53.     {
  54.         $arrEval $this->getEval();
  55.         
  56.         $arrReturn = array
  57.         (
  58.             'label'            => array( $this->get('title'),$this->get('description') ),
  59.             'exclude'        => true,
  60.             'inputType'        => 'text',
  61.             'eval'            => $arrEval,
  62.             'sql'            => "varchar(64) NOT NULL default ''"
  63.         );
  64.         
  65.         $options \Contao\StringUtil::deserialize$this->get('options') );
  66.         
  67.         if(empty($options) || !is_array($options))
  68.         {
  69.             return $arrReturn;
  70.         }
  71.         
  72.         if(in_array('iconpicker',$options))
  73.         {
  74.             $arrReturn['wizard'] = array
  75.             (
  76.                 'wizard' => array
  77.                 (
  78.                     'PCT\IconPicker\IconPicker''fontIconPicker'
  79.                 ),
  80.             );
  81.             
  82.             $arrReturn['eval']['tl_class'] .= ' wizard';
  83.         }
  84.         
  85.         return $arrReturn;
  86.     }
  87.     
  88. }