protected function displayHiddenFields()
    {
        $input_tag = new SwatHtmlTag('input');
        $input_tag->type = 'hidden';

        echo '<div class="swat-hidden">';

        if ($this->_8bit_encoding !== null) {
            // The character encoding detection field is intentionally not using
            // SwatHtmlTag to avoid minimizing entities.
            echo '<input type="hidden" ',
                'name="',
                self::ENCODING_FIELD,
                '" ',
                'value="',
                self::ENCODING_ENTITY_VALUE,
                '" />';
        }

        foreach ($this->hidden_fields as $name => $value) {
            // display unserialized value for primative types
            if ($value !== null && !is_array($value) && !is_object($value)) {
                // SwatHtmlTag uses SwatString::minimizeEntities(), which
                // prevents double-escaping entities. For hidden form-fields,
                // we want data to be returned exactly as it was specified. This
                // necessitates double-escaping to ensure any entities that were
                // specified in the hidden field value are returned correctly.
                $escaped_value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');

                $input_tag->name = $name;
                $input_tag->value = $escaped_value;
                $input_tag->display();
            }

            // display serialized value
            $serialized_data = $this->serializeHiddenField($value);

            // SwatHtmlTag uses SwatString::minimizeEntities(), which prevents
            // double-escaping entities. For hidden form-fields, we want data
            // to be returned exactly as it was specified. This  necessitates
            // double-escaping to ensure any entities that were specified in
            // the hidden field value are returned correctly.
            $escaped_serialized_data = htmlspecialchars(
                $serialized_data,
                ENT_COMPAT,
                'UTF-8'
            );

            $input_tag->name = self::SERIALIZED_PREFIX . $name;
            $input_tag->value = $escaped_serialized_data;
            $input_tag->display();
        }

        // display hidden field names
        if (count($this->hidden_fields) > 0) {
            // array of field names
            $serialized_data = SwatString::signedSerialize(
                array_keys($this->hidden_fields),
                $this->salt
            );

            $input_tag->name = self::HIDDEN_FIELD;
            $input_tag->value = $serialized_data;
            $input_tag->display();
        }

        // display authentication token
        if (self::$authentication_token !== null) {
            $serialized_data = SwatString::signedSerialize(
                self::$authentication_token,
                $this->salt
            );

            $input_tag = new SwatHtmlTag('input');
            $input_tag->type = 'hidden';
            $input_tag->name = self::AUTHENTICATION_TOKEN_FIELD;
            $input_tag->value = $serialized_data;
            $input_tag->display();
        }

        echo '</div>';
    }