Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
Labels Class Reference
Inheritance diagram for Labels:
Section AbstractContainer

Public Member Functions

 setFieldsData (array $fields, SimpleElement $element=null)
 
 getFieldsData ($fields=null, SimpleElement $element=null)
 
- Public Member Functions inherited from Section
 getValidationErrors ()
 
 isSectionVisible ($sectionName)
 
- Public Member Functions inherited from AbstractContainer
 getFieldsData ($fields=null, SimpleElement $element=null)
 
 setFieldsData (array $fields, SimpleElement $contextElement=null)
 

Data Fields

const STORE_LABEL_NAME = '[name="store_labels[%s]"]'
 

Additional Inherited Members

- Protected Attributes inherited from Section
 $errorField = '//fieldset/*[contains(@class,"field ")][.//*[contains(@class,"error")]]'
 
 $errorLabel = './/*[contains(@class,"label")]'
 
 $errorText = './/label[contains(@class,"error")]'
 
 $section = '[data-index="%s"]'
 

Detailed Description

Backend sales rule label section.

Definition at line 14 of file Labels.php.

Member Function Documentation

◆ getFieldsData()

getFieldsData (   $fields = null,
SimpleElement  $element = null 
)

Get data of labels section.

Parameters
array | null$fields
SimpleElement | null$element
Returns
array

@SuppressWarnings(PHPMD.UnusedFormalParameter)

Definition at line 50 of file Labels.php.

51  {
52  $context = $element === null ? $this->_rootElement : $element;
53  $storeLabels = [];
54  $count = 0;
55  $field = $context->find(sprintf(self::STORE_LABEL_NAME, $count));
56  while ($field->isVisible()) {
57  $fieldValue = $field->getValue();
58  if ($fieldValue != '') {
59  $storeLabels[$count] = $fieldValue;
60  }
61  ++$count;
62  $field = $context->find(sprintf(self::STORE_LABEL_NAME, $count));
63  }
64 
65  return ['store_labels' => $storeLabels];
66  }
$count
Definition: recent.phtml:13
$element
Definition: element.phtml:12

◆ setFieldsData()

setFieldsData ( array  $fields,
SimpleElement  $element = null 
)

Fill data to labels fields on labels section.

Parameters
array$fields
SimpleElement | null$element
Returns
$this

Definition at line 28 of file Labels.php.

29  {
30  if (isset($fields['store_labels'])) {
31  $count = 0;
32  foreach ($fields['store_labels']['value'] as $storeLabel) {
33  $element->find(sprintf(self::STORE_LABEL_NAME, $count))->setValue($storeLabel);
34  ++$count;
35  }
36  }
37 
38  return $this;
39  }
$count
Definition: recent.phtml:13
$fields
Definition: details.phtml:14
$element
Definition: element.phtml:12

Field Documentation

◆ STORE_LABEL_NAME

const STORE_LABEL_NAME = '[name="store_labels[%s]"]'

Store label field name.

Definition at line 19 of file Labels.php.


The documentation for this class was generated from the following file: