Skip to content

[Backport] Added constants to unit codes to make it easier to reuse it if necessary #20505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions app/code/Magento/Directory/Model/Config/Source/WeightUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Directory\Model\Config\Source;

/**
Expand All @@ -14,10 +15,23 @@
class WeightUnit implements \Magento\Framework\Option\ArrayInterface
{
/**
* {@inheritdoc}
* @var string
*/
const CODE_LBS = 'lbs';

/**
* @var string
*/
const CODE_KGS = 'kgs';

/**
* @inheritdoc
*/
public function toOptionArray()
{
return [['value' => 'lbs', 'label' => __('lbs')], ['value' => 'kgs', 'label' => __('kgs')]];
return [
['value' => self::CODE_LBS, 'label' => __('lbs')],
['value' => self::CODE_KGS, 'label' => __('kgs')]
];
}
}