本文整理汇总了PHP中Mage_Core_Helper_Abstract::__方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Helper_Abstract::__方法的具体用法?PHP Mage_Core_Helper_Abstract::__怎么用?PHP Mage_Core_Helper_Abstract::__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Helper_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Helper_Abstract::__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decorateFilter
/**
* Create filter fields for 'Filter' column.
*
* @param mixed $value
* @param Mage_Eav_Model_Entity_Attribute $row
* @param Varien_Object $column
* @param boolean $isExport
* @return string
*/
public function decorateFilter($value, Mage_Eav_Model_Entity_Attribute $row, Varien_Object $column, $isExport)
{
$value = null;
$values = $column->getValues();
if (is_array($values) && isset($values[$row->getAttributeCode()])) {
$value = $values[$row->getAttributeCode()];
}
switch (Mage_ImportExport_Model_Export::getAttributeFilterType($row)) {
case Mage_ImportExport_Model_Export::FILTER_TYPE_SELECT:
$cell = $this->_getSelectHtmlWithValue($row, $value);
break;
case Mage_ImportExport_Model_Export::FILTER_TYPE_INPUT:
$cell = $this->_getInputHtmlWithValue($row, $value);
break;
case Mage_ImportExport_Model_Export::FILTER_TYPE_DATE:
$cell = $this->_getDateFromToHtmlWithValue($row, $value);
break;
case Mage_ImportExport_Model_Export::FILTER_TYPE_NUMBER:
$cell = $this->_getNumberFromToHtmlWithValue($row, $value);
break;
default:
$cell = $this->_helper->__('Unknown attribute filter type');
}
return $cell;
}
示例2: _addField
/**
* Add field to Options form based on parameter configuration
*
* @param Varien_Object $parameter
* @return Varien_Data_Form_Element_Abstract
*/
protected function _addField($parameter)
{
$form = $this->getForm();
$fieldset = $this->getMainFieldset();
//$form->getElement('options_fieldset');
// prepare element data with values (either from request of from default values)
$fieldName = $parameter->getKey();
$data = array('name' => $form->addSuffixToName($fieldName, 'parameters'), 'label' => $this->_translationHelper->__($parameter->getLabel()), 'required' => $parameter->getRequired(), 'class' => 'widget-option', 'note' => $this->_translationHelper->__($parameter->getDescription()));
if ($values = $this->getWidgetValues()) {
$data['value'] = isset($values[$fieldName]) ? $values[$fieldName] : '';
} else {
$data['value'] = $parameter->getValue();
//prepare unique id value
if ($fieldName == 'unique_id' && $data['value'] == '') {
$data['value'] = md5(microtime(1));
}
}
// prepare element dropdown values
if ($values = $parameter->getValues()) {
// dropdown options are specified in configuration
$data['values'] = array();
foreach ($values as $option) {
$data['values'][] = array('label' => $this->_translationHelper->__($option['label']), 'value' => $option['value']);
}
} elseif ($sourceModel = $parameter->getSourceModel()) {
$data['values'] = Mage::getModel($sourceModel)->toOptionArray();
}
// prepare field type or renderer
$fieldRenderer = null;
$fieldType = $parameter->getType();
// hidden element
if (!$parameter->getVisible()) {
$fieldType = 'hidden';
} elseif (false !== strpos($fieldType, '/')) {
$fieldRenderer = $this->getLayout()->createBlock($fieldType);
$fieldType = $this->_defaultElementType;
}
// instantiate field and render html
$field = $fieldset->addField($this->getMainFieldsetHtmlId() . '_' . $fieldName, $fieldType, $data);
if ($fieldRenderer) {
$field->setRenderer($fieldRenderer);
}
// extra html preparations
if ($helper = $parameter->getHelperBlock()) {
$helperBlock = $this->getLayout()->createBlock($helper->getType(), '', $helper->getData());
if ($helperBlock instanceof Varien_Object) {
$helperBlock->setConfig($helper->getData())->setFieldsetId($fieldset->getId())->setTranslationHelper($this->_translationHelper)->prepareElementHtml($field);
}
}
// dependencies from other fields
$dependenceBlock = $this->getChild('form_after');
$dependenceBlock->addFieldMap($field->getId(), $fieldName);
if ($parameter->getDepends()) {
foreach ($parameter->getDepends() as $from => $row) {
$values = isset($row['values']) ? array_values($row['values']) : (string) $row['value'];
$dependenceBlock->addFieldDependence($fieldName, $from, $values);
}
}
return $field;
}
示例3: __construct
/**
* @SuppressWarnings(PHPMD.NPathComplexity)
* @throws InvalidArgumentException
* @param array $data
*/
public function __construct(array $data = array())
{
$this->_helper = isset($data['helper']) ? $data['helper'] : Mage::helper('Mage_Backend_Helper_Data');
unset($data['helper']);
if (false === $this->_helper instanceof Mage_Core_Helper_Abstract) {
throw new InvalidArgumentException('Passed wrong parameters');
}
if (isset($data['rowUrl'])) {
$rowUrlParams = $data['rowUrl'];
if (isset($rowUrlParams['generator'])) {
$this->_rowUrlGenerator = $rowUrlParams['generator'];
} else {
$generatorClassName = 'Mage_Backend_Model_Widget_Grid_Row_UrlGenerator';
if (isset($data['generatorClass'])) {
$generatorClassName = $rowUrlParams['generatorClass'];
}
$objectFactory = isset($data['objectFactory']) ? $data['objectFactory'] : Mage::app()->getConfig();
if (false === $objectFactory instanceof Mage_Core_Model_Config) {
throw new InvalidArgumentException('Passed wrong parameters');
}
unset($data['objectFactory']);
$this->_rowUrlGenerator = $objectFactory->getModelInstance($generatorClassName, $rowUrlParams);
}
if (false === $this->_rowUrlGenerator instanceof Mage_Backend_Model_Widget_Grid_Row_UrlGenerator) {
throw new InvalidArgumentException('Passed wrong parameters');
}
}
parent::__construct($data);
$this->setTemplate('Mage_Backend::widget/grid/column_set.phtml');
$this->setEmptyText($this->_helper->__('No records found.'));
}
示例4: getTypes
/**
* Get information about all declared cache types
*
* @return array
*/
public function getTypes()
{
$types = array();
$config = $this->_config->getNode(self::XML_PATH_TYPES);
if ($config) {
foreach ($config->children() as $type => $node) {
$types[$type] = new Varien_Object(array('id' => $type, 'cache_type' => $this->_helper->__((string) $node->label), 'description' => $this->_helper->__((string) $node->description), 'tags' => strtoupper((string) $node->tags), 'status' => (int) $this->canUse($type)));
}
}
return $types;
}
示例5: translate
public function translate(array $args)
{
$this->reset();
$this->parseInput($args);
$this->parsePlaceholders();
if (count($this->placeholders) <= 0) {
array_unshift($this->args, $this->text);
return call_user_func_array(array($this, '__'), $this->args);
}
$this->translatedText = parent::__($this->text);
$this->replacePlaceholdersByValue();
$this->replacePlaceholdersByArgs();
$unprocessedArgs = array_diff($this->args, $this->processedArgs);
if (!$unprocessedArgs) {
return $this->translatedText;
}
return vsprintf($this->translatedText, $unprocessedArgs);
}
示例6: decorateFilter
/**
* Create filter fields for 'Filter' column.
*
* @param mixed $value
* @param Mage_Eav_Model_Entity_Attribute $row
* @param Varien_Object $column
* @param boolean $isExport
* @return string
*/
public function decorateFilter($value, Mage_Eav_Model_Entity_Attribute $row, Varien_Object $column, $isExport)
{
switch (Mage_ImportExport_Model_Export::getAttributeFilterType($row)) {
case Mage_ImportExport_Model_Export::FILTER_TYPE_SELECT:
$cell = $this->_getSelectHtml($row);
break;
case Mage_ImportExport_Model_Export::FILTER_TYPE_INPUT:
$cell = $this->_getInputHtml($row);
break;
case Mage_ImportExport_Model_Export::FILTER_TYPE_DATE:
$cell = $this->_getDateFromToHtml($row);
break;
case Mage_ImportExport_Model_Export::FILTER_TYPE_NUMBER:
$cell = $this->_getNumberFromToHtml($row);
break;
default:
$cell = $this->_helper->__('Unknown attribute filter type');
}
return $cell;
}
示例7: test__
public function test__()
{
$uniqueText = uniqid('prefix_');
$this->assertEquals($uniqueText, $this->_helper->__($uniqueText));
}