File tree Expand file tree Collapse file tree 6 files changed +415
-148
lines changed Expand file tree Collapse file tree 6 files changed +415
-148
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,8 @@ trait CoreEventAware
203203 'onPageCacheSetCaching ' => PageCache \SetCachingEvent::class,
204204 'onPageCacheGetKey ' => PageCache \GetKeyEvent::class,
205205 'onPageCacheIsExcluded ' => PageCache \IsExcludedEvent::class,
206+ // Sample Data
207+ 'onSampledataGetOverview ' => SampleData \GetOverviewEvent::class,
206208 // Mail
207209 'onMailBeforeRendering ' => Mail \BeforeRenderingMailTemplateEvent::class,
208210 ];
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Joomla! Content Management System
5+ *
6+ * @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
7+ * @license GNU General Public License version 2 or later; see LICENSE.txt
8+ */
9+
10+ namespace Joomla \CMS \Event \SampleData ;
11+
12+ use Joomla \CMS \Event \Result \ResultAware ;
13+ use Joomla \CMS \Event \Result \ResultAwareInterface ;
14+ use Joomla \CMS \Event \Result \ResultTypeObjectAware ;
15+
16+ // phpcs:disable PSR1.Files.SideEffects
17+ \defined ('_JEXEC ' ) or die;
18+ // phpcs:enable PSR1.Files.SideEffects
19+
20+ /**
21+ * Cass for Sample data events
22+ *
23+ * @since __DEPLOY_VERSION__
24+ */
25+ class GetOverviewEvent extends SampleDataEvent implements ResultAwareInterface
26+ {
27+ use ResultAware;
28+ use ResultTypeObjectAware;
29+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * Joomla! Content Management System
5+ *
6+ * @copyright (C) 2024 Open Source Matters, Inc. <https://www.joomla.org>
7+ * @license GNU General Public License version 2 or later; see LICENSE.txt
8+ */
9+
10+ namespace Joomla \CMS \Event \SampleData ;
11+
12+ use Joomla \CMS \Event \AbstractImmutableEvent ;
13+
14+ // phpcs:disable PSR1.Files.SideEffects
15+ \defined ('_JEXEC ' ) or die;
16+ // phpcs:enable PSR1.Files.SideEffects
17+
18+ /**
19+ * Base class for Sample data events
20+ *
21+ * @since __DEPLOY_VERSION__
22+ */
23+ abstract class SampleDataEvent extends AbstractImmutableEvent
24+ {
25+ /**
26+ * Constructor.
27+ *
28+ * @param string $name The event name.
29+ * @param array $arguments The event arguments.
30+ *
31+ * @throws \BadMethodCallException
32+ *
33+ * @since __DEPLOY_VERSION__
34+ */
35+ public function __construct ($ name , array $ arguments = [])
36+ {
37+ parent ::__construct ($ name , $ arguments );
38+
39+ if (!\array_key_exists ('subject ' , $ this ->arguments )) {
40+ throw new \BadMethodCallException ("Argument 'subject' of event {$ name } is required but has not been provided " );
41+ }
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments