IO and actor browse pages are broken when markdown support is disabled and more that one filter is applied
|Target version:||Release 2.5.2|
|Google Code Legacy ID:||Tested version:||2.5, 2.6|
- Disable Markdown support.
- Go to archival descriptions (IO) browse page.
- Check that the "Only top-level descriptions" filter is applied.
- Click on "Show results with digital objects" or a facet option.
When Markdown is disabled, the escaping strategy from Symfony changes how the data should be accessed in some cases in the templates. An explanation provided to the AtoM team a while ago:
The escaping strategy is enabled by default but escaped data is a problem when it's pared by Parsedown, which has a safe mode that takes care of it while parsing the Markdown. The Markdown support can be enabled/disabled via setting so, when it's disabled, we still need the escaping strategy from Symfony.
Therefore, we may find the data escaped or not in the templates. This means that objects can be an instance of what you're expecting or an instance of `sfOutputEscaperObjectDecorator` and arrays can be instances of `sfOutputEscaperArrayDecorator` instead of real arrays.
For `sfOutputEscaperArrayDecorator` and arrays, use allways the `` annotation to access the data, as it works in both types unlike `->get()`, which only works in `sfOutputEscaperArrayDecorator`.
For `sfOutputEscaperObjectDecorator` and objects, never use the `->getRaw()` or `->getRawValue()` methods as it will only work in the decorator, if you need the raw value of `$object` in a template, use `$sf_data->getRaw('object')` instead, which doesn't cause an error when executed over not escaped objects/arrays.
Also, `sfOutputEscaper::unescape()` can be used in the same maner to unescape and object/array but, please notice that the escape happens while the view is built so, to do this kind of operations it's better if you do it in the controller (as always).
In this commit you can see some of the fixes I had to do after this changes.
The Markdown parsing process is made in QubitMarkdown, an instantiable class that uses ParsedownExtra to process the data. This class > is used in the following render methods from QubitHelper:
- render_value: uses Parsedown text method in safe mode (adds paragraphs).
- render_value_inline: uses Parsedown line method in safe mode.
- render_value_html: uses Parsedown text method in unsafe mode (for HTML).
- render_title: returns 'Untitled' if render_value_inline returns and empty string.
- strip_markdown: removes Markdown and HTML tags.