本文整理汇总了PHP中Magento\Catalog\Model\Category::formatUrlKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::formatUrlKey方法的具体用法?PHP Category::formatUrlKey怎么用?PHP Category::formatUrlKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Model\Category
的用法示例。
在下文中一共展示了Category::formatUrlKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFormatUrlKey
public function testFormatUrlKey()
{
$strIn = 'Some string';
$resultString = 'some';
$this->filterManager->expects($this->once())->method('translitUrl')->with($strIn)->will($this->returnValue($resultString));
$this->assertEquals($resultString, $this->category->formatUrlKey($strIn));
}
示例2: generateUrlKey
/**
* Generate category url key
*
* @param \Magento\Catalog\Model\Category $category
* @return string
*/
public function generateUrlKey($category)
{
$urlKey = $category->getUrlKey();
return $category->formatUrlKey($urlKey === '' || $urlKey === null ? $category->getName() : $urlKey);
}
示例3: generateCategoryUrlKeyPath
/**
* Generate category url key path
*
* @param \Magento\Catalog\Model\Category $category
* @return string
*/
public function generateCategoryUrlKeyPath($category)
{
$parentPath = $this->categoryHelper->getCategoryUrlPath('', true, $category->getStoreId());
$urlKey = $category->getUrlKey() == '' ? $category->formatUrlKey($category->getName()) : $category->formatUrlKey($category->getUrlKey());
return $parentPath . $urlKey;
}
示例4: testFormatUrlKey
public function testFormatUrlKey()
{
$this->assertEquals('test', $this->_model->formatUrlKey('test'));
$this->assertEquals('test-some-chars-5', $this->_model->formatUrlKey('test-some#-chars^5'));
$this->assertEquals('test', $this->_model->formatUrlKey('test-????????'));
}
示例5: formatUrlKey
/**
* {@inheritdoc}
*/
public function formatUrlKey($str)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'formatUrlKey');
if (!$pluginInfo) {
return parent::formatUrlKey($str);
} else {
return $this->___callPlugins('formatUrlKey', func_get_args(), $pluginInfo);
}
}