mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR: adding link to BuildTask
This makes it easier to access dev/tasks from various places in, for example, the CMS. In further commits, this can also be used in other places so that there is one source of truth for the link for a BuildTask.
This commit is contained in:
parent
504e20320e
commit
518e8101d6
@ -6,6 +6,7 @@ use SilverStripe\Control\HTTPRequest;
|
||||
use SilverStripe\Core\Config\Configurable;
|
||||
use SilverStripe\Core\Extensible;
|
||||
use SilverStripe\Core\Injector\Injectable;
|
||||
use SilverStripe\Control\Director;
|
||||
|
||||
/**
|
||||
* Interface for a generic build task. Does not support dependencies. This will simply
|
||||
@ -82,4 +83,16 @@ abstract class BuildTask
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string e.g. /dev/tasks/MyTask-In-Full
|
||||
*/
|
||||
public function Link() : string
|
||||
{
|
||||
$link = $this->Config()->get('segment');
|
||||
if (! $link) {
|
||||
$link = str_replace('\\', '-', static::class);
|
||||
}
|
||||
return Director::absoluteUrl('dev/tasks/') . $link;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user