



  

AdminProject 1.0 documentation

 [AdminProject](index.html#document-index) 

 latest

 

* [1. Installation](index.html#document-getting_started/installation)

* [2. Creating an admin service](index.html#document-getting_started/creating_admin)

* [3. Layout Configuration](index.html#document-configuration/layout)

[AdminProject](index.html#document-index)

* [Docs](index.html#document-index) »

* AdminProject 1.0 documentation

* [Edit on GitHub](https://github.com/admin-project/admin-bundle/blob/master/Resources/doc/index.rst)

---

AdminProject Admin Bundle[¶](#adminproject-admin-bundle "Permalink to this headline")

=====================================================================================

Getting Started[¶](#getting-started "Permalink to this headline")

-----------------------------------------------------------------

### Installation[¶](#installation "Permalink to this headline")

#### Download the Bundle[¶](#download-the-bundle "Permalink to this headline")

Open a command console, enter your project directory and execute the

following command to download the latest stable version of this bundle:

```

$ composer require admin-project/admin-bundle

```

#### Enable the Bundle[¶](#enable-the-bundle "Permalink to this headline")

```

// app/AppKernel.php

// ...

class AppKernel extends Kernel

{

 public function registerBundles()

 {

 $bundles = array(

 // ...

 new Knp\Bundle\MenuBundle\KnpMenuBundle(),

 new AdminProject\AdminBundle\AdminProjectAdminBundle(),

 );

 // ...

 }

 // ...

}

```

#### Configure the Installed Bundles[¶](#configure-the-installed-bundles "Permalink to this headline")

```

# app/config/config.yml

admin\_bundle:

```

#### Import Routing Configuration[¶](#import-routing-configuration "Permalink to this headline")

```

# app/config/routing.yml

admin\_project\_admin:

    resource: "@AdminProjectAdminBundle/Resources/config/routing.yml"

    prefix:   /admin/

```

#### Enable the translator[¶](#enable-the-translator "Permalink to this headline")

```

# app/config/config.yml

translator:      { fallbacks: ["%locale%"] }

```

### Creating an admin service[¶](#creating-an-admin-service "Permalink to this headline")

#### Create an admin class[¶](#create-an-admin-class "Permalink to this headline")

The easist way to start with is a new class extending from `\AdminProject\AdminBundle\Admin\AbstractAdmin`:

```

<?php

namespace AppBundle\Admin;

class ProductAdmin extends AbstractAdmin

{

}

```

#### Register your admin class[¶](#register-your-admin-class "Permalink to this headline")

Admin classes are registered by service tags. You must now create a service and tag it with `adminproject.adminservice`:

```

# app/config/services.yml

services:

  product.admin:

    class: AppBundle\Admin\ProductAdmin

    tags:

      - { name: adminproject.adminservice }

```

#### Create a group[¶](#create-a-group "Permalink to this headline")

Admin Classes are always displayed by groups. A admin class can not be standalone. Lets create a new group:

```

# app/config/config.yml

admin\_project\_admin:

  groups:

    group1:

      icon: cog

      label: base

      translation\_domain: my\_translation\_domain

    group2:

      icon: info

      label: info\_label

      translation\_domain: my\_other\_translation\_domain

```

Now you can assign the group within the service configuration of your admin class:

```

# app/config/services.yml

services:

  product.admin:

    class: AppBundle\Admin\ProductAdmin

    tags:

      - { name: adminproject.adminservice, group: group1 }

```

If you want to assign this class to multiple groups:

```

- { name: adminproject.adminservice, group: group1 }

- { name: adminproject.adminservice, group: group2 }

```

You can also specify the translation domain or label in service configuration:

```

- { name: adminproject.adminservice, group: group1, label: "The translation label" }

- { name: adminproject.adminservice, group: group2, translation\_domain: "the\_custom\_translation\_domain" }

```

### Layout Configuration[¶](#layout-configuration "Permalink to this headline")

#### search[¶](#search "Permalink to this headline")

Defines if the search bar should be displayed

#### userpanel[¶](#userpanel "Permalink to this headline")

Defines if the userpanel in lefthand navigation should be displayed

#### skin[¶](#skin "Permalink to this headline")

Following skins are available:

* black

* black-light

* blue

* blue-light

* green

* green-light

* purple

* purple-light

* red

* red-light

* yellow

* yellow-light

#### Full[¶](#full "Permalink to this headline")

```

admin\_project\_admin:

  layout:

    search: false

    userpanel: false

    skin: red

```

Contributing[¶](#contributing "Permalink to this headline")

-----------------------------------------------------------

Fork this repository

clone it

```

make lint

make test

make docs

```

create the pull request

