Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Weight Class Reference
Inheritance diagram for Weight:
OptionSourceInterface

Public Member Functions

 getOptions ()
 
 getValues ()
 
 toOptionArray ()
 

Protected Attributes

 $weights = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
 

Detailed Description

Attribute weight options @api

Since
100.0.2

Definition at line 13 of file Weight.php.

Member Function Documentation

◆ getOptions()

getOptions ( )

Retrieve search weights as options array

Returns
array

Definition at line 28 of file Weight.php.

29  {
30  $res = [];
31  foreach ($this->getValues() as $value) {
32  $res[] = ['value' => $value, 'label' => $value];
33  }
34  return $res;
35  }
$value
Definition: gender.phtml:16

◆ getValues()

getValues ( )

Retrieve search weights array

Returns
int[]

Definition at line 42 of file Weight.php.

◆ toOptionArray()

toOptionArray ( )

Return array of options as value-label pairs

Returns
array Format: array(array('value' => '

', 'label' => '<label>'), ...)

Since
100.1.0

Implements OptionSourceInterface.

Definition at line 53 of file Weight.php.

54  {
55  return $this->getOptions();
56  }

Field Documentation

◆ $weights

$weights = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
protected

Definition at line 21 of file Weight.php.


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