Skip to content

Commit

Permalink
git subrepo pull php-toolkit
Browse files Browse the repository at this point in the history
subrepo:
  subdir:   "php-toolkit"
  merged:   "a584f6a"
upstream:
  origin:   "[email protected]:rotdrop/nextcloud-app-toolkit.git"
  branch:   "main"
  commit:   "a584f6a"
git-subrepo:
  version:  "0.4.5"
  origin:   "???"
  commit:   "???"
  • Loading branch information
rotdrop committed Mar 23, 2024
1 parent 0d9f523 commit 5d7773c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
4 changes: 2 additions & 2 deletions php-toolkit/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = [email protected]:rotdrop/nextcloud-app-toolkit.git
branch = main
commit = af05f85b28eb94cfb7257e8a19ae02c55d648b12
parent = 5b2f845f42de565d641651a53c2a538a7965c7e0
commit = a584f6af7d4fa0139ac55e0a5ec3d2dc62ddcd56
parent = 0d9f52304746771bdafa008f1e2ba3a37cb9fe04
method = merge
cmdver = 0.4.5
10 changes: 9 additions & 1 deletion php-toolkit/Traits/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* A collection of reusable traits classes for Nextcloud apps.
*
* @author Claus-Justus Heine <[email protected]>
* @copyright 2022 Claus-Justus Heine
* @copyright 2022, 2024 Claus-Justus Heine
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -39,4 +39,12 @@ class Constants
public const HASH = 'hash';
public const WEB_ASSET_META = self::JS . self::PATH_SEPARATOR . 'asset-meta.json';
public const INFO_FILE = 'appinfo' . self::PATH_SEPARATOR . 'info.xml';

// The following will be moved to the ResponseTrait as soon as >= PHP 8.2 is feasible
public const RENDER_AS_GUEST = TemplateResponse::RENDER_AS_GUEST;
public const RENDER_AS_BLANK = 'blank';
public const RENDER_AS_BASE = TemplateResponse::RENDER_AS_BASE;
public const RENDER_AS_USER = TemplateResponse::RENDER_AS_USER;
public const RENDER_AS_ERROR = TemplateResponse::RENDER_AS_ERROR;
public const RENDER_AS_PUBLIC = TemplateResponse::RENDER_AS_PUBLIC;
}
19 changes: 11 additions & 8 deletions php-toolkit/Traits/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@
*/
trait ResponseTrait
{
protected const RENDER_AS_GUEST = TemplateResponse::RENDER_AS_GUEST;
protected const RENDER_AS_BLANK = 'blank';
protected const RENDER_AS_BASE = TemplateResponse::RENDER_AS_BASE;
protected const RENDER_AS_USER = TemplateResponse::RENDER_AS_USER;
protected const RENDER_AS_ERROR = TemplateResponse::RENDER_AS_ERROR;
protected const RENDER_AS_PUBLIC = TemplateResponse::RENDER_AS_PUBLIC;
// In order to restore PHP 8.1 compatibility do not use constants in traits ...
//
// protected const RENDER_AS_GUEST = TemplateResponse::RENDER_AS_GUEST;
// protected const RENDER_AS_BLANK = 'blank';
// protected const RENDER_AS_BASE = TemplateResponse::RENDER_AS_BASE;
// protected const RENDER_AS_USER = TemplateResponse::RENDER_AS_USER;
// protected const RENDER_AS_ERROR = TemplateResponse::RENDER_AS_ERROR;
// protected const RENDER_AS_PUBLIC = TemplateResponse::RENDER_AS_PUBLIC;

protected const APPNAME_PREFIX = 'app-';
// protected const APPNAME_PREFIX = 'app-';

/** @var IL10N */
protected IL10N $l;
Expand Down Expand Up @@ -87,7 +89,8 @@ protected function templateResponse(
array_merge(
[
'appName' => $appName,
'appNameTag' => self::APPNAME_PREFIX . $appName,
// 'appNameTag' => self::APPNAME_PREFIX . $appName,
'appNameTag' => 'app-' . $appName,
'l10n' => $l10n, // do not conflict with core template $l parameter
],
$params,
Expand Down

0 comments on commit 5d7773c

Please sign in to comment.