diff --git a/dev/BuildTask.php b/dev/BuildTask.php index c374b45a5..c588dc33d 100644 --- a/dev/BuildTask.php +++ b/dev/BuildTask.php @@ -12,6 +12,14 @@ */ abstract class BuildTask extends Object { + /** + * Set a custom url segment (to follow dev/tasks/) + * + * @config + * @var string + */ + private static $segment = null; + /** * @var bool $enabled If set to FALSE, keep it from showing in the list * and from being executable through URL or CLI. diff --git a/dev/TaskRunner.php b/dev/TaskRunner.php index c09a72d73..0c8d640f9 100644 --- a/dev/TaskRunner.php +++ b/dev/TaskRunner.php @@ -103,17 +103,18 @@ class TaskRunner extends Controller { // remove the base class array_shift($taskClasses); - if($taskClasses) foreach($taskClasses as $class) { + foreach($taskClasses as $class) { if (!$this->taskEnabled($class)) continue; + $singleton = singleton($class); $desc = (Director::is_cli()) - ? Convert::html2raw(singleton($class)->getDescription()) - : singleton($class)->getDescription(); + ? Convert::html2raw($singleton->getDescription()) + : $singleton->getDescription(); $availableTasks[] = array( 'class' => $class, 'title' => singleton($class)->getTitle(), - 'segment' => str_replace('\\', '-', $class), + 'segment' => $singleton->config()->segment ?: str_replace('\\', '-', $class), 'description' => $desc, ); }