Replace URL parameters dynamically without needing a list in advance (#3361)
Fixes #3358. Credit to @jimcottrell
This commit is contained in:
parent
54a67ca556
commit
34da61805b
|
|
@ -463,7 +463,7 @@ class FormController extends ControllerBehavior
|
|||
}
|
||||
|
||||
if ($model && $redirectUrl) {
|
||||
$redirectUrl = RouterHelper::parseValues($model, array_keys($model->getAttributes()), $redirectUrl);
|
||||
$redirectUrl = RouterHelper::replaceParameters($model, $redirectUrl);
|
||||
}
|
||||
|
||||
if (starts_with($redirectUrl, 'http://') || starts_with($redirectUrl, 'https://')) {
|
||||
|
|
|
|||
|
|
@ -631,12 +631,7 @@ class Lists extends WidgetBase
|
|||
return null;
|
||||
}
|
||||
|
||||
$data = $record->toArray();
|
||||
$data += [$record->getKeyName() => $record->getKey()];
|
||||
|
||||
$columns = array_keys($data);
|
||||
|
||||
$url = RouterHelper::parseValues($data, $columns, $this->recordUrl);
|
||||
$url = RouterHelper::replaceParameters($record, $this->recordUrl);
|
||||
return Backend::url($url);
|
||||
}
|
||||
|
||||
|
|
@ -651,8 +646,7 @@ class Lists extends WidgetBase
|
|||
return null;
|
||||
}
|
||||
|
||||
$columns = array_keys($record->getAttributes());
|
||||
$recordOnClick = RouterHelper::parseValues($record, $columns, $this->recordOnClick);
|
||||
$recordOnClick = RouterHelper::replaceParameters($record, $this->recordOnClick);
|
||||
return Html::attributes(['onclick' => $recordOnClick]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue