14 class Field extends \Magento\Config\Model\Config\Structure\AbstractElement
74 $this->_backendFactory = $backendFactory;
76 $this->_commentFactory = $commentFactory;
77 $this->_blockFactory = $blockFactory;
78 $this->_dependencyMapper = $dependencyMapper;
91 $label .= $this->_translateLabel($labelPrefix) .
' ';
93 $label .= parent::getLabel();
116 if (isset($this->_data[
'comment'])) {
117 if (is_array($this->_data[
'comment'])) {
118 if (isset($this->_data[
'comment'][
'model'])) {
119 $model = $this->_commentFactory->create($this->_data[
'comment'][
'model']);
120 $comment =
$model->getCommentText($currentValue);
123 $comment = parent::getComment();
136 if (isset($this->_data[
'tooltip'])) {
138 }
elseif (isset($this->_data[
'tooltip_block'])) {
139 return $this->_blockFactory->createBlock($this->_data[
'tooltip_block'])->toHtml();
151 return isset($this->_data[
'type']) ? $this->_data[
'type'] :
'text';
164 if (isset($this->_data[
'requires'][$elementType])) {
165 if (isset($this->_data[
'requires'][$elementType][
'id'])) {
166 $elements[] = $this->
_getPath($this->_data[
'requires'][$elementType][
'id'], $fieldPrefix);
168 foreach ($this->_data[
'requires'][$elementType] as
$element) {
169 $elements[] = $this->
_getPath($element[
'id'], $fieldPrefix);
205 return isset($this->_data[
'frontend_class']) ? $this->_data[
'frontend_class'] :
'';
215 return array_key_exists(
'backend_model', $this->_data) && $this->_data[
'backend_model'];
225 return $this->_backendFactory->create($this->_data[
'backend_model']);
236 return current($parts);
256 return isset($this->_data[
'config_path']) ? $this->_data[
'config_path'] :
null;
266 return isset($this->_data[
'showInDefault']) && (int)$this->_data[
'showInDefault'];
276 return isset($this->_data[
'showInWebsite']) && (int)$this->_data[
'showInWebsite'];
286 return isset($this->_data[
'showInStore']) && (int)$this->_data[
'showInStore'];
297 return isset($this->_data[
'canRestore']) && (int)$this->_data[
'canRestore'];
309 foreach ($this->_data as $key =>
$value) {
311 $originalData[$key] =
$value;
314 $formField->setOriginalData($originalData);
324 return isset($this->_data[
'validate']);
334 return isset($this->_data[
'validate']) ? $this->_data[
'validate'] :
null;
344 return isset($this->_data[
'can_be_empty']);
354 return isset($this->_data[
'source_model']);
364 return isset($this->_data[
'source_model']) || isset($this->_data[
'options']);
374 if (isset($this->_data[
'source_model'])) {
375 $sourceModel = $this->_data[
'source_model'];
378 }
elseif (isset($this->_data[
'options']) && isset($this->_data[
'options'][
'option'])) {
379 $options = $this->_data[
'options'][
'option'];
394 foreach (array_keys(
$options) as $key) {
396 $options[$key][
'value'] = $this->_fillInConstantPlaceholders(
$options[$key][
'value']);
407 private function _translateLabel(
$label)
418 private function _fillInConstantPlaceholders(
$value)
420 if (is_string(
$value) && preg_match(
'/^{{(\\\\[A-Z][\\\\A-Za-z\d_]+::[A-Z\d_]+)}}$/',
$value, $matches)) {
421 $value = constant($matches[1]);
435 if (preg_match(
'/^([^:]+?)::([^:]+?)$/', $sourceModel, $matches)) {
436 array_shift($matches);
437 list($sourceModel,
$method) = array_values($matches);
440 $sourceModel = $this->_sourceFactory->create($sourceModel);
442 $sourceModel->setPath($this->
getPath());
445 if ($this->
getType() ==
'multiselect') {
446 $optionArray = $sourceModel->{
$method}();
453 $optionArray[] = [
'label' =>
$value,
'value' => $key];
458 $optionArray = $sourceModel->toOptionArray($this->getType() ==
'multiselect');
473 if (
false == isset($this->_data[
'depends'][
'fields'])) {
474 return $dependencies;
476 $dependencies = $this->_dependencyMapper->getDependencies(
477 $this->_data[
'depends'][
'fields'],
481 return $dependencies;
491 return isset($this->_data[
'advanced']) && $this->_data[
'advanced'];
elseif(isset( $params[ 'redirect_parent']))
getRequiredFields($fieldPrefix='')
getComment($currentValue='')
_getOptionsFromSourceModel($sourceModel)
getLabel($labelPrefix='')
populateInput($formField)
__construct(\Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Module\Manager $moduleManager, \Magento\Config\Model\Config\BackendFactory $backendFactory, \Magento\Config\Model\Config\SourceFactory $sourceFactory, \Magento\Config\Model\Config\CommentFactory $commentFactory, \Magento\Framework\View\Element\BlockFactory $blockFactory, \Magento\Config\Model\Config\Structure\Element\Dependency\Mapper $dependencyMapper)
_getStaticOptions(array $options)
getRequiredGroups($fieldPrefix='')
_getTranslatedAttribute($code)
const DEFAULT_INCLUDE_EMPTY_VALUE_OPTION
_getPath($fieldId, $fieldPrefix='')
_getRequiredElements($fieldPrefix='', $elementType='group')
getDependencies($fieldPrefix, $storeCode)