20 use Magento\Eav\Model\Entity\Attribute\Source\BooleanFactory;
26 abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\Frontend\FrontendInterface
43 private $storeManager;
78 BooleanFactory $attrBooleanFactory,
80 $storeResolver =
null,
81 array $cacheTags =
null,
83 Serializer $serializer =
null 85 $this->_attrBooleanFactory = $attrBooleanFactory;
87 $this->cacheTags = $cacheTags ?: self::$defaultCacheTags;
161 if (in_array($this->
getConfigField(
'input'), [
'select',
'boolean'])) {
164 $opt = $this->_attrBooleanFactory->create();
169 $valueOption =
$option[
'label'];
206 $out[] =
'required-entry';
210 if ($inputRuleClass) {
211 $out[] = $inputRuleClass;
214 $textLengthValidateClasses = $this->getTextLengthValidateClasses();
215 if (!empty($textLengthValidateClasses)) {
216 $out = array_merge($out, $textLengthValidateClasses);
219 $out = !empty($out) ? implode(
' ', array_unique(array_filter($out))) :
'';
231 $validateRules = $this->
getAttribute()->getValidateRules();
232 if (!empty($validateRules[
'input_validation'])) {
233 switch ($validateRules[
'input_validation']) {
235 $class =
'validate-alphanum';
238 $class =
'validate-digits';
241 $class =
'validate-alpha';
244 $class =
'validate-email';
250 $class =
'validate-length';
265 private function getTextLengthValidateClasses()
270 $validateRules = $this->
getAttribute()->getValidateRules();
271 if (!empty($validateRules[
'min_text_length'])) {
272 $classes[] =
'minimum-length-' . $validateRules[
'min_text_length'];
274 if (!empty($validateRules[
'max_text_length'])) {
275 $classes[] =
'maximum-length-' . $validateRules[
'max_text_length'];
277 if (!empty($classes)) {
278 $classes[] =
'validate-length';
294 return $this->
getAttribute()->getData(
'frontend_' . $fieldName);
304 $cacheKey =
'attribute-navigation-option-' .
306 $this->storeManager->getStore()->getId();
307 $optionString = $this->cache->load($cacheKey);
308 if (
false === $optionString) {
311 $this->serializer->serialize(
$options),
316 $options = $this->serializer->unserialize($optionString);
344 return $this->
getAttribute()->getData(
'frontend_input_renderer');
elseif(isset( $params[ 'redirect_parent']))
getValue(\Magento\Framework\DataObject $object)
__construct(BooleanFactory $attrBooleanFactory, CacheInterface $cache=null, $storeResolver=null, array $cacheTags=null, StoreManagerInterface $storeManager=null, Serializer $serializer=null)
$_option $_optionId $class
getConfigField($fieldName)