@@ -26,9 +26,17 @@ A menu item should have a URL associated with it. The CMF provides the
26
26
from the ``content `` and ``routeParameters `` options when using the
27
27
:ref: `dynamic router <bundles-routing-dynamic-generator >`.
28
28
29
- The ``content `` option, if specified, must contain a class which implements
30
- the ``RouteReferrersInterface ``, see the :ref: `dynamic router
31
- <bundles-routing-dynamic-generator>` documentation for more information.
29
+ The ``content `` option, if specified, must contain something that the content
30
+ URL generator can work with. When using the :ref: `dynamic router
31
+ <bundles-routing-dynamic-generator>`, this needs to be a class implementing
32
+ the ``RouteReferrersInterface ``. You can alternatively specify a custom
33
+ ``UrlGeneratorInterface `` with the ``content_url_generator `` configuration
34
+ option.
35
+
36
+ .. versionadded :: 1.2
37
+ The ``content_url_generator `` option was introduced in CmfMenuBundle 1.2.0.
38
+ Prior to 1.2, the default service ``router `` was hardcoded to generate URLs
39
+ from content.
32
40
33
41
URL generation is absolute or relative, depending on the boolean value of the
34
42
``routeAbsolute `` option.
@@ -44,14 +52,24 @@ of the three URL generation techniques to use.
44
52
The values for this options can be one of the following:
45
53
46
54
* ``null ``: If the value is ``null `` (or the options is not set) then the link
47
- type is determined automatically by looking at each of the ``uri ``, ``route `` and
48
- ``content `` options and using the first one which is non-null.
55
+ type is determined automatically by looking at each of the ``uri ``, ``route ``
56
+ and ``content `` options and using the first one which is non-null.
49
57
* **uri **: Use the URI provided by the ``uri `` option.
50
58
* **route **: Generate a URL using the route named by the ``route `` option
51
59
and the parameters provided by the ``routeParameters `` option.
52
- * **content **: Generate a URL by passing the ``RouteReferrersInterface ``
53
- instance provided by the ``content `` option to the router using any
54
- parameters provided by the ``routeParameters `` option.
60
+ * **content **: Generate a URL by passing the value of the ``content `` option to
61
+ the content URL generator, using any parameters provided by the
62
+ ``routeParameters `` option.
63
+
64
+ Menu Nodes without URL
65
+ ~~~~~~~~~~~~~~~~~~~~~~
66
+
67
+ A menu node document might not have a URL, when that information was never set
68
+ or it points to a content that has been deleted meanwhile. In that case, there
69
+ are two options: The menu node can be skipped, or it can be rendered as text
70
+ without link. By default, the node is skipped.
71
+
72
+ You can set ``cmf_menu.allow_empty_items `` to true to render nodes without URL.
55
73
56
74
Publish Workflow
57
75
----------------
@@ -61,7 +79,7 @@ visible by use of the :doc:`publish workflow checker
61
79
<../core/publish_workflow>`.
62
80
63
81
.. versionadded :: 1.1
64
- The ``MenuContentVoter `` was added in CmfMenuBundle 1.1.
82
+ The ``MenuContentVoter `` was introduced in CmfMenuBundle 1.1.
65
83
66
84
The ``MenuContentVoter `` decides that a menu node is not published if the
67
85
content it is pointing to is not published.
0 commit comments