Skip to content

pbMenu

For displaying resources considering multilingualism. See more in languages.

Parameters

ParameterDefaultDescription
sortbymenuindexSorting field
sortdirascSort order
limit0Number of records displayed. 0 - means without limits.
offset0Skipping values from the start
level10Resource search depth
fileElements0Use file chunks
idID of the block or table. If specified, the where parameter is ignored.
context_keycurrent resourceBy default, the current resource context is used.
resource_idcurrent resourceBy default, the ID of the current resource is used.
collection_id0ID of the collection. Used for tables.
where[]Array of additional parameters for filtering results.
  • Default where
php
[
    'parent' => 0,
    'context_key' => 'web', // current resource
    'hidemenu' => 0,
    'deleted' => 0,
]

Examples

php
{set $items = 'pbMenu'|snippet: [
    'level' => 2,
    'where' => [
        'parent' => $menu.id,
        'context_key' => $_modx->context.key
    ]
]}
{foreach ($items as $item)}
    // ...
{/foreach}
php
{set $items = 'pbMenu'|snippet: [
    'level' => 1,
    'sortby' => 'publishedon',
    'sortdir' => 'desc',
    'limit' => 10
    'where' => [
        'parent' => 19,
        'context_key' => $_modx->context.key,
        'published' => 1,
        'id:!=' => $_modx->resource.id
    ]
]}
{foreach ($items as $item)}
    // ...
{/foreach}

© PageBlocks 2019-present