Skip to content

ENH Add link method to BuildTask#9899

Open
sunnysideup wants to merge 1 commit intosilverstripe:4from
sunnysideup:patch-13
Open

ENH Add link method to BuildTask#9899
sunnysideup wants to merge 1 commit intosilverstripe:4from
sunnysideup:patch-13

Conversation

@sunnysideup
Copy link
Contributor

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 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.
*/
public function Link() : string
{
$link = $this->Config()->get('segment');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$link = $this->Config()->get('segment');
$link = $this->config()->get('segment');

if (! $link) {
$link = str_replace('\\', '-', static::class);
}
return Director::absoluteUrl('dev/tasks/') . $link;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the dev/ and tasks/ portions are, in theory, configurable via SilverStripe\Dev\DevelopmentAdmin::registered_controllers so I'm not sure we should be hardcoding it here. To be fair on the other site I haven't seen anyone ever change it.

There might be a way how to get the action (and its url) from the SilverStripe\Dev\TaskRunner controller, using/including the task name.

@michalkleiner michalkleiner changed the title MINOR: adding link to BuildTask ENH Add link method to BuildTask Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants