本文整理汇总了PHP中Varien_Data_Form_Element_Text::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Text::setData方法的具体用法?PHP Varien_Data_Form_Element_Text::setData怎么用?PHP Varien_Data_Form_Element_Text::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Text
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Text::setData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$color = new Varien_Data_Form_Element_Text();
$data = array('name' => $element->getName(), 'html_id' => $element->getId());
$color->setData($data);
$color->setValue($element->getValue(), $format);
$color->setForm($element->getForm());
$color->addClass('color ' . $element->getClass());
return $color->getElementHtml();
}
示例2: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$helper = Mage::helper('netzarbeiter_groupscatalog2');
if ($helper->getConfig('show_multiselect_field')) {
$html = parent::_getElementHtml($element);
} else {
$label = new Varien_Data_Form_Element_Text();
$label->setData($element->getData())->setType('text')->setExtType('textfield')->addClass('input-text')->setReadOnly(true)->setForm($element->getForm())->setId($element->getId());
$value = explode(',', (string) $label->getValue());
$groups = $helper->getGroupNamesAsString($value);
$label->setValue($groups);
$html = $label->getElementHtml();
}
return $html;
}
示例3: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$days = new Varien_Data_Form_Element_Text();
$data = array('name' => $element->getName(), 'html_id' => $element->getId());
$days->setData($data);
if (is_numeric($element->getValue())) {
$days->setValue($element->getValue());
} else {
$days->setValue(30);
}
$days->setForm($element->getForm());
$html = $days->getElementHtml();
$javaScript = "\n <script type=\"text/javascript\">\n Event.observe(window, 'load', function() {\n days=\$('{$element->getHtmlId()}').value;\n if (isNaN(days)) {\n \$('{$element->getHtmlId()}').value = '';\n }\n });\n Event.observe('{$element->getHtmlId()}', 'change', function(){\n days=\$('{$element->getHtmlId()}').value;\n if (isNaN(days)) {\n \$('{$element->getHtmlId()}').value = '';\n }\n });\n </script>";
$html .= $javaScript;
return $html;
}
示例4: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!class_exists('Conekta')) {
error_log("Plugin miss Conekta PHP lib dependency. Clone the repository using 'git clone --recursive git@github.com:conekta/conekta-magento.git'", 0);
throw new Mage_Payment_Model_Info_Exception("Payment module unavailable. Please contact system administrator.");
}
Conekta::setApiKey(Mage::getStoreConfig('payment/webhook/privatekey'));
Conekta::setApiVersion("1.0.0");
Conekta::setLocale(Mage::app()->getLocale()->getLocaleCode());
$url = new Varien_Data_Form_Element_Text();
$data = array('name' => $element->getName(), 'html_id' => $element->getId());
$url->setData($data);
$webhook_url = Mage::getBaseUrl() . "index.php/webhook/ajax/listener";
if (!empty($element->getValue())) {
$url_string = $element->getValue();
} else {
$url_string = $webhook_url;
}
$url->setValue($url_string);
$events = array("events" => array("charge.created", "charge.paid", "charge.under_fraud_review", "charge.fraudulent", "charge.refunded", "charge.created", "customer.created", "customer.updated", "customer.deleted", "webhook.created", "webhook.updated", "webhook.deleted", "charge.chargeback.created", "charge.chargeback.updated", "charge.chargeback.under_review", "charge.chargeback.lost", "charge.chargeback.won", "payout.created", "payout.retrying", "payout.paid_out", "payout.failed", "plan.created", "plan.updated", "plan.deleted", "subscription.created", "subscription.paused", "subscription.resumed", "subscription.canceled", "subscription.expired", "subscription.updated", "subscription.paid", "subscription.payment_failed", "payee.created", "payee.updated", "payee.deleted", "payee.payout_method.created", "payee.payout_method.updated", "payee.payout_method.deleted"));
$error = false;
$error_message = null;
try {
$different = true;
$webhooks = Conekta_Webhook::where();
foreach ($webhooks as $webhook) {
if (strpos($webhook->webhook_url, $url_string) !== false) {
$different = false;
}
}
if ($different) {
$webhook = Conekta_Webhook::create(array_merge(array("url" => $url_string), $events));
}
} catch (Exception $e) {
$error = true;
$error_message = $e->getMessage();
}
$url->setForm($element->getForm());
$html = $url->getElementHtml();
$javaScript = "\n <script type=\"text/javascript\">\n Event.observe(window, 'load', function() {\n alert('" . $error_message . "');\n });\n </script>";
if ($error) {
$html .= $javaScript;
}
return $html;
}