lowdefy/packages/docs/operators/_menu.yaml

82 lines
2.2 KiB
YAML

# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/operators.yaml.njk
transformer: templates/operatorsMethodTransformer.js
vars:
pageId: _menu
pageTitle: _menu
filePath: operators/_menu.yaml
env: Client Only
types: |
```
(menuId: string): object
(menuIndex: number): object
(all: boolean): object[]
(arguments: {
value?: string,
index?: number
all?: boolean,
}): object | object[]
```
description: |
The `_menu` operator can be used to access `menu` objects defined in the [`menus`](/lowdefy-schema) section of the Lowdefy configuration.
arguments: |
###### string
The `menuId` of the `menu` to return.
###### number
The index of the `menu` to return.
###### boolean
If the `_media` operator is called with boolean argument `true`, the entire `menus` object is returned.
###### object
- `value: string`: The `menuId` of the `menu` to return.
- `index: number`: The index of the `menu` to return.
- `all: boolean`: If the `_media` operator is called with boolean argument `true`, the entire `menus` object is returned.
examples: |
###### Get the `menus` object:
```yaml
_menu: true
```
```yaml
_menu:
all: true
```
Returns: An array of `menu` objects.
###### Get a `menu` by `id`:
```yaml
_menu: default
```
```yaml
_menu:
value: default
```
Returns: A `menu` object.
###### Get a `menu` by `index`:
```yaml
_menu: 0
```
```yaml
_menu:
value: 0
```
Returns: A `menu` object.