ZF-8874: Navigation Menu View Helper Output Without Whitespace


I've been working with Zend Navigation, but today I ran into a little problem with the way it adds whitespace around the LI. I wanted to display the LIs next to each other, and used the CSS display value inline-block. But because of the whitespace in the HTML, specifically the newline between the ending and opening LI, there is a gap between the LIs. There is an example of what I mean here:

So, I was hoping it might be possible to add an option to disable output of the excess whitespace. For example FormatOutput, since that is already used in the Sitemap view helper.


If we have separators for list and list items, we can manipulate the output.

I think we also need to add a new option:

$indent      = $this->getIndent(); // Zend_View_Helper_Navigation_HelperAbstract
$innerIndent = $this->getInnerIndent; // Zend_View_Helper_Navigation_Menu - NEW!

$indent . '
'; $indent . $innerIndent . 'foo'; $indent . $innerIndent . 'bar'; $indent . '';

Tasks: * Move {{$_formatOutput}}, {{getFormatOutput()}} and {{setFormatOutput()}} from {{Zend_View_Helper_Navigation_Sitemap}} to {{Zend_View_Helper_Navigation_HelperAbstract}} * Add method {{setEOL}} and {{getEOL}} to {{Zend_View_Helper_Navigation_HelperAbstract}} (standard is {{self::EOL}} and is respects the option "formatOutput") * Change all concrete helpers to use {{getEOL}} instead of {{self::EOL}} * Complete rework of the use of indentation (is hard coded!)

Patch and unit tests added.

This is a good idea, but the patch doesn't apply.

I will add a new patch. The current patch is very old.

Fixed on trunk (25238) and release-1.12 (25239)