本文整理匯總了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);
}