Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
cc92d5a2
Unverified
Commit
cc92d5a2
authored
4 years ago
by
Christoph Wurst
Browse files
Options
Downloads
Patches
Plain Diff
Allow unified search results to have attributes
Signed-off-by:
Christoph Wurst
<
christoph@winzerhof-wurst.at
>
parent
fc57f60e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/public/Search/SearchResultEntry.php
+21
-0
21 additions, 0 deletions
lib/public/Search/SearchResultEntry.php
with
21 additions
and
0 deletions
lib/public/Search/SearchResultEntry.php
+
21
−
0
View file @
cc92d5a2
...
@@ -82,6 +82,13 @@ class SearchResultEntry implements JsonSerializable {
...
@@ -82,6 +82,13 @@ class SearchResultEntry implements JsonSerializable {
*/
*/
protected
$rounded
;
protected
$rounded
;
/**
* @var string[]
* @psalm-var array<string, string>
* @since 20.0.0
*/
protected
$attributes
=
[];
/**
/**
* @param string $thumbnailUrl a relative or absolute URL to the thumbnail or icon of the entry
* @param string $thumbnailUrl a relative or absolute URL to the thumbnail or icon of the entry
* @param string $title a main title of the entry
* @param string $title a main title of the entry
...
@@ -106,6 +113,19 @@ class SearchResultEntry implements JsonSerializable {
...
@@ -106,6 +113,19 @@ class SearchResultEntry implements JsonSerializable {
$this
->
rounded
=
$rounded
;
$this
->
rounded
=
$rounded
;
}
}
/**
* Add optional attributes to the result entry, e.g. an ID or some other
* context information that can be read by the client application
*
* @param string $key
* @param string $value
*
* @since 20.0.0
*/
public
function
addAttribute
(
string
$key
,
string
$value
):
void
{
$this
->
attributes
[
$key
]
=
$value
;
}
/**
/**
* @return array
* @return array
*
*
...
@@ -119,6 +139,7 @@ class SearchResultEntry implements JsonSerializable {
...
@@ -119,6 +139,7 @@ class SearchResultEntry implements JsonSerializable {
'resourceUrl'
=>
$this
->
resourceUrl
,
'resourceUrl'
=>
$this
->
resourceUrl
,
'icon'
=>
$this
->
icon
,
'icon'
=>
$this
->
icon
,
'rounded'
=>
$this
->
rounded
,
'rounded'
=>
$this
->
rounded
,
'attributes'
=>
$this
->
attributes
,
];
];
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment