farook-walker/manager

App manager for beaver

This package's canonical repository appears to be gone and the package has been frozen as a result.

dev-dev 2020-11-05 12:55 UTC

This package is auto-updated.

Last update: 2021-01-05 13:23:28 UTC


README

Beaver web manager - web applications manager build on top of Beaver Framework

Contents

  • Architecture
    • App
    • Pages
    • Categories
    • Posts
    • Tags
    • Comments
    • Forms
    • Menus
    • Themes
    • Templates
    • Media
    • Taxonomy
    • Users
    • Roles
    • Resources
    • Mailer
    • APIs
    • Translations
    • File Explorer
    • E-Commerce
      • Store
      • Product
      • Order

App

Pages

Categories

Get categories list in templates
to make a hierarchical/flat list from Categories (Categories model will be used) use following function

$this->category($slug, $options = [
    'order' => ['field','asc|desc'], // sort by field
    'hierarchy' => ['key' => 'field','value' => 'field', 'flat' => 'true|false'] // set key => value for hierarchical list, flat = false - no hierarchy
]);

Example:

echo $this->category('products',[
    'sort' => ['title','asc'],
    'hierarchy' => ['key' => 'id','value' => 'title', 'flat' => 0]
])

Create list in templates
to make html list out of array

$this->list(
    $source, //source array - data to make list from
    $options = [
        'beforeList' => '', // some text or html before list item
        'beforeRootList' => '', // some text or html before root list item
        'afterList' => '', // some text or html after list item
        'beforeSub' => '', // some text or html before child list
        'afterSub' => '', // some text or html after child list
        'flat' => '', // flat list or not
    ],
    $childfield // a key in array for child arrays; default - 'children'
);

Example:

echo $this->list(
    [
        [
            'id' => 1,
            'title' => 'First title'
        ],
        [
            'id' => 2,
            'title' => 'Second title',
            'children' => [
                [
                    'id' => 3,
                    'title' => 'Third title'
                ]
            ]
        ]
    ], 
    [
        'beforeList' => '<li>',
        'beforeRootList' => '<li>',
        'afterList' => '</li>',
        'beforeSub' => '<ul>',
        'afterSub' => '</ul>',
        'flat' => false,
    ],
    'children'
);