Skip to main content

Sidebar

Intro

Sidebar is a menu, where you will find what is available in the entire template.

Prerequisits

  • CakePHP v4.0 with Asgard setup.
  • You can clone the repo from https://gitlab.com/ascendtis-boilerplates/asgard-v5

Basic

Let's assume that you want to show the tables, which are available in the template. So let's take an example how you do it, check it out below.

create a file at templates/element/vue-components/sidebar.php

Note: Our Sidebar must resides in sidebar.php so that it can easily accessible with `/element/admin`

templates/element/admin/sidebar.php
  <side-bar 
title=" title"
base-url="https://url.com/"
:items="[
{
title: 'title',
children: [
{
title: 'title',
icon: 'iconName',
url: '#'
}
]
},
{
title: 'title',
children: [
{
title: 'title',
icon: 'iconName',
url: '#'
}
]
},
]"
>
</side-bar>

The above code will render Sidebar like this.

Basic DataTable

Props

NameTypeRequiredDescription
titlestringYesTitle of Sidebar Table.
base-urlstringYesBase URL
:itemsarrayYesFields which you want to display in Sidebar.

:items

Items contains title and array of children, which you wanted to display on Sidebar. Look at the example below.

items
  [
{
title: 'title',
children: [
{
title: 'title',
icon: 'iconName',
url: '#'
}
]
},
{
title: 'title',
children: [
{
title: 'title',
icon: 'iconName',
url: '#'
}
]
},
]
NameTypeRequiredDescription
titlestringYes
:childrenarrayNoIf you want array in item's element define it as children.

:children

Children contains single table's details. Look at the example below.

children
  [
{
title: 'title',
icon: 'iconName',
url: '#'
},
{
title: 'title',
icon: 'iconName',
children: [
{
title: 'title',
icon: 'iconName',
url: '#'
},{
title: 'title',
icon: 'iconName',
url: '#'
},
]
},
{
title: 'title',
icon: 'iconName',
url: '#'
}
]

The above code will render like this.

Basic DataTable

NameTypeRequiredDescription
titlestringYes
iconstring
urlstringNoDefine URL for redirection to the page.
:childrenarrayNoIf you want another array in children's element define it as children.