vendor/pimcore/pimcore/models/DataObject/ClassDefinition/Data/Country.php line 21

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Commercial License (PCL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  13.  */
  14. namespace Pimcore\Model\DataObject\ClassDefinition\Data;
  15. use Pimcore\Model;
  16. use Pimcore\Model\DataObject\ClassDefinition\DynamicOptionsProvider\CountryOptionsProvider;
  17. class Country extends Model\DataObject\ClassDefinition\Data\Select
  18. {
  19.     /**
  20.      * Static type of this element
  21.      *
  22.      * @internal
  23.      *
  24.      * @var string
  25.      */
  26.     public $fieldtype 'country';
  27.     /**
  28.      * @internal
  29.      *
  30.      * @var string|int
  31.      */
  32.     public $width 0;
  33.     /**
  34.      * Restrict selection to comma-separated list of countries.
  35.      *
  36.      * @internal
  37.      *
  38.      * @var string|null
  39.      */
  40.     public $restrictTo null;
  41.     /**
  42.      * {@inheritdoc}
  43.      */
  44.     public function isDiffChangeAllowed($object$params = [])
  45.     {
  46.         return true;
  47.     }
  48.     /**
  49.      * @return string|int
  50.      */
  51.     public function getWidth()
  52.     {
  53.         return $this->width;
  54.     }
  55.     /**
  56.      * @param string|int $width
  57.      *
  58.      * @return $this
  59.      */
  60.     public function setWidth($width)
  61.     {
  62.         if (is_numeric($width)) {
  63.             $width = (int)$width;
  64.         }
  65.         $this->width $width;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @param array|string|null $restrictTo
  70.      */
  71.     public function setRestrictTo($restrictTo)
  72.     {
  73.         /**
  74.          * @extjs6
  75.          */
  76.         if (is_array($restrictTo)) {
  77.             $restrictTo implode(','$restrictTo);
  78.         }
  79.         $this->restrictTo $restrictTo;
  80.     }
  81.     /**
  82.      * @return string|null
  83.      */
  84.     public function getRestrictTo()
  85.     {
  86.         return $this->restrictTo;
  87.     }
  88.     /**
  89.      * {@inheritdoc}
  90.      */
  91.     public function isFilterable(): bool
  92.     {
  93.         return true;
  94.     }
  95.     /**
  96.      * @return string
  97.      */
  98.     public function getOptionsProviderClass()
  99.     {
  100.         return '@' CountryOptionsProvider::class;
  101.     }
  102. }