本文整理汇总了PHP中FormField::getElement方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::getElement方法的具体用法?PHP FormField::getElement怎么用?PHP FormField::getElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormField
的用法示例。
在下文中一共展示了FormField::getElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getElement
public function getElement($value = "", $group = "", $html = "")
{
if ($group) {
$this->group = $group;
$this->fieldname = $this->getFieldName($this->fieldname);
}
$this->value = $value;
$class = 'select';
$default = isset($this->element['default']) ? $this->element['default'] : "";
$this->value = $this->value == "" || $this->value == null ? $default : $this->value;
$class .= isset($this->element['class']) ? (string) $this->element['class'] : '';
$style = isset($this->element['style']) ? (string) $this->element['style'] : '';
$size = isset($this->element['size']) ? (string) $this->element['size'] : '30';
$multiple = isset($this->element['multiple']) ? (string) $this->element['multiple'] : false;
if ($multiple) {
$multiple = ' multiple="multiple" ';
$this->name .= "[]";
} else {
$multiple = "";
}
$html = '<select name="' . $this->name . '" class="' . $class . '"' . $multiple . ' style="' . $style . '">';
$blocks = Mage::getModel('cms/block')->getCollection()->addFilter("is_active", 1)->getItems();
$html .= '<option value="0">' . Mage::helper('ves_tempcp')->__("---- Select a Static Block ----") . '</option>';
if (!empty($blocks)) {
foreach ($blocks as $block) {
if ($block->getIdentifier() == $this->value) {
$html .= '<option value="' . $block->getIdentifier() . '" selected="selected">' . $block->getTitle() . '</option>';
} else {
$html .= '<option value="' . $block->getIdentifier() . '">' . $block->getTitle() . '</option>';
}
}
}
$html .= '</select>';
return parent::getElement($value, $group, $html);
}
示例2: getElement
public function getElement($value = "", $group = "", $html = "")
{
if ($group) {
$this->group = $group;
$this->fieldname = $this->getFieldName($this->fieldname);
}
$this->value = $value;
$class = isset($this->element['class']) ? (string) $this->element['class'] : '';
$style = isset($this->element['style']) ? (string) $this->element['style'] : '';
$max_length = isset($this->element['max_length']) ? (string) $this->element['max_length'] : '150';
$size = isset($this->element['size']) ? (string) $this->element['size'] : '30';
$html = '<input type="text" name="' . $this->name . '" max_length="' . $max_length . '" size="' . $size . '" style="' . $style . '" class="' . $class . '" value="' . $this->value . '"/>';
return parent::getElement($value, $group, $html);
}
示例3: getElement
public function getElement($value = "", $group = "", $html = "")
{
if ($group) {
$this->group = $group;
$this->fieldname = $this->getFieldName($this->fieldname);
}
$this->value = $value;
$class = isset($this->element['class']) ? (string) $this->element['class'] : '';
$cols = isset($this->element['cols']) ? (string) $this->element['cols'] : '25';
$rows = isset($this->element['rows']) ? (string) $this->element['rows'] : '10';
$width = isset($this->element['width']) ? (string) $this->element['width'] : '400px';
$height = isset($this->element['height']) ? (string) $this->element['height'] : '300px';
$html = Mage::helper('ves_tempcp/element')->getElementEditor($this->group . '_' . $this->fieldname, $this->name, $value, 'class="' . $class . '" cols="' . $cols . '" rows="' . $rows . '" style="width:' . $width . ';height:' . $height . '"');
return parent::getElement($value, $group, $html);
}
示例4: getElement
public function getElement($value = "", $group = "", $html = "")
{
if ($group) {
$this->group = $group;
$this->fieldname = $this->getFieldName($this->fieldname);
}
$this->value = $value;
$class = isset($this->element['class']) ? (string) $this->element['class'] : '';
$cols = isset($this->element['cols']) ? (string) $this->element['cols'] : '25';
$rows = isset($this->element['rows']) ? (string) $this->element['rows'] : '10';
$width = isset($this->element['width']) ? (string) $this->element['width'] : '400px';
$height = isset($this->element['height']) ? (string) $this->element['height'] : '300px';
$html = '<textarea name="' . $this->name . '" id="' . $this->group . '_' . $this->fieldname . '" class="' . $class . '" cols="' . $cols . '" rows="' . $rows . '" style="width:' . $width . ';height:' . $height . '">' . $value . '</textarea>';
return parent::getElement($value, $group, $html);
}
示例5: getElement
public function getElement($value = "", $group = "", $html = "")
{
if ($group) {
$this->group = $group;
$this->fieldname = $this->getFieldName($this->fieldname);
}
$this->value = $value;
$class = 'select';
$default = isset($this->element['default']) ? $this->element['default'] : "";
$this->value = empty($this->value) ? $default : $this->value;
$class .= isset($this->element['class']) ? (string) $this->element['class'] : '';
$style = isset($this->element['style']) ? (string) $this->element['style'] : '';
$size = isset($this->element['size']) ? ' size="' . (string) $this->element['size'] . '"' : '';
$vars = get_object_vars($this->element);
$options = $vars['option'];
$options = $this->getOptions($options);
$multiple = isset($this->element['multiple']) ? (string) $this->element['multiple'] : true;
if ($multiple) {
$multiple = ' multiple="multiple" ';
$class .= ' multiselect';
$this->name .= "[]";
} else {
$multiple = "";
}
$html = '<select name="' . $this->name . '" class="' . $class . '"' . $multiple . $size . ' style="' . $style . '">';
$layouts = array("all" => Mage::helper('ves_tempcp')->__("All Pages"), "home" => Mage::helper('ves_tempcp')->__("Home"));
if ($options) {
foreach ($options as $option) {
$layouts[$option] = Mage::helper('ves_tempcp')->__($option);
}
}
if (!empty($layouts)) {
foreach ($layouts as $key => $val) {
if ($key == $this->value || is_array($this->value) && in_array($key, $this->value)) {
$html .= '<option value="' . $key . '" selected="selected">' . $val . '</option>';
} else {
$html .= '<option value="' . $key . '">' . $val . '</option>';
}
}
}
$html .= '</select>';
return parent::getElement($value, $group, $html);
}