title: Magento 2 category attribute select
body: <p>i tried to create custom category attribute with custom source class, but select input has no options. I dont know why, i am missing something. I checked and attribute exists in database. Thank you for help.</p>
  
  <p>UpgradeData.php</p>
  
  <pre><code>if (version_compare($context-&gt;getVersion(), '0.1.3') &lt; 0) {
          $categorySetup = $this-&gt;eavSetupFactory-&gt;create(['setup' =&gt; $setup]);
          $categorySetup-&gt;addAttribute(Category::ENTITY, 'category_heroslider', [
              'type' =&gt; 'int',
              'label' =&gt; 'Category Hero Slider',
              'input' =&gt; 'select',
              'source' =&gt; xxx\xxx\Model\Entity\Attribute\Source\HeroSlider::class,
              'required' =&gt; false,
              'sort_order' =&gt; 100,
              'global' =&gt; ScopedAttributeInterface::SCOPE_STORE,
              'group' =&gt; 'General Information',
              'user_defined' =&gt; true,
              'visible' =&gt; true,
          ]);
      }
  </code></pre>
  
  <p>source class</p>
  
  <pre><code>namespace xxx\xxx\Model\Entity\Attribute\Source;
  
  use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource;
  
  class xxx extends AbstractSource
  {
      /**
       * @var \xxx\xxx\Model\ResourceModel\Slider\CollectionFactory
       */
      private $slidersCollection;
  
      /**
       * HeroSlider constructor.
       * @param \xxx\xxxx\Model\ResourceModel\Slider\CollectionFactory $slidersCollection
       */
      public function __construct(\xxx\xxx\Model\ResourceModel\Slider\CollectionFactory $slidersCollection)
      {
          $this-&gt;slidersCollection = $slidersCollection;
      }
  
      public function getAllOptions()
      {
          $this-&gt;_options = [
              ['label' =&gt; __('Yes'), 'value' =&gt; 1],
              ['label' =&gt; __('asd'), 'value' =&gt; 2],
          ];
  
          return $this-&gt;_options;
      }
  
      public function toOptionArray()
      {
          return [1 =&gt; 'test'];
      }
  
  
  }
  </code></pre>
  
  <p>category_form.xml</p>
  
  <pre><code>&lt;form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"&gt;
  &lt;fieldset name="general"&gt;
      &lt;field name="category_heroslider"&gt;
          &lt;argument name="data" xsi:type="array"&gt;
              &lt;item name="options" xsi:type="object"&gt;xxx\xxx\Model\Entity\Attribute\Source\HeroSlider&lt;/item&gt;
              &lt;item name="config" xsi:type="array"&gt;
                  &lt;item name="sortOrder" xsi:type="number"&gt;100&lt;/item&gt;
                  &lt;item name="dataType" xsi:type="string"&gt;int&lt;/item&gt;
                  &lt;item name="formElement" xsi:type="string"&gt;select&lt;/item&gt;
                  &lt;item name="label" xsi:type="string" translate="true"&gt;Category Hero Slider&lt;/item&gt;
              &lt;/item&gt;
          &lt;/argument&gt;
      &lt;/field&gt;
  &lt;/fieldset&gt;
  </code></pre>
  
  <p></p>