function renderAttributes() { if ($this->isChecked()) { $this->setAttribute('checked', 'checked'); } else { $this->removeAttribute('checked'); } parent::renderAttributes(); }
function renderAttributes() { if (!$this->hasAttribute('value')) { if ($value = $this->getValue()) { $this->setAttribute('value', $value); } else { $this->setAttribute('value', ""); } } parent::renderAttributes(); }
function renderAttributes() { if ($this->logical_checked_attr) { $this->removeAttribute('checked'); } if ($this->isChecked()) { $this->setAttribute('checked', 'checked'); $this->logical_checked_attr = true; } else { $this->removeAttribute('checked'); } parent::renderAttributes(); }
function testSetErrorState_SetErrorStateClassAndStyle() { $widget = new lmbMacroFormElementWidget('any_field'); $widget->setAttribute('error_style', 'my_error_style'); $widget->setAttribute('error_class', 'my_error_class'); $widget->setErrorState(true); $this->assertEqual($widget->getAttribute('class'), 'my_error_class'); $this->assertEqual($widget->getAttribute('style'), 'my_error_style'); }
function testGetName_ReturnNameAttribute() { $widget = new lmbMacroFormElementWidget('testGetName_ReturnNameAttribute'); $widget->setAttribute('name', 'My_Super_Field'); $this->assertEqual($widget->getName(), 'My_Super_Field'); }
function getName() { $name = parent::getName(); return str_replace('[]', '', $name); }