vendor/isotope/isotope-core/system/modules/isotope/library/Isotope/Model/Attribute/TextField.php line 28

Open in your IDE?
  1. <?php
  2. /*
  3.  * Isotope eCommerce for Contao Open Source CMS
  4.  *
  5.  * Copyright (C) 2009 - 2019 terminal42 gmbh & Isotope eCommerce Workgroup
  6.  *
  7.  * @link       https://isotopeecommerce.org
  8.  * @license    https://opensource.org/licenses/lgpl-3.0.html
  9.  */
  10. namespace Isotope\Model\Attribute;
  11. use Isotope\Interfaces\IsotopeAttributeWithRange;
  12. use Isotope\Interfaces\IsotopeProduct;
  13. use Isotope\Model\Attribute;
  14. /**
  15.  * Attribute to implement TextField widget
  16.  */
  17. class TextField extends Attribute implements IsotopeAttributeWithRange
  18. {
  19.     /**
  20.      * @inheritdoc
  21.      */
  22.     public function saveToDCA(array &$arrData)
  23.     {
  24.         parent::saveToDCA($arrData);
  25.         $maxlength = (int) $this->maxlength ?: 255;
  26.         $arrData['fields'][$this->field_name]['sql'] = "varchar($maxlength) NOT NULL default ''";
  27.     }
  28.     /**
  29.      * {@inheritdoc}
  30.      */
  31.     public function allowRangeFilter()
  32.     {
  33.         return 'digit' === $this->rgxp;
  34.     }
  35.     /**
  36.      * {@inheritdoc}
  37.      */
  38.     public function getValueRange(IsotopeProduct $product)
  39.     {
  40.         return [$this->getValue($product)];
  41.     }
  42. }