charcoal / admin
The Charcoal Administration Dashboard
Installs: 7
Dependents: 3
Suggesters: 1
Security: 0
Stars: 0
Watchers: 2
Forks: 0
pkg:composer/charcoal/admin
Requires
- php: ^7.4 || ^8.0
- barryvdh/elfinder-flysystem-driver: ^0.3
- charcoal/app: ^5.0
- charcoal/cache: ^5.0
- charcoal/cms: ^5.0
- charcoal/core: ^5.0
- charcoal/email: ^5.0
- charcoal/object: ^5.0
- charcoal/translator: ^5.0
- charcoal/ui: ^5.0
- charcoal/user: ^5.0
- guzzlehttp/guzzle: ^6.0 || ^7.0
- kriswallsmith/assetic: ^1.4
- laminas/laminas-permissions-acl: ^2.8
- mcaskill/php-html-build-attributes: ^1.0
- psr/cache: ^1.0
- psr/http-message: ^1.0
- psr/log: ^1.0
- studio-42/elfinder: 2.1.64
Requires (Dev)
- league/csv: ^9.5
- mockery/mockery: ^1.0
- mustache/mustache: ^2.11
- php-coveralls/php-coveralls: ^2.2
- phpunit/phpunit: ^9.5
- seld/jsonlint: ^1.9
- squizlabs/php_codesniffer: ^3.5
- tedivm/stash: ~0.16
Suggests
- fabpot/goutte: To use the various crawler-based tools.
- league/csv: To use the exporter (to CSV).
Replaces
- dev-main / 5.x-dev
- v5.0.0
- v4.1.0
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.2
- v4.0.1
- v4.0.0
- v3.1.8
- v3.1.7
- v3.1.6
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.16
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.2
- 0.30.3
- 0.30.2
- 0.30.1
- 0.30.0
- 0.29.1
- 0.29.0.1
- 0.29.0
- 0.28.2
- 0.28.1
- 0.28.0.1
- 0.28.0
- 0.27.2
- 0.27.1
- 0.27.0
- 0.26.2
- 0.26.1
- 0.26.0
- 0.25.1
- 0.25.0
- 0.24.6
- 0.24.5
- 0.24.4
- 0.24.3.1
- 0.24.3
- 0.24.2.1
- 0.24.2
- 0.24.1.1
- 0.24.1
- 0.24.0
- 0.23.10.1
- 0.23.10
- 0.23.9.1
- 0.23.9
- 0.23.8
- 0.23.7
- 0.23.6
- 0.23.5.3
- 0.23.5.2
- 0.23.5.1
- 0.23.5
- 0.23.4
- 0.23.3
- 0.23.2
- 0.23.1
- 0.23.0
- 0.22.3.1
- 0.22.3
- 0.22.2
- 0.22.1
- 0.22.0.13
- 0.22.0.12
- 0.22.0.11
- 0.22.0.10
- 0.22.0.9
- 0.22.0.8
- 0.22.0.7
- 0.22.0.6
- 0.22.0.5
- 0.22.0.4
- 0.22.0.3
- 0.22.0.2
- 0.22.0.1
- 0.22.0
- 0.21.7.1
- 0.21.7
- 0.21.6
- 0.21.5
- 0.21.4.1
- 0.21.4
- 0.21.3
- 0.21.2
- 0.21.1
- 0.21.0
- 0.20.0
- 0.19.0.1
- 0.19.0
- 0.18.0
- 0.17.3.1
- 0.17.3
- 0.17.2.6
- 0.17.2.5
- 0.17.2.4
- 0.17.2.3
- 0.17.2.2
- 0.17.2.1
- 0.17.2
- 0.17.1
- 0.17.0
- 0.16.7
- 0.16.6
- 0.16.5
- 0.16.4
- 0.16.3
- 0.16.2
- 0.16.1
- 0.16.0.1
- 0.16.0
- 0.15.13
- 0.15.12
- 0.15.11
- 0.15.10
- 0.15.9
- 0.15.8
- 0.15.7
- 0.15.6
- 0.15.5
- 0.15.4.1
- 0.15.4
- 0.15.3
- 0.15.2
- 0.15.1.1
- 0.15.1
- 0.15.0
- 0.14.2
- 0.14.1.1
- 0.14.1
- 0.14.0.1
- 0.14.0
- 0.13.21
- 0.13.20
- 0.13.19
- 0.13.18
- 0.13.17
- 0.13.16
- 0.13.15
- 0.13.14
- 0.13.13
- 0.13.12.1
- 0.13.12
- 0.13.11.2
- 0.13.11.1
- 0.13.11
- 0.13.10
- 0.13.9
- 0.13.8.2
- 0.13.8.1
- 0.13.8
- 0.13.7.8
- 0.13.7.7
- 0.13.7.6
- 0.13.7.5
- 0.13.7.4
-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 0.5.6
- 0.5.5
- 0.5.4.8
- 0.5.4.7
- 0.5.4.6
- 0.5.4.5
- 0.5.4.4
- 0.5.4.3
- 0.5.4.2
- 0.5.4.1
- 0.5.4
- 0.5.3
- 0.5.2.2
- 0.5.2.1
- 0.5.2
- 0.5.1.1
- 0.5.1
- 0.5.0
- 0.4.3
- 0.4.2.3
- 0.4.2.2
- 0.4.2.1
- 0.4.2
- 0.4.1
- 0.4
- 0.3.10
- 0.3.9
- 0.3.8
- 0.3.7.1
- 0.3.7
- 0.3.6.1
- 0.3.6
- 0.3.5.7
- 0.3.5.6
- 0.3.5.5
- 0.3.5.4
- 0.3.5.3
- 0.3.5.2
- 0.3.5.1
- 0.3.5
- 0.3.4
- 0.3.3.1
- 0.3.3
- 0.3.2.1
- 0.3.2
- 0.3.1
- 0.3.0.1
- 0.3
- 0.2.9
- 0.2.8.1
- 0.2.8
- 0.2.7.1
- 0.2.7
- 0.2.6.1
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1.1
- 0.2.1
- 0.2
- 0.1.3.1
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1
- dev-develop
- dev-xav/quick-form-lang-tab
- dev-dependabot/npm_and_yarn/grunt-1.5.3
- dev-feature/advanced-search
- dev-joel/test-grid-stack
- dev-joel/allow-object-form-actions
- dev-feature/camelizePropertiesAndUseArrayAccess
- dev-mcaskill-patch-form-properties
- dev-mcaskill-patch-form-sidebars
- dev-acl-manager-refactor
- dev-release/0.16
- dev-joel/property-condional-logic-parser
- dev-cdn-cache-purge
This package is auto-updated.
Last update: 2025-10-13 18:47:46 UTC
README
The Admin package provides a customizable administration panel to manage data for Web applications and APIs.
Installation
composer require charcoal/admin
Overview
Core concepts
The charcoal admin control panel is:
- Additional
adminmetadata on charcoal objects and models, which controls automatically how they can be customized in the backend. - A user / authentication system, which uses ACL for permissions.
- A customizable 2-level menu, which builds custom backend for every install.
- Dashboards and widgets. With some prebuilt functionalities for:
- Listing collection of objects (
admin/object/collection), customizable from the object's admin metadata. - Creating and editing objects (
admin/object/edit), customizable from the objects's admin metadata.
- Listing collection of objects (
- Set of scripts to manage objects and the backend from the CLI.
What's inside this module?
Like all Charcoal projects / modules, the main components are:
- Autoloader
- PSR-4, Provided by Composer.
- Config
- As JSON or PHP files in the config/ directory.
- Front Controller
- The admin front controller is handled in the
\Charcoal\Admin\Moduleclass.
- The admin front controller is handled in the
- Objects
- Typically into
\Charcoal\Object\Contentand\Charcoal\Object\UserData - Extends
\Charcoal\Model\AbstractModel, which implements the following interface:\Charcoal\Model\ModelInterface\Charcoal\Core\IndexableInterface\Charcoal\Metadata\DescribableInterface\Charcoal\Source\StorableInterface\Charcoal\Validator\ValidatableInterface\Charcaol\View\ViewableInterface
- PHP Models in
src/Charcoal/Boilerplate/ - JSON metadata in
metadata/charcoal/boilerplate/
- Typically into
- Templates
- Templates are specialized Model which acts as View / Controller
- Split in
Templates,Widgets,PropertyDisplay, andPropertyInput - PHP Models in
src/Charcoal/Boilerplate/Template/ - Mustache views (templates) in
templates/boilerplate/ - Optionnally, templates metadata in
metdata/boilerplate/template/
- Actions
- Actions handle input and provide a response to a request
- They create the Admin REST API.
- The PHP classes in
src/Charcoal/Boilerplate/Action
- Assets
- Assets are files required to be on the webserver root
- Scripts, in
src/scripts/and compiled inwww/assets/scripts/ - Styles , with SASS in
src/styles/and compiled CSS inwww/assets/styles/ - Images, in
www/assets/images/
Users
Authentication is done through the Charcoal\Admin\User class. It reuses the authentication, authorization and user model provided by charcoal/user.
UI Elements
User-Interface elements in the Admin package (or any other Charcoal modules, in fact), are composed of:
- A PHP Controller, in src/Charcoal/Admin/{{type}}/{{ident}}
- A mustache templates, in templates/charcoal/admin/{{type}}/{{ident}}
- Optional additional metadata, in metadata/charcoal/admin/{{type}}/{{ident}}
There are 3 main types of UI Elements: Templates, Widgets and Property Inputs.
Templates
See the src/Charcoal/Admin/Templates directory for the list of available Templates in this module. Note that the template views themselves (the mustache templates) are located in templates/charcoal/admin/template/ directory.
In addition to being standard Template Models (controllers), all Template of the admin module also implements the \Charcoal\Admin\Template class.
This class provides additional controls to all templates:
has_feedbacksandfeedbackstitle,subtitle,show_titleandshow_subtitleauth_required- Protected, true by default. Set to false for templates that do not require an authenticated admin user.
Widgets
The following base widgets are available to build the various admin templates:
DashboardFeedbacksFormFormGroupFormPropertyGraph/BarGraph/LineGraph/PieLayoutMapWidgetTableTableProperty
Property Inputs
Similar to other UI elements, Inputs are specialized widgets that are meant to display a "form element" for a Property. Properties models are defined in the charcoal/property package.
The following property inputs are available to build forms in the admin module:
Audio- A special HTML5 widget to record an audio file from the microphone.
CheckboxDateTimePicker- A date-time picker widget.
- Requires the ``
File- A default
<input type="file">that can be used as a base for all File properties.
- A default
Image- A specialized file input meant for uploading / previewing images.
MapWidget- A specialized widget to edit a point on a map.
- Requires google-map.
NumberRadioReadonlySelectSwitch- A specialized Checkbox meant to be displayed as an on/off switch.
Text- A default
<input type="text">that can be used with most property types.
- A default
Textarea- A default
<textarea>editor that can be used with most textual property types.
- A default
Tinymce- A specialized Textarea wysiwyg editor.
- Requires the
tinymcejavascript library.
Selectize- A specialized hybrid between a Textbox and Select jQuery based.
- Highly customizable.
- Requires the
selectizejavascript library.
Selectize inputs options
| Name | Type | Description | Default | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| choice_obj_map | array | Custom mapping between an object properties or callable and the selectize. It is discouraged to use renderable data. choice_obj_map must be a mapping with existing object properties.
|
{
"value" : "id",
"label": "name:title:label:id"
} |
||||||||
| form_ident | string|array | Allow to define a specific object form ident when creating or updating an object. You can specify different form idents for create and update by using the "create" and "update" array keys | "quick" |
||||||||
| selectize_templates | string|array | Allow custom rendering for selectize [item] and [option]. Overrule choice_obj_map[label]. Priotize using this for rendering custom labels instead of choice_obj_map. The value can either be a string with render tags, a path to a custom template or even an array mapping to handle "item", "option", "controller" and "data" individually.
|
{} |
||||||||
| allow_create | bool | Display a 'create' button which triggers the selectize create functionality. | false |
||||||||
| allow_update | bool | Display an 'update' button which triggers the selectize update functionality. Applies to currently selected element. | false |
||||||||
| allow_clipboard_copy | bool | Display a 'copy' button which allows the user to easilly copy all selected elements at once. | false |
||||||||
| deferred | bool | Allow the select to load the dropdown "options" with an ajax request instead of on load. This can speed up the page load when there is a lot of "options". | false |
||||||||
| selectize_options | array | Defines the selectize js options. See the Selectize.js doc. Some usefull ones are :
|
{
persist: true,
preload: "focus",
openOnFocus: true,
labelField: "label",
searchField: [
"value",
"label"
]
}
|
Usage example:
"categories": { "type": "object", "input_type": "charcoal/admin/property/input/selectize", "multiple": true, "deferred": true, "obj_type": "cms/object/news-category", "pattern": "title", "choice_obj_map": { "value": "ident", "label": "{{customLabelFunction}} - {{someAdditionalInfo }}" }, "selectize_templates": { "item": "project/selectize/custom-item-template", "option": "project/selectize/custom-option-template", "controller": "project/selectize/custom-template" }, "selectize_options": { "plugins": { "drag_drop": {}, "btn_remove": {}, "btn_update": {} } }, "form_ident": { "create": "quick.create", "update": "quick.update" } }
Selectize templates examples:
"selectize_templates": { "item": "{{customLabelFunction}} - {{someAdditionalInfo }}", "option": "{{customLabelFunction}} - {{someAdditionalInfo }}" }, --- "selectize_templates": "{{customLabelFunction}} - {{someAdditionalInfo }}", --- "selectize_templates": "project/selectize/custom-template", --- "selectize_templates": { "item": "project/selectize/custom-item-template", "option": "project/selectize/custom-option-template", "controller": "project/selectize/custom-template", "data": { "category": "{{selectedCategory}}" } },
Actions
See the src/Charcoal/Admin/Action/ directory for the list of availables Actions in this module.
In addition to being standard Action Models (controllers), all Action of the admin module also implements the \Charcoal\Admin\Action class.
Post Actions
admin/loginadmin/object/deleteadmin/object/saveadmin/object/updateadmin/widget/loadadmin/widget/table/inlineadmin/widget/table/inlinue-multi
CLI Actions
See the src/Charcoal/Admin/Action/Cli/ directory for the list of all available Cli Actions in this module.
CLI Actions are specialized action meant to be run, interactively, from the Command Line Interface. With the Cli Actions in this module, it becomes quick and easy to manage a Charcoal project directly from a Terminal.
admin/objects- List the object of a certain
obj-type.
- List the object of a certain
admin/object/create- Create a new object (and save it to storage) of a certain
obj-typeaccording to its metadata's properties.
- Create a new object (and save it to storage) of a certain
admin/object/table/alter- Alter the existing database table of
obj-typeaccording to its metadata's properties.
- Alter the existing database table of
admin/object/table/create- Create the database table for
obj-typeaccording to its metadata's properties.
- Create the database table for
admin/user/create