本文整理汇总了PHP中Magento\Catalog\Helper\Data::shouldSaveUrlRewritesHistory方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::shouldSaveUrlRewritesHistory方法的具体用法?PHP Data::shouldSaveUrlRewritesHistory怎么用?PHP Data::shouldSaveUrlRewritesHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Helper\Data
的用法示例。
在下文中一共展示了Data::shouldSaveUrlRewritesHistory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getElementHtml
/**
* @return string
*/
public function getElementHtml()
{
/** @var \Magento\Framework\Data\Form\Element\AbstractElement $element */
$element = $this->getElement();
if (!$element->getValue()) {
return parent::getElementHtml();
}
$element->setOnkeyup("onUrlkeyChanged('" . $element->getHtmlId() . "')");
$element->setOnchange("onUrlkeyChanged('" . $element->getHtmlId() . "')");
$data = array('name' => $element->getData('name') . '_create_redirect', 'disabled' => true);
/** @var \Magento\Framework\Data\Form\Element\Hidden $hidden */
$hidden = $this->_elementFactory->create('hidden', array('data' => $data));
$hidden->setForm($element->getForm());
$storeId = $element->getForm()->getDataObject()->getStoreId();
$data['html_id'] = $element->getHtmlId() . '_create_redirect';
$data['label'] = __('Create Permanent Redirect for old URL');
$data['value'] = $element->getValue();
$data['checked'] = $this->_catalogData->shouldSaveUrlRewritesHistory($storeId);
/** @var \Magento\Framework\Data\Form\Element\Checkbox $checkbox */
$checkbox = $this->_elementFactory->create('checkbox', array('data' => $data));
$checkbox->setForm($element->getForm());
return parent::getElementHtml() . '<br/>' . $hidden->getElementHtml() . $checkbox->getElementHtml() . $checkbox->getLabelHtml();
}
示例2: testShouldSaveUrlRewritesHistory
/**
* @magentoConfigFixture current_store catalog/seo/save_rewrites_history 0
*/
public function testShouldSaveUrlRewritesHistory()
{
$this->assertFalse($this->helper->shouldSaveUrlRewritesHistory());
}
示例3: getShouldSaveRewritesHistory
/**
* Indicate whether to save URL Rewrite History or not (create redirects to old URLs)
*
* @param int $storeId Store View
* @return bool
*/
public function getShouldSaveRewritesHistory($storeId = null)
{
if ($this->_saveRewritesHistory !== null) {
return $this->_saveRewritesHistory;
}
return $this->_catalogData->shouldSaveUrlRewritesHistory($storeId);
}