本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::getFieldConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::getFieldConfig方法的具体用法?PHP Varien_Data_Form_Element_Abstract::getFieldConfig怎么用?PHP Varien_Data_Form_Element_Abstract::getFieldConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Abstract
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Abstract::getFieldConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getElementHtml
/**
* Pass data from config.xml describe section to _data array
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$block = $this->getLayout()->createBlock('xcom_xfabric/adminhtml_system_config_form_fieldset_element_button');
if (isset($element->getFieldConfig()->config)) {
// Pass all nodes from <config> to block configuration
foreach ($element->getFieldConfig()->config->children() as $key => $value) {
if ($key == 'redirect') {
$key = 'onclick';
$value = 'window.location.href=\'' . $this->getUrl('*/' . $value) . '\'';
}
$block->setData($key, $value);
}
}
return $block->toHtml();
}
示例2: render
/**
* Renders element
*
* @param Varien_Data_Form_Element_Abstract $element Element to render
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$logoSrc = $this->getSkinUrl('monitoring/images/firegento.jpg');
$html = '
<tr id="row_%s">
<td colspan="2">
<div class="box">
<p>
<a href="' . self::URL . '" target="_blank" title="' . $this->__('Go to Firegento Website') . '">
<img src="' . $logoSrc . '" alt="' . $this->__('Firegento') . '" />
</a>
</p>
<p>%s</p>
<ul>%s</ul>
</div>
</td>
</tr>
';
$linksHtml = '';
/** @var $links Mage_Core_Model_Config_Element */
$links = $element->getFieldConfig()->links;
if ($links) {
foreach ($links->children() as $_link) {
$_linkLabel = $this->__((string) $_link->label);
$linksHtml .= sprintf('<li><a href="%s" target="_blank">%s</a>', $_link->url, $_linkLabel) . '</li>';
}
}
return sprintf($html, $element->getHtmlId(), $element->getComment(), $linksHtml);
}
示例3: render
/**
* Enter description here...
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$fieldConfig = $element->getFieldConfig();
$clonePath = (string) $fieldConfig->clone_path;
$clonePaths = explode('/', $clonePath);
// Prepare value for cloned element
$name = 'groups[' . $clonePaths[1] . '][fields][' . $clonePaths[2] . '][value]';
if (isset($this->_affiliateConfigData[$clonePath])) {
$data = $this->_affiliateConfigData[$clonePath];
$inherit = false;
} else {
$data = $this->_affiliateConfigRoot->descend($clonePath);
$inherit = true;
}
if ($fieldConfig->backend_model) {
$model = Mage::getModel((string) $fieldConfig->backend_model);
if (!$model instanceof Mage_Core_Model_Config_Data) {
Mage::throwException('Invalid config field backend model: ' . (string) $fieldConfig->backend_model);
}
$model->setPath($clonePath)->setValue($data)->afterLoad();
$data = $model->getValue();
}
$element->setName($name)->setValue($data)->setInherit($inherit);
// Render Element to HTML
$html = parent::render($element);
// Prepare Javascript for cloned element
$cloneId = $element->getHtmlId();
$origId = implode('_', $clonePaths);
$html .= "<script type='text/javascript'>\r\nEvent.observe(window, 'load', function() {\r\n \$('{$cloneId}').observe('change', function(){\r\n Form.Element.setValue(\$('{$origId}'), Form.Element.getValue(\$('{$cloneId}')));\r\n });\r\n \$('{$origId}').observe('change', function(){\r\n Form.Element.setValue(\$('{$cloneId}'), Form.Element.getValue(\$('{$origId}')));\r\n });";
if ($element->getCanUseWebsiteValue() || $element->getCanUseDefaultValue()) {
$html .= "\r\n \$('{$cloneId}_inherit').observe('click', function(){\r\n var el = \$('{$origId}_inherit');\r\n el.checked = \$('{$cloneId}_inherit').checked;\r\n toggleValueElements(el, Element.previous(el.parentNode));\r\n });\r\n \$('{$origId}_inherit').observe('click', function(){\r\n var el = \$('{$cloneId}_inherit');\r\n el.checked = \$('{$origId}_inherit').checked;\r\n toggleValueElements(el, Element.previous(el.parentNode));\r\n });";
}
$html .= "\r\n});\r\n</script>";
return $html;
}
示例4: _getElementHtml
/**
* Copy data level up from _data['field_config'] so it could be later used by button element
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
/**
* There's no way to unset the renderer from the element. We need to clone the current one and set additional
* data and default renderer to keep standard look and feel.
*/
/* @see Varien_Data_Form_Abstract::addField() */
$elementClassName = 'Varien_Data_Form_Element_' . ucfirst(strtolower($element->getType()));
/* @var $newElement Varien_Data_Form_Element_Abstract */
$newElement = new $elementClassName($element->getData());
$newElement->setId($element->getHtmlId());
$newElement->setForm($this->getForm());
/* @see Mage_Adminhtml_Block_System_Config_Form::_initObjects() */
$newElement->setRenderer(Mage::getBlockSingleton('adminhtml/system_config_form_field'));
if (isset($element->getFieldConfig()->config)) {
// Push data into internal array from <config> section, so we can reach it later in element building model.
$newElement->addData((array) $element->getFieldConfig()->config);
}
return $newElement->toHtml();
}
示例5: render
/**
* render separator config row
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$fieldConfig = $element->getFieldConfig();
$htmlId = $element->getHtmlId();
$html = '<tr id="row_' . $htmlId . '">' . '<td class="label" colspan="3">';
$marginTop = $fieldConfig->margin_top ? (string) $fieldConfig->margin_top : '0px';
$customStyle = $fieldConfig->style ? (string) $fieldConfig->style : '';
$html .= '<div style="margin-top: ' . $marginTop . '; font-weight: bold; border-bottom: 1px solid #dfdfdf;' . $customStyle . '">';
$html .= $element->getLabel();
$html .= '</div></td></tr>';
return $html;
}
示例6: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$date = new Varien_Data_Form_Element_Date();
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$data = array('name' => $element->getName(), 'html_id' => $element->getId(), 'image' => $this->getSkinUrl('images/grid-cal.gif'));
$date->setData($data);
$date->setValue($element->getValue(), $format);
$date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT));
$date->setClass($element->getFieldConfig()->validate->asArray());
$date->setForm($element->getForm());
return $date->getElementHtml();
}
示例7: _getElementHtml
/**
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (false === isset($element) || true === empty($element)) {
\Mage::helper('bitpay')->debugData('[ERROR] In Bitpay_Core_Block_Adminhtml_System_Config_Form_Field_Extension::_getElementHtml(): Missing or invalid $element parameter passed to function.');
throw new \Exception('In Bitpay_Core_Block_Adminhtml_System_Config_Form_Field_Extension::_getElementHtml(): Missing or invalid $element parameter passed to function.');
}
$phpExtension = $element->getFieldConfig()->php_extension;
if (true === in_array($phpExtension, get_loaded_extensions())) {
return 'Installed';
}
return 'Not Installed';
}
示例8: render
/**
* renderer notification config callback api
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$fieldConfig = $element->getFieldConfig();
$htmlId = $element->getHtmlId();
$html = '<tr id="row_' . $htmlId . '">' . '<td class="label" colspan="3">';
$marginTop = $fieldConfig->margin_top ? (string) $fieldConfig->margin_top : '0px';
$customStyle = $fieldConfig->style ? (string) $fieldConfig->style : '';
$html .= '<ul style="margin-top: ' . $marginTop . '" class="messages' . $customStyle . '">';
$html .= '<li class="notice-msg">' . str_replace('{{your_domain}}', Mage::getBaseUrl(true), $element->getLabel()) . '</li>';
$html .= '</ul></td></tr>';
return $html;
}
示例9: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$date = new Varien_Data_Form_Element_Date();
$format = 'M/dd/yy';
$data = array('name' => $element->getName(), 'html_id' => $element->getId(), 'image' => $this->getSkinUrl('images/grid-cal.gif'));
$date->setData($data);
$date->setValue($element->getValue(), $format);
$date->setFormat($format);
$date->setClass($element->getFieldConfig()->validate->asArray());
$date->setForm($element->getForm());
return $date->getElementHtml();
}
示例10: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$scope = $element->getScope();
$scope_id = $element->getScopeId();
$inherit = $element->getInherit();
$factoryName = (string) $element->getFieldConfig()->source_model;
$sourceModel = Mage::getSingleton($factoryName);
$optionArray = $sourceModel->toOptionArray(True, $scope, $scope_id);
$element->setValues($optionArray);
$html = $this->getElementHtml($element);
return $html;
// return parent::_getElementHtml($element);
}
示例11: getElementBackendConfig
/**
* Return backend config for element like JSON
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function getElementBackendConfig(Varien_Data_Form_Element_Abstract $element)
{
$config = $element->getFieldConfig()->backend_congif;
if (!$config) {
return false;
}
$config = $config->asCanonicalArray();
if (isset($config['enable_for_countries'])) {
$config['enable_for_countries'] = explode(',', str_replace(' ', '', $config['enable_for_countries']));
}
if (isset($config['disable_for_countries'])) {
$config['disable_for_countries'] = explode(',', str_replace(' ', '', $config['disable_for_countries']));
}
return Mage::helper('core')->jsonEncode($config);
}
示例12: getElementBackendConfig
/**
* Return backend config for element like JSON
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function getElementBackendConfig(Varien_Data_Form_Element_Abstract $element)
{
$config = $element->getFieldConfig();
if (!array_key_exists('backend_congif', $config)) {
return false;
}
$config = $config['backend_congif'];
if (isset($config['enable_for_countries'])) {
$config['enable_for_countries'] = explode(',', str_replace(' ', '', $config['enable_for_countries']));
}
if (isset($config['disable_for_countries'])) {
$config['disable_for_countries'] = explode(',', str_replace(' ', '', $config['disable_for_countries']));
}
return Mage::helper('Mage_Core_Helper_Data')->jsonEncode($config);
}
示例13: render
/**
* Enter description here...
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$hint = (array) $element->getFieldConfig()->hint;
if (!count($hint)) {
return parent::render($element);
}
// Generate Tooltip
/** @var $tooltip Payone_Core_Block_Adminhtml_System_Config_Tooltip */
$tooltip = $this->getLayout()->createBlock('payone_core/adminhtml_system_config_tooltip');
$tooltip->initFormElement($element);
$tooltipHtml = $tooltip->toHtml();
$element->setHint('__tooltip_html__');
$html = parent::render($element);
$hintToReplace = '<div class="hint" ><div style="display: none;">__tooltip_html__</div></div>';
$html = str_replace($hintToReplace, $tooltipHtml, $html);
return $html;
}
示例14: render
/**
* Render element html
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$hint = (array) $element->getFieldConfig()->hint;
if (!count($hint)) {
return $this->getHtmlTable($element);
}
// Generate Tooltip
/** @var $tooltip Payone_Core_Block_Adminhtml_System_Config_Tooltip */
$tooltip = $this->getLayout()->createBlock('payone_core/adminhtml_system_config_tooltip');
$tooltip->initFormElement($element);
$tooltip->setHintText($this->getHintText());
$tooltipHtml = $tooltip->toHtml();
$html = sprintf('<tr id="row_%s">', $element->getHtmlId());
$html .= '<td class="" colspan="3">';
$html .= '<table class="payone-config-info"><tr><td>' . $tooltipHtml . ' </td></tr></table>';
$html .= '</td>';
$html .= '</tr>';
return $html;
}
示例15: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$elementId = $element->getHtmlId();
preg_match("/[^_\\W]+\$/", $elementId, $fileName);
//Grab last word
$moduleName = Mage::helper('dpd/data')->module;
//getModule name
$newElement = str_replace($moduleName, "", $elementId);
//remove module name from string
$newElement = str_replace($fileName[0], "", $newElement);
//remove file name from string
$elementName = trim($newElement, "_");
$url = Mage::helper("adminhtml")->getUrl("dpd/adminhtml_buttons/export", array('element' => $elementName, 'fileName' => $fileName[0], 'scope' => $this->getForm()->getScope(), 'scope_id' => $this->getForm()->getScopeId()));
$label = $element->getFieldConfig()->button_label->__toString();
if (empty($label)) {
$label = trim($element->getLabel());
}
$html = $this->getLayout()->createBlock('adminhtml/widget_button')->setId($elementId)->setType($element->gettype())->setLabel(__($label))->setOnClick("setLocation('{$url}')")->toHtml();
return $html;
}