Skip to content

Commit 511c383

Browse files
committed
- (API) Added ability to register site url's with Postmaster plugins
1 parent 26a7163 commit 511c383

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

PostmasterPlugin.php

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function getName()
1010

1111
public function getVersion()
1212
{
13-
return '0.3.0';
13+
return '0.3.0.3';
1414
}
1515

1616
public function getDeveloper()
@@ -27,13 +27,33 @@ public function hasCpSection()
2727
{
2828
return true;
2929
}
30+
31+
public function registerSiteRoutes()
32+
{
33+
$routes = array(
34+
'postmaster/queue/marshal' => array('action' => 'postmaster/queue/marshal')
35+
);
36+
37+
foreach(craft()->postmaster->getRegisteredServices() as $service)
38+
{
39+
$routes = array_merge($routes, $service->registerSiteRoutes());
40+
}
41+
42+
foreach(craft()->postmaster->getRegisteredParcelTypes() as $service)
43+
{
44+
$routes = array_merge($routes, $service->registerSiteRoutes());
45+
}
46+
47+
return $routes;
48+
}
3049

3150
public function registerCpRoutes()
3251
{
3352
$routes = array(
3453
'postmaster/parcel/new' => array('action' => 'postmaster/parcel/createParcel'),
3554
'postmaster/parcel/(?P<parcelId>\d+)' => array('action' => 'postmaster/parcel/editParcel'),
3655
'postmaster/parcel/delete/(?P<parcelId>\d+)' => array('action' => 'postmaster/parcel/deleteParcel'),
56+
// 'postmaster/queue/marshal' => array('action' => 'postmaster/queue/marshal'),
3757
);
3858

3959
foreach(craft()->postmaster->getRegisteredServices() as $service)
@@ -45,6 +65,7 @@ public function registerCpRoutes()
4565
{
4666
$routes = array_merge($routes, $service->registerCpRoutes());
4767
}
68+
4869
return $routes;
4970
}
5071

core/components/BasePlugin.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ public function init()
2929

3030
}
3131

32+
public function registerSiteRoutes()
33+
{
34+
return array();
35+
}
36+
3237
public function registerCpRoutes()
3338
{
3439
return array();

core/interfaces/PluginInterface.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ public function init();
77

88
public function registerCpRoutes();
99

10+
public function registerSiteRoutes();
11+
1012
}

0 commit comments

Comments
 (0)