ezsystems/ezpublish-kernel — pull request #1104 by pspanja (2014-11-27 11:40:54+00:00)
Title: Fix EZP-23513: embed rendering (RichText)

This PR resolves https://jira.ez.no/browse/EZP-23513

Part 2 of 2, handling RichText field type.
Part 1 of 2 for XmlText can be found here: https://github.com/ezsystems/ezpublish-kernel/pull/1087

Continuing on #1087, this adds embed linking capabilities to native RichText format. Link is added as separate child element, like:

```xml

medium
10
5

```

For Docbook and XHTML5 edit formats, a Schematron rule is added, preventing `ezlink` element from appearing in `link` or `a` elements. This would be possible to achive in RELAX NG and XSD, but it would be very awkward, so I went with this solution as we already support Schematron validation.

Embed parameters passed to the rendering process are here changed, example:

```php
"embedParams" => array(
"id" => "601",
"viewType" => "embed-inline",
"config" => array(
"size" => "medium",
"offset" => 10,
"limit" => 5,
),
"link" => array(
"href" => "http://www.example.com",
"resourceType" => "CONTENT",
"resourceId" => "95",
"resourceFragmentIdentifier" => "fragment1",
"wrapped" => false,
"title" => "Link title",
"target" => "_self",
),
),
```

With this, properties will not be available if empty, e.g. if title is not defined on a link it will not be present, or if embed is not linked `link` will not be present among the `embedParams` in the template.
XmlText implementation is here changed to the same style. It is also updated with new `resourceFragmentIdentifier` parameter.

RichText's default embed templates are updated for this, however care is taken to pass the parameters to the sub-request in the form we currently support, so there is no BC break. If a user wants to have full new `embedParams` in the end template, only default template change is needed.
#### Followups:
* [EZP-23646](https://jira.ez.no/browse/EZP-23646): Docbook->EZXML conversion tmp paragraphs (PR: https://github.com/ezsystems/ezpublish-kernel/pull/1092)
* [EZP-23647](https://jira.ez.no/browse/EZP-23647): Link parameters for externally linked embeds
* [EZP-23648](https://jira.ez.no/browse/EZP-23648): Implement UrlService
* [EZP-23650](https://jira.ez.no/browse/EZP-23650): Clean up URL resolving in XmlText and RichText external storages