Studio Developer Manual / Version 2301
Table Of Contents
The first section of the CoreMedia Studio's header toolbar contains
user-defined search folders within the 'Favorites' menu. When you click a search folder, the collection view opens up in
search mode showing the results of a predefined query. The user can create custom search
folders via the Save Search
button of the Studio library toolbar in search
mode. Users can also modify existing search folders, change their order, rename them, or
delete them altogether.
As a developer, you can provide a default set of search folders to your first-time users, so that the favorites menu won't appear empty on a user's first login to Studio.
Warning
The configuration option shown below explains solely the default set of search folders that users will see on their first login. When Studio detects that there are no custom search folders defined yet for the user logging in, this default set will be copied to this user's settings - from then on, management of the search folder section is completely up to the user, and your configuration will be ignored. If you want to permanently add buttons (including buttons representing search folders) to the Section 9.10.1, “Adding Buttons to the Header Toolbar” above.
menu or Header toolbar, please refer to
You can add default search folders by using the AddArrayItemsPlugin
on the
FavoritesButton
. Each array item has to include the relevant search
parameters that you want to pass to the library on opening. These parameters are
modularized in terms of the different parts of the collection view in search mode. Thus, each
array item is a nested JavaScript object literal that itself contains possibly multiple
objects for the various parameter parts. These embedded objects can be accessed via unique
keys (see below). In addition, each array item is given a unique name that will also be used
as the display text for the resulting search folder in the favorites toolbar.
By default, the different search parameters of the collection view are divided into the following parts:
The main part (key
_main
), featuring the search parameterssearchText
,contentType
,mode
,view
,folder
,orderBy
, andlimit
.Note that for the
folder
property, it is possible to use both of the following notations:folder: {$Ref: "content/9"}
(Rest URI path)folder: {path: "/Sites/Media"}
(content repository path)
The status filter (key
status
), featuring the search parametersinProduction
,editedByMe
,editedByOthers
,notEdited
,approved
,published
anddeleted
.The last edited filter (key
lastEdited
), featuring the search parameterlastEditedBy
.
Further possible parameters may arise due to plugged in additional filters (see
Section 9.15.5, “Adding Search Filters”) where each of them makes up its own part of search
parameters. In the source code example below, a default search folder is plugged in that shows
all documents under the content repository path folder /Sites/Media
that
were last edited by the user. You can see that the array item is composed of two of the three
parts listed above and has been given a name.
import AddArrayItemsPlugin from "@coremedia/studio-client.ext.ui-components/plugins/AddArrayItemsPlugin"; import Config from "@jangaroo/runtime/Config"; import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; import FavoritesButton from "@coremedia/studio-client.main.editor-components/sdk/desktop/maintoolbar/FavoritesButton"; import StudioPlugin from "@coremedia/studio-client.main.editor-components/configuration/StudioPlugin"; interface MyStudioPluginConfig extends Config<MyStudioPluginBase> { } class MyStudioPlugin extends StudioPlugin { constructor(config: Config<MyStudioPlugin> = null) { super((() => { return ConfigUtils.apply(Config(MyStudioPlugin, { rules: [ Config(FavoritesButton, { plugins: [ new AddArrayItemsPlugin({ arrayProperty: "defaultItems", items: [ { _main: { contentType: "Document_", folder: {path: "/Sites/Media"}, mode: "search", view: "list", limit: 50 }, lastEdited: {lastEditedBy: "me"}, _name: "Last edited" }, ], }), ], }), ], }), config); })()); } } export default MyStudioPlugin;
Example 9.36. Adding a custom search folder
If in doubt about the actual format for a default search folder entry, you can always customize a search manually in CoreMedia Studio, save it and have a look at the user's preferences where they get saved.