Properties

$components

$components : array

The registered \Dewdrop\Admin\ComponentAbstract objects.

Type

array

$session

$session : \Dewdrop\Session

A Dewdrop Session object useful for get flash messenger messages, etc.

Type

\Dewdrop\Session

$coreClientSideDependencies

$coreClientSideDependencies : array

The core client-side dependencies we expect to be loaded in the admin.

These should all be sent through the bowerUrl() view helper so that their paths point to the bower_components folder for the current environment.

Type

array

$title

$title : string

The title for the admin area. Typically your application's name, the name of the client's company, etc.

Type

string

$application

$application : \Silex\Application

The \Silex\Application object.

Type

\Silex\Application

$layoutPath

$layoutPath : string

The path to the layout view script.

Type

string

$layoutName

$layoutName : string

The file name of the view script used when rendering the layout.

Type

string

$layout

$layout : \Dewdrop\View\View

The View object used to render the layout script.

Type

\Dewdrop\View\View

Methods

prependClientSideDependency()

prependClientSideDependency(string  $type, string  $name, string  $path) : $this

Prepend a client-side dependency you'd like to use throughout the admin environment.

Parameters

string $type

Either "css" or "js".

string $name

An identifier for the dependency.

string $path

The path (in your bower_components folder) to the dependency.

Returns

$this

appendClientSideDependency()

appendClientSideDependency(string  $type, string  $name, string  $path) : $this

Append a client-side dependency you'd like to use throughout the admin environment.

Parameters

string $type

Either "css" or "js".

string $name

An identifier for the dependency.

string $path

The path (in your bower_components folder) to the dependency.

Returns

$this

addClientSideDependencyAfterKey()

addClientSideDependencyAfterKey(string  $type, string  $name, string  $path, string  $key) : $this

Add a client-side dependency you'd like to use throughout the admin environment.

Parameters

string $type

Either "css" or "js".

string $name

An identifier for the dependency.

string $path

The path (in your bower_components folder) to the dependency.

string $key

The key of the value you want to put a dependency after.

Returns

$this

inflectComponentName()

inflectComponentName(string  $name) : string

Inflect a component name for use in URLs and routes.

Parameters

string $name

Returns

string

setSession()

setSession(\Dewdrop\Session  $session) : $this

Inject a Session object. If you don't provide one, we'll locate it with Pimple, but it's useful to inject during testing.

Parameters

\Dewdrop\Session $session

Returns

$this

setActiveComponent()

setActiveComponent(\Dewdrop\Admin\Component\ComponentInterface  $component) : $this

Set a reference to the active component.

Parameters

\Dewdrop\Admin\Component\ComponentInterface $component

Returns

$this

registerComponentsInPath()

registerComponentsInPath(string  $path = null) : \Dewdrop\Admin\Env\EnvAbstract

Look for and register all admin components in the given path. If no path is provided, the \Dewdrop\Paths->getAdmin() method will be used to find the default admin path for the application.

If no path is given, we'll use the getAdmin() method from \Dewdrop\Paths.

Parameters

string $path

Returns

\Dewdrop\Admin\Env\EnvAbstract

registerComponentFolder()

registerComponentFolder(string  $folder, string  $classPrefix = '\Admin\\') : \Dewdrop\Admin\Env\EnvAbstract

Register the single admin component located in the supplied path. This can be useful if you want to register individual components that are outside your normal folder for admin components. For example, if you've got some reuseable admin components in a library, or Dewdrop itself, you could register them with this method.

Parameters

string $folder
string $classPrefix

Returns

\Dewdrop\Admin\Env\EnvAbstract

assembleQueryString()

assembleQueryString(array  $params, string  $separator) : string

Assemble the remainder of a URL query string.

Parameters

array $params
string $separator

Returns

string

__construct()

__construct(\Silex\Application  $application) 

Provide a \Silex\Application object that can be used to retrieve resources, register routes, etc.

Parameters

\Silex\Application $application

getApplication()

getApplication() : \Silex\Application

Get the \Silex\Application used by the admin shell.

Returns

\Silex\Application

setTitle()

setTitle(string  $title) : \Dewdrop\Admin\Env\Silex

Set the title of this admin area. Will be displayed in the main nav, etc.

Parameters

string $title

Returns

\Dewdrop\Admin\Env\Silex

getTitle()

getTitle() : string

Get the title for this admin environment.

Returns

string

initComponent()

initComponent(\Dewdrop\Admin\Component\ComponentInterface  $component) 

Initialize the provided component by setting up routes for it in Silex.

Parameters

\Dewdrop\Admin\Component\ComponentInterface $component

setLayoutPath()

setLayoutPath(  $layoutPath) : $this

Set the path where the layout view script can be found.

Parameters

$layoutPath

Returns

$this

setLayoutName()

setLayoutName(  $layoutName) : $this

Set the file name of the layout view script.

Parameters

$layoutName

string

Returns

$this

getLayout()

getLayout() : \Dewdrop\View\View

Get the View object used to render the layout. Allows you to add project-specific CSS or JS and call other view helpers as needed.

Returns

\Dewdrop\View\View

renderLayout()

renderLayout(string  $content, \Zend\View\Helper\HeadScript  $headScript = null, \Zend\View\Helper\HeadLink  $headLink = null) : string

Render the admin shell's layout, placing the supplied content in the appropriate area of the HTML.

Parameters

string $content
\Zend\View\Helper\HeadScript $headScript
\Zend\View\Helper\HeadLink $headLink

Returns

string

url()

url(\Dewdrop\Admin\Component\ComponentInterface  $component, string  $page, array  $params = array()) : string

Generate a URL for the provided page and params that will match the Silex routes set up by this class.

Parameters

\Dewdrop\Admin\Component\ComponentInterface $component
string $page
array $params

Returns

string

redirect()

redirect(string  $url) : \Symfony\Component\HttpFoundation\RedirectResponse

Redirect to the provided URL using Silex.

Parameters

string $url

Returns

\Symfony\Component\HttpFoundation\RedirectResponse

getSortedComponentsForMenu()

getSortedComponentsForMenu() : array

Build an array of components sorted by the menu position property defined in each component, falling back to the component titles if no position is set.

Returns

array

validateClientSideDependencyType()

validateClientSideDependencyType(string  $type) 

Validate that a type is either "css" or "js".

Parameters

string $type

Either "css" or "js".