Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Variables
swatch_attribute.php File Reference

Go to the source code of this file.

Variables

 $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
 
 $data
 
 $optionsPerAttribute = 3
 
 $data ['frontend_input'] = 'swatch_visual'
 
 $data ['swatch_input_type'] = 'visual'
 
 $data ['swatchvisual']['value']
 
 $data ['optionvisual']['value']
 
 $data ['options']['option']
 
 $options = []
 
foreach($data['options']['option'] as $optionData) $attribute
 

Variable Documentation

◆ $attribute

foreach ( $data[ 'options'][ 'option'] as $optionData) $attribute
Initial value:
= $objectManager->create(
\Magento\Catalog\Api\Data\ProductAttributeInterface::class,
['data' => $data]
)
$objectManager

Definition at line 67 of file swatch_attribute.php.

◆ $data [1/6]

$data
Initial value:
= [
'is_required' => 1,
'is_visible_on_front' => 1,
'is_visible_in_advanced_search' => 0,
'attribute_code' => 'color_swatch',
'backend_type' => '',
'is_searchable' => 0,
'is_filterable' => 0,
'is_filterable_in_search' => 0,
'frontend_label' => 'Attribute ',
'entity_type_id' => 4
]

Definition at line 11 of file swatch_attribute.php.

◆ $data [2/6]

$data[ 'frontend_input'] = 'swatch_visual'

Definition at line 25 of file swatch_attribute.php.

◆ $data [3/6]

$data[ 'swatch_input_type'] = 'visual'

Definition at line 26 of file swatch_attribute.php.

◆ $data [4/6]

$data[ 'swatchvisual'][ 'value']
Initial value:
= array_reduce(
function ($values, $index) use ($optionsPerAttribute) {
$values['option_' . $index] = '#'
. str_repeat(
dechex(255 * $index / $optionsPerAttribute),
3
);
return $values;
},
[]
)
$values
Definition: options.phtml:88
$optionsPerAttribute
$index
Definition: list.phtml:44

Definition at line 27 of file swatch_attribute.php.

◆ $data [5/6]

$data[ 'optionvisual'][ 'value']
Initial value:
= array_reduce(
function ($values, $index) use ($optionsPerAttribute) {
$values['option_' . $index] = ['option ' . $index];
return $values;
},
[]
)
$values
Definition: options.phtml:88
$optionsPerAttribute
$index
Definition: list.phtml:44

Definition at line 39 of file swatch_attribute.php.

◆ $data [6/6]

$data[ 'options'][ 'option']
Initial value:
= array_reduce(
function ($values, $index) use ($optionsPerAttribute) {
$values[] = [
'label' => 'option ' . $index,
'value' => 'option_' . $index,
];
return $values;
},
[]
)
$values
Definition: options.phtml:88
$optionsPerAttribute
$index
Definition: list.phtml:44

Definition at line 48 of file swatch_attribute.php.

◆ $objectManager

Definition at line 9 of file swatch_attribute.php.

◆ $options

$options = []

Definition at line 60 of file swatch_attribute.php.

◆ $optionsPerAttribute

$optionsPerAttribute = 3

Definition at line 23 of file swatch_attribute.php.