Skip to content

Instantly share code, notes, and snippets.

@rtripault
Created June 8, 2011 09:53
Show Gist options
  • Select an option

  • Save rtripault/1014126 to your computer and use it in GitHub Desktop.

Select an option

Save rtripault/1014126 to your computer and use it in GitHub Desktop.

Revisions

  1. Romain created this gist Jun 8, 2011.
    45 changes: 45 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,45 @@
    <?php
    /**
    * Babel
    *
    * @package babel
    */
    /**
    *
    * Events:
    * OnDocFormPrerender,OnDocFormSave,OnEmptyTrash,OnContextRemove,OnResourceDuplicate
    *
    * @author Jakob Class <jakob.class@class-zec.de>
    *
    * @package babel
    *
    */

    switch ($modx->event->name) {
    case 'OnDocFormPrerender':
    $currentContextKey = $resource->get('context_key');
    if ($currentContextKey != 'newsletter') { return; }
    $output = '';
    $output .= '<div id="babel-box" style="background: red; width: 150px; height: 50px">I AM A TEST</div>';
    $modx->event->output($output);

    /* include CSS */
    /*
    $modx->regClientCSS($babel->config['cssUrl'].'babel.css?v=5');
    $modx->regClientStartupScript($babel->config['jsUrl'].'babel.js?v=3');
    */
    break;

    case 'OnDocFormSave':
    break;

    case 'OnEmptyTrash':
    break;

    case 'OnContextRemove':
    break;

    case 'OnResourceDuplicate':
    break;
    }
    return;