empty page button title improvement

This commit is contained in:
Cihan Şentürk 2022-11-07 11:41:54 +03:00 committed by GitHub
parent 95bb91dcf5
commit 35147ea78c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,6 +26,12 @@ class EmptyPage extends Component
/** @var string */
public $title;
/** @var string */
public $createButtonTitle;
/** @var string */
public $importButtonTitle;
/** @var string */
public $description;
@ -75,9 +81,9 @@ class EmptyPage extends Component
*/
public function __construct(
string $alias = '', string $group = '', string $page = '',
string $title = '', string $description = '', string $docsCategory = 'accounting',
string $image = '', string $imageEmptyPage = '',
bool $checkPermissionCreate = true, string $permissionCreate = '',
string $title = '', string $createButtonTitle = '', string $importButtonTitle = '',
string $description = '', string $docsCategory = 'accounting', string $image = '',
string $imageEmptyPage = '', bool $checkPermissionCreate = true, string $permissionCreate = '',
array $buttons = [], bool $hideButtonCreate = false, bool $hideButtonImport = false,
bool $hideDocsDescription = false, string $importRoute = '', array $importRouteParameters = []
) {
@ -91,6 +97,9 @@ class EmptyPage extends Component
$this->docsCategory = $docsCategory;
$this->title = $this->getTitle($title);
$this->createButtonTitle = $createButtonTitle;
$this->importButtonTitle = $importButtonTitle;
$this->description = $this->getDescription($description);
$this->imageEmptyPage = $imageEmptyPage;
@ -276,7 +285,11 @@ class EmptyPage extends Component
$route = route($page . '.create');
}
$title = $this->createButtonTitle;
if (! $title) {
$title = $this->getTitle(null, 1);
}
return [
'url' => $route,
@ -292,7 +305,11 @@ class EmptyPage extends Component
$importRoute = $this->getImportRoute($this->importRoute);
$importRouteParameters = $this->getImportRouteParameters($this->importRouteParameters);
$title = $this->importButtonTitle;
if (! $title) {
$title = $this->getTitle();
}
return [
'url' => route($importRoute, $importRouteParameters),