You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: bundles/activity.rst
+33
Original file line number
Diff line number
Diff line change
@@ -187,6 +187,39 @@ users with a ``view`` permission for the context:
187
187
}
188
188
}
189
189
190
+
Extending the Admin View with a Activity Table
191
+
------------------------------------------------
192
+
193
+
To extend the admin view by adding a activities table, follow these steps:
194
+
195
+
1. Inject the `ActivityViewBuilderFactoryInterface`: Inject this interface into your custom Admin class. This will allow you to utilize the necessary methods to create the activities view.
196
+
2. Create the Activity List View: Use the `createActivityListViewBuilder` method to create the list view for the activities table.
197
+
198
+
Here’s an example implementation, demonstrating how to add the activities tab to your custom admin view, for further examples take a look at the SnippetAdmin class:
199
+
200
+
.. code-block:: php
201
+
202
+
if ($this->activityViewBuilderFactory->hasActivityListPermission()) {
203
+
$viewCollection->add(
204
+
$this->activityViewBuilderFactory
205
+
->createActivityListViewBuilder(
206
+
$insightsResourceTabViewName . '.activity',
207
+
'/activities',
208
+
CustomEntity::RESOURCE_KEY
209
+
)
210
+
->setParent($insightsResourceTabViewName)
211
+
);
212
+
}
213
+
214
+
The `hasActivityListPermission` method ensures that the current user has permission to view the activities list.
215
+
The `createActivityListViewBuilder` method is used to create the view. It takes three parameters:
216
+
217
+
- The name of the new view, usually appended with .activity to indicate it is an activity view.
218
+
- The URL path for the activities table.
219
+
- The resource key identifies the type of resource for the activities.
220
+
221
+
The setParent method sets the parent view to integrate the activities table into the existing admin view.
Copy file name to clipboardexpand all lines: bundles/reference.rst
+33
Original file line number
Diff line number
Diff line change
@@ -59,3 +59,36 @@ Example implementation for a custom content-type:
59
59
$propertyPrefix . $property->getName()
60
60
);
61
61
}
62
+
63
+
Extending the Admin View with a References Table
64
+
------------------------------------------------
65
+
66
+
To extend the admin view by adding a references table, follow these steps:
67
+
68
+
1. Inject the `ReferenceViewBuilderFactoryInterface`: Inject this interface into your custom Admin class. This will allow you to utilize the necessary methods to create the references view.
69
+
2. Create the Reference List View: Use the `createReferenceListViewBuilder` method to create the list view for the references table.
70
+
71
+
Here’s an example implementation from the `SnippetAdmin` class, demonstrating how to add the references tab to your custom admin view:
72
+
73
+
.. code-block:: php
74
+
75
+
if ($this->referenceViewBuilderFactory->hasReferenceListPermission()) {
76
+
$viewCollection->add(
77
+
$this->referenceViewBuilderFactory
78
+
->createReferenceListViewBuilder(
79
+
$insightsResourceTabViewName . '.reference',
80
+
'/references',
81
+
SnippetDocument::RESOURCE_KEY
82
+
)
83
+
->setParent($insightsResourceTabViewName)
84
+
);
85
+
}
86
+
87
+
The `hasReferenceListPermission` method ensures that the current user has permission to view the references list.
88
+
The `createReferenceListViewBuilder` method is used to create the view. It takes three parameters:
89
+
90
+
- The name of the new view, usually appended with .reference to indicate it is a reference view.
91
+
- The URL path for the references table.
92
+
- The resource key identifies the type of resource being referenced.
93
+
94
+
The setParent method sets the parent view to integrate the references table into the existing admin view.
0 commit comments