/**
  * Determine filter type for specified attribute.
  *
  * @static
  * @param \Magento\Eav\Model\Entity\Attribute $attribute
  * @return string
  * @throws \Magento\Framework\Exception\LocalizedException
  */
 public static function getAttributeFilterType(\Magento\Eav\Model\Entity\Attribute $attribute)
 {
     if ($attribute->usesSource() || $attribute->getFilterOptions()) {
         return self::FILTER_TYPE_SELECT;
     } elseif ('datetime' == $attribute->getBackendType()) {
         return self::FILTER_TYPE_DATE;
     } elseif ('decimal' == $attribute->getBackendType() || 'int' == $attribute->getBackendType()) {
         return self::FILTER_TYPE_NUMBER;
     } elseif ('varchar' == $attribute->getBackendType() || 'text' == $attribute->getBackendType()) {
         return self::FILTER_TYPE_INPUT;
     } elseif ($attribute->isStatic()) {
         return self::getStaticAttributeFilterType($attribute);
     } else {
         throw new \Magento\Framework\Exception\LocalizedException(__('We can\'t determine the attribute filter type.'));
     }
 }