/** * Visit a hidden input node. * * @param T_Form_Hidden $node */ function visitFormHidden(T_Form_Hidden $node) { $xhtml = $this->indent . '<div class="hidden">' . EOL; // render value $attributes = $node->getAllAttributes(); $attributes += array('type' => 'hidden', 'name' => $node->getFieldname(), 'value' => $node->getFieldValue()); $xhtml .= $this->indent . '<input '; foreach ($attributes as $key => $value) { $xhtml .= $key . '="' . $this->escape($value) . '"' . EOL . $this->indent . ' '; } $xhtml = rtrim($xhtml) . ' /> ' . EOL; // render checksum $attributes = array('type' => 'hidden', 'name' => $node->getChecksumFieldname(), 'value' => $node->getChecksumFieldValue()); $xhtml .= $this->indent . '<input '; foreach ($attributes as $key => $value) { $xhtml .= $key . '="' . $this->escape($value) . '"' . EOL . $this->indent . ' '; } $xhtml = rtrim($xhtml) . ' /> ' . EOL; $xhtml .= $this->indent . '</div>' . EOL; $this->addXhtml($xhtml); }
/** * Visit a hidden input. * * @param T_Form_Hidden */ function visitFormHidden(T_Form_Hidden $node) { $this->data[$node->getFieldname()] = $node->getFieldValue(); $this->data[$node->getChecksumFieldname()] = $node->getChecksumFieldValue(); }
function testChecksumFieldValueDependsOnSalt() { $hidden1 = new T_Form_Hidden('alias', 'value'); $hidden2 = new T_Form_Hidden('alias', 'value'); $hidden1->setFieldnameSalt('salt1', new T_Filter_RepeatableHash()); $hidden2->setFieldnameSalt('salt2', new T_Filter_RepeatableHash()); $this->assertNotEquals($hidden1->getChecksumFieldValue(), $hidden2->getChecksumFieldValue()); }