本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::getLabelHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::getLabelHtml方法的具体用法?PHP Varien_Data_Form_Element_Abstract::getLabelHtml怎么用?PHP Varien_Data_Form_Element_Abstract::getLabelHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Abstract
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Abstract::getLabelHtml方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
$html = '<tr>' . "\n";
$countryId = false;
if ($country = $element->getForm()->getElement('country_id')) {
$countryId = $country->getValue();
}
$regionCollection = false;
if ($countryId) {
if (!isset(self::$_regionCollections[$countryId])) {
self::$_regionCollections[$countryId] = Mage::getModel('directory/country')->setId($countryId)->getLoadedRegionCollection();
}
$regionCollection = self::$_regionCollections[$countryId];
}
$regionId = $element->getForm()->getElement('region_id')->getValue();
if ($regionCollection && $regionCollection->getSize()) {
$elementClass = $element->getClass();
$element->setClass(str_replace('input-text', '', $elementClass));
$html .= '<td class="label">' . $element->getLabelHtml() . '</td>';
$html .= '<td class="value"><select id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" ' . $element->serialize($element->getHtmlAttributes()) . '>' . "\n";
foreach ($regionCollection as $region) {
$selected = $regionId == $region->getId() ? ' selected' : '';
$html .= '<option value="' . $region->getId() . '"' . $selected . '>' . $region->getName() . '</option>';
}
$html .= '</select></td>';
$element->setClass($elementClass);
} else {
$element->setClass('input-text');
$html .= '<td class="label"><label for="' . $element->getHtmlId() . '">' . $element->getLabel() . ' <span class="required" style="display:none">*</span></label></td>';
$element->setRequired(false);
$html .= '<td class="value"><input id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" value="' . $element->getEscapedValue() . '"' . $element->serialize($element->getHtmlAttributes()) . '/></td>' . "\n";
}
$html .= '</tr>' . "\n";
return $html;
}
示例2: render
/**
* Output the region element and javasctipt that makes it dependent from country element
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$country = $element->getForm()->getElement('country_id');
if (!is_null($country)) {
$countryId = $country->getValue();
} else {
return $element->getDefaultHtml();
}
$regionId = $element->getForm()->getElement('region_id')->getValue();
$quoteStoreId = $element->getEntityAttribute()->getStoreId();
$html = '<tr>';
$element->setClass('input-text');
$element->setRequired(true);
$html .= '<td class="label">' . $element->getLabelHtml() . '</td><td class="value">';
$html .= $element->getElementHtml();
$selectName = str_replace('region', 'region_id', $element->getName());
$selectId = $element->getHtmlId() . '_id';
$html .= '<select id="' . $selectId . '" name="' . $selectName . '" class="select required-entry" style="display:none">';
$html .= '<option value="">' . $this->_factory->getHelper('customer')->__('Please select') . '</option>';
$html .= '</select>';
$html .= '<script type="text/javascript">' . "\n";
$html .= '$("' . $selectId . '").setAttribute("defaultValue", "' . $regionId . '");' . "\n";
$html .= 'new regionUpdater("' . $country->getHtmlId() . '", "' . $element->getHtmlId() . '", "' . $selectId . '", ' . $this->helper('directory')->getRegionJsonByStore($quoteStoreId) . ');' . "\n";
$html .= '</script>' . "\n";
$html .= '</td></tr>' . "\n";
return $html;
}
示例3: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
if ($country = $element->getForm()->getElement('country_id')) {
$countryId = $country->getValue();
} else {
return $element->getDefaultHtml();
}
$regionId = $element->getForm()->getElement('region_id')->getValue();
$html = '<tr>';
$element->setClass('input-text');
$html .= '<td class="label">' . $element->getLabelHtml() . '</td><td class="value">';
$html .= $element->getElementHtml();
$selectName = str_replace('region', 'region_id', $element->getName());
$selectId = $element->getHtmlId() . '_id';
$html .= '<select id="' . $selectId . '" name="' . $selectName . '" class="select required-entry" style="display:none">';
$html .= '<option value="">' . AO::helper('customer')->__('Please select') . '</option>';
$html .= '</select>';
$html .= '<script type="text/javascript">
if ($("' . $country->getHtmlId() . '") != undefined) {
new regionUpdater("' . $country->getHtmlId() . '", "' . $element->getHtmlId() . '", "' . $selectId . '", ' . $this->helper('directory')->getRegionJson() . ');
}
</script>';
$html .= '</td></tr>' . "\n";
return $html;
}
示例4: render
/**
* Render block
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$html = '<tr id="' . $element->getHtmlId() . '_container">';
$html .= '<td class="label">' . $element->getLabelHtml() . '</td>';
$html .= '<td class="value">' . $element->getElementHtml() . ' ' . $this->_getScriptHtml($element) . '</td>';
$html .= '</tr>' . "\n";
$html .= '<tr>';
return $html;
}
示例5: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
$html = '<tr>' . "\n";
$countryId = false;
if ($country = $element->getForm()->getElement('country_id')) {
$countryId = $country->getValue();
}
$regionCollection = false;
if ($countryId) {
if (!isset(self::$_regionCollections[$countryId])) {
self::$_regionCollections[$countryId] = Mage::getModel('directory/country')->setId($countryId)->getLoadedRegionCollection()->toOptionArray();
}
$regionCollection = self::$_regionCollections[$countryId];
}
$regionId = intval($element->getForm()->getElement('region_id')->getValue());
$htmlAttributes = $element->getHtmlAttributes();
foreach ($htmlAttributes as $key => $attribute) {
if ('type' === $attribute) {
unset($htmlAttributes[$key]);
break;
}
}
// Output two elements - for 'region' and for 'region_id'.
// Two elements are needed later upon form post - to properly set data to address model,
// otherwise old value can be left in region_id attribute and saved to DB.
// Depending on country selected either 'region' (input text) or 'region_id' (selectbox) is visible to user
$regionHtmlName = $element->getName();
$regionIdHtmlName = str_replace('region', 'region_id', $regionHtmlName);
$regionHtmlId = $element->getHtmlId();
$regionIdHtmlId = str_replace('region', 'region_id', $regionHtmlId);
if ($regionCollection && count($regionCollection) > 0) {
$elementClass = $element->getClass();
$html .= '<td class="label">' . $element->getLabelHtml() . '</td>';
$html .= '<td class="value">';
$html .= '<select id="' . $regionIdHtmlId . '" name="' . $regionIdHtmlName . '" ' . $element->serialize($htmlAttributes) . '>' . "\n";
foreach ($regionCollection as $region) {
$selected = $regionId == $region['value'] ? ' selected="selected"' : '';
$value = is_numeric($region['value']) ? (int) $region['value'] : "";
$html .= '<option value="' . $value . '"' . $selected . '>' . Mage::helper('adminhtml')->escapeHtml(Mage::helper('directory')->__($region['label'])) . '</option>';
}
$html .= '</select>' . "\n";
$html .= '<input type="hidden" name="' . $regionHtmlName . '" id="' . $regionHtmlId . '" value=""/>';
$html .= '</td>';
$element->setClass($elementClass);
} else {
$element->setClass('input-text');
$html .= '<td class="label"><label for="' . $element->getHtmlId() . '">' . $element->getLabel() . ' <span class="required" style="display:none">*</span></label></td>';
$element->setRequired(false);
$html .= '<td class="value">';
$html .= '<input id="' . $regionHtmlId . '" name="' . $regionHtmlName . '" value="' . $element->getEscapedValue() . '" ' . $element->serialize($htmlAttributes) . "/>" . "\n";
$html .= '<input type="hidden" name="' . $regionIdHtmlName . '" id="' . $regionIdHtmlId . '" value=""/>';
$html .= '</td>' . "\n";
}
$html .= '</tr>' . "\n";
return $html;
}
示例6: render
/**
* renderer
*
* @param Varien_Data_Form_Element_Abstract $element
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$element->setDisabled(true);
$disabled = true;
$htmlId = 'use_config_' . $element->getHtmlId();
$html = '<tr><td class="label">' . $element->getLabelHtml() . '</td><td class="value">';
$html .= '<input id="' . $htmlId . '" name="use_c[]" value="' . $element->getId() . '"' . ($disabled ? ' checked="checked"' : '');
$html .= ' onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox" />';
$html .= ' <label for="' . $htmlId . '" class="normal">' . Mage::helper('turnkeye_adminform')->__('Do not change value') . '</label>';
$html .= $element->getElementHtml();
$html .= '<script type="text/javascript">toggleValueElements($(\'' . $htmlId . '\'), $(\'' . $htmlId . '\').parentNode);</script>';
return $html . '</td><td class="scope - label"><span class="nobr"></span></td></tr>';
}
示例7: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
$this->_iTimeFrom = (int) Mage::getStoreConfig('checkout/adjdeliverydate/time_enable_from');
$this->_iTimeTo = (int) Mage::getStoreConfig('checkout/adjdeliverydate/time_enable_to');
if ($this->_iTimeTo and $this->_iTimeTo >= $this->_iTimeFrom) {
if ($this->_iTimeFrom < 0 or $this->_iTimeFrom > 24) {
$this->_iTimeFrom = 0;
}
if ($this->_iTimeTo > 24) {
$this->_iTimeTo = 24;
}
} else {
return false;
}
return $element->getLabelHtml() . '<br />' . $this->_getElementHtml($element);
}
示例8: render
/**
* Render block
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$html = '<tr>';
$html .= '<td class="label">' . $element->getLabelHtml() . '</td>';
$html .= '<td class="value">' . $element->getElementHtml() . '</td>';
$html .= '</tr>' . "\n";
$html .= '<tr>';
$html .= '<td class="label"><label> </label></td>';
$html .= '<td class="value">' . Mage::helper('customer')->__('or') . '</td>';
$html .= '</tr>' . "\n";
$html .= '<tr>';
$html .= '<td class="label"><label> </label></td>';
$html .= '<td class="value"><input type="checkbox" id="account-send-pass" name="' . $element->getName() . '" value="auto" onclick="setElementDisable(\'' . $element->getHtmlId() . '\', this.checked)"/> ';
$html .= '<label for="account-send-pass">' . Mage::helper('customer')->__('Send Auto-Generated Password') . '</label></td>';
$html .= '</tr>' . "\n";
return $html;
}
示例9: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
if ($element->hasData('emt_temp_editor') && $element->hasData('emt_temp_text')) {
$editorElement = $element->getData('emt_temp_editor');
$textElement = $element->getData('emt_temp_text');
$virtualElement = new Varien_Object();
$attributes = array('note', 'fieldset_html_class', 'no_display', 'type', 'value_class', 'html_id', 'required');
foreach ($attributes as $attribute) {
if ($element->hasData($attribute)) {
$virtualElement->setData($attribute, $element->getData($attribute));
}
}
$textElement->setValue($element->getValue())->getHtml();
$editorElement->setTextInputHtml($textElement->getElementHtml());
$virtualElement->addData(array('id' => $element->getId(), 'label_html' => $element->getLabelHtml(), 'html_container_id' => $element->getHtmlContainerId(), 'element_html' => $editorElement->getHtml()));
$this->_element = $virtualElement;
return $this->toHtml();
}
return parent::render($element);
}
示例10: getLabelHtml
public function getLabelHtml($suffix = 0)
{
return parent::getLabelHtml($suffix);
}
示例11: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
return $element->getLabelHtml() . '<br />' . $element->getElementHtml();
}