cakephp-2.0 > Debugger :: addFormat()
A AbstractTransport AclBehavior AclComponent AclInterface AclNode AclShell Aco AcoAction ActionsAuthorize ApcEngine ApiShell App AppController AppController AppHelper AppHelper AppModel AppModel AppShell Aro AuthComponent B BadRequestException BakeShell BakeTask BaseAuthenticate BaseAuthorize BasicAuthenticate BasicAuthentication BehaviorCollection C Cache CacheEngine CacheException CacheHelper CacheSession CakeEmail CakeErrorController CakeException CakeLog CakeLogException CakeLogInterface CakePlugin CakeRequest CakeResponse CakeRoute CakeSchema CakeSession CakeSessionException CakeSessionHandlerInterface CakeSocket ClassRegistry CommandListShell Component ComponentCollection ConfigReaderInterface Configure ConfigureException ConnectionManager ConsoleErrorHandler ConsoleException ConsoleInput ConsoleInputArgument ConsoleInputOption ConsoleInputSubcommand ConsoleOptionParser ConsoleOutput ConsoleShell ContainableBehavior Controller ControllerAuthorize ControllerTask CookieComponent CrudAuthorize D DatabaseSession DataSource DbAcl DbAclSchema DbConfigTask DboSource Debugger DebugTransport DigestAuthenticate DigestAuthentication Dispatcher E EmailComponent ErrorHandler ExceptionRenderer ExtractTask F File FileEngine FileLog FixtureTask Folder ForbiddenException FormAuthenticate FormHelper H Helper HelperCollection HelpFormatter HtmlHelper HttpException HttpResponse HttpSocket I I18n I18nModel i18nSchema I18nShell Inflector IniReader InternalErrorException J JqueryEngineHelper JsBaseEngineHelper JsHelper L L10n M MailTransport MediaView MemcacheEngine MethodNotAllowedException MissingActionException MissingBehaviorException MissingComponentException MissingConnectionException MissingControllerException MissingDatabaseException MissingDatasourceConfigException MissingDatasourceException MissingHelperException MissingLayoutException MissingModelException MissingPluginException MissingShellException MissingShellMethodException MissingTableException MissingTaskException MissingTestLoaderException MissingViewException Model ModelBehavior ModelTask MootoolsEngineHelper Multibyte Mysql N NotFoundException NumberHelper O Object ObjectCollection P PagesController PagesController PaginatorComponent PaginatorHelper Permission PhpReader PluginShortRoute PluginTask Postgres PrivateActionException ProjectTask PrototypeEngineHelper R RedirectRoute RequestHandlerComponent Router RouterException RssHelper S Sanitize Scaffold ScaffoldView SchemaShell Security SecurityComponent SessionComponent SessionHelper SessionsSchema Set Shell ShellDispatcher SmtpTransport SocketException Sqlite Sqlserver String T TaskCollection TemplateTask TestsuiteShell TestTask TextHelper ThemeView TimeHelper TranslateBehavior TreeBehavior U UnauthorizedException UpgradeShell V Validation View ViewTask W WincacheEngine X XcacheEngine Xml XmlException

addFormat

line:580 at /lib/Cake/Utility/Debugger.php
Add an output format or update a format in Debugger.

Method

(The) public addFormat ($format, array $strings)

Parameters

ParameterTypeCommentDefault
$format string required Format to use, including 'js' for JavaScript-enhanced HTML, 'html' for straight HTML output, or 'txt' for unformatted text.
$strings array required Template strings, or a callback to be used for the output format.

Return

The

Comment

Add an output format or update a format in Debugger.

`Debugger::addFormat('custom', $data);`

Where $data is an array of strings that use String::insert() variable
replacement. The template vars should be in a `{:id}` style.
An error formatter can have the following keys:

- 'error' - Used for the container for the error message. Gets the following template
variables: `id`, `error`, `code`, `description`, `path`, `line`, `links`, `info`
- 'info' - A combination of `code`, `context` and `trace`. Will be set with
the contents of the other template keys.
- 'trace' - The container for a stack trace. Gets the following template
variables: `trace`
- 'context' - The container element for the context variables.
Gets the following templates: `id`, `context`
- 'links' - An array of HTML links that are used for creating links to other resources.
Typically this is used to create javascript links to open other sections.
Link keys, are: `code`, `context`, `help`. See the js output format for an
example.
- 'traceLine' - Used for creating lines in the stacktrace. Gets the following
template variables: `reference`, `path`, `line`

Alternatively if you want to use a custom callback to do all the formatting, you can use
the callback key, and provide a callable:

`Debugger::addFormat('custom', array('callback' => array($foo, 'outputError'));`

The callback can expect two parameters. The first is an array of all
the error data. The second contains the formatted strings generated using
the other template strings. Keys like `info`, `links`, `code`, `context` and `trace`
will be present depending on the other templates in the format type.

@param string $format Format to use, including 'js' for JavaScript-enhanced HTML, 'html' for
straight HTML output, or 'txt' for unformatted text.
@param array $strings Template strings, or a callback to be used for the output format.
@return The resulting format string set.