本文整理匯總了PHP中Pim\Bundle\CatalogBundle\Model\AttributeInterface::getLabel方法的典型用法代碼示例。如果您正苦於以下問題:PHP AttributeInterface::getLabel方法的具體用法?PHP AttributeInterface::getLabel怎麽用?PHP AttributeInterface::getLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pim\Bundle\CatalogBundle\Model\AttributeInterface
的用法示例。
在下文中一共展示了AttributeInterface::getLabel方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function it_provides_available_axis_as_a_sorted_choice($registry, AttributeRepositoryInterface $attRepository, AttributeInterface $attribute1, AttributeInterface $attribute2)
{
$attribute1->getId()->willReturn(1);
$attribute1->getLabel()->willReturn('Foo');
$attribute2->getId()->willReturn(2);
$attribute2->getLabel()->willReturn('Bar');
$registry->getRepository(self::ATTRIBUTE_CLASS)->willReturn($attRepository);
$attRepository->findAllAxis()->willReturn([$attribute1, $attribute2]);
$this->getAvailableAxisChoices()->shouldReturn([2 => 'Bar', 1 => 'Foo']);
}
示例2: prepareAttributeView
/**
* Prepare attribute view
*
* @param AttributeInterface $attribute
* @param ProductValueInterface $value
* @param FormView $view
*
* @return array
*/
protected function prepareAttributeView(AttributeInterface $attribute, ProductValueInterface $value, FormView $view)
{
$attributeView = ['id' => $attribute->getId(), 'isRemovable' => $value->isRemovable(), 'code' => $attribute->getCode(), 'label' => $attribute->getLabel(), 'sortOrder' => $attribute->getSortOrder(), 'allowValueCreation' => in_array($attribute->getAttributeType(), $this->choiceAttributeTypes), 'locale' => $value->getLocale()];
if ($attribute->isScopable()) {
$attributeView['values'] = array_merge($this->getAttributeValues($attribute, $value->getLocale()), [$value->getScope() => $view]);
ksort($attributeView['values']);
} else {
$attributeView['value'] = $view;
}
$classes = $this->getAttributeClasses($attribute);
if (!empty($classes)) {
$attributeView['classes'] = $classes;
}
return $attributeView;
}