Skip to content

En dev config yaml ref

semuel edited this page Jul 10, 2012 · 11 revisions

The (in)Complete Reference for config.yaml

# General
name: Action Streams
id: ActionStreams
key: ActionStreams
author_link: http://www.movabletype.org/
author_name: Six Apart
description: <MT_TRANS phrase="Manages authors' accounts and actions on sites elsewhere around the web">
version: 2.33
plugin_link: http://www.movabletype.org/
l10n_class: ActionStreams::L10N
doc_link: http://www.movabletype.org/plugin/docs

Plugin Localization

# configuration directive - installation-depended variables. 
# such as: file paths, IP addresses, file names and so one
config_settings:
  MyLogPath:
    default: /var/log/mt/errors.log
    path: 1

Configuration Directives

# Database
# increase schema_version every time you change the DB - it will trigger install.
schema_version: 17
# adding objects to MT, but can also add properties to existing objects
object_types:
  # in this case, "profileevent" is the model name, and "ActionStreams::Event" is the Perl class
  profileevent: ActionStreams::Event
  # adding meta-data to the entry object:
  entry:
    moredata_entry: text meta

Creating your own Objects

# Tags
# This category add tags to the static publishing only. The PHP side have a different system
tags:
  function:
    TemplateCallback: $TemplateCallback::TemplateCallback::Tags::template_callback
  block:
    SetTemplateCallback: $TemplateCallback::TemplateCallback::Tags::set_template_callback
  modifier:
    mymod: $TemplateCallback::TemplateCallback::Tags::modifier

Function tags, Block Tags, Conditional Tags, Modifiers

# Plugin Configuration
# these templates will be displayed in the plugin screen, in blog and system context
blog_config_template: blog_config_template.tmpl
# other option
blog_config_template: 
   code: $Plugin::Module::Handler
system_config_template: sys_config_template.tmpl
settings:
  rebuild_for_action_stream_events:
    Default: 0
    Scope: blog
  do_auto_expire_events:
    Default: 0
    Scope: system

Plugin Configuration

# Global callbacks
callbacks:
  MT::Entry::post_save: $MoreData::MoreData::Plugin::cms_post_save_entry
  MT::Page::post_save: 
    handler: $MoreData::MoreData::Plugin::cms_post_save_page
    priority: 10

Callbacks and hooks

# Applications
# This will be run before the app started
init_app: $ActionStreams::ActionStreams::Init::init_app
# under applications we put application-specific keys
# Also look at MT::PSGI for information about defining new applications
applications:
  cms:
    methods:
      # shortest way: a method and the handler
      list_profileevent: $ActionStreams::ActionStreams::Plugin::list_profileevent
      # full options
      other_profiles:
        code: $ActionStreams::ActionStreams::Plugin::other_profiles
        # setting this to zero will let users call this even if not logged-in
        requires_login: 0
        # disable direct requests to this method. If not logged-in user is trying
        # to call it, he will redirect to a clean login page, and then to the dashboard.
        no_direct: 1
        # if the method returns error, the error will be returned as JSON and not HTML
        app_mode: JSON
        # disable a method in certain conditions. kind of silly.
        condition: sub { my $app = shift; return $app->param('dialog'); }
    callbacks:
      # callbacks here will be called only by the CMS app. 
      # this is generally equal to adding MT::App::CMS before the name of the callback
      cms_pre_save.entry: $MoreData::MoreData::Plugin::cms_post_save_entry
    menus:
      # adding new menus to the CMS. you can also add sub-menus
      new_menu:
        label: New Menu
        order: 1000

Creating a new Application, Add a menu to the CMS

# Periodic tasks
tasks:
  UpdateEvents:
    frequency: 1800
    label: Poll for new events
    code: $ActionStreams::ActionStreams::Plugin::update_events

Adding Scheduled Tasks

For the Listing Framework please see the documentation pages

If value looks like a YAML file name (something.yaml) it is assumed that it points to such a file, that is a "sub-file" of the config.yaml

Clone this wiki locally