Site:Integration

From Metrixstream
(Difference between revisions)
Jump to: navigation, search
(Created page with "== Integration == Integration into Metrixstream is necessary when developing features outside the core platform. This can be done through a GitHub.com account. Once you have you...")
 
(Backend Contexts)
Line 6: Line 6:
  
 
Backend Contexts are the heart of the site engine. You can create your own Backend Context by simply extending the BackendContext abstract class.
 
Backend Contexts are the heart of the site engine. You can create your own Backend Context by simply extending the BackendContext abstract class.
 +
 +
Make sure your class name ends with "Context" and that the beginning of your class name is the same as the result of getInternalName().
 +
  
 
  class ExampleContext extends BackendContext {
 
  class ExampleContext extends BackendContext {

Revision as of 14:46, 16 May 2012

Integration

Integration into Metrixstream is necessary when developing features outside the core platform. This can be done through a GitHub.com account. Once you have your account setup and repository created, contact support@metrixstream.com, so that we can configure your license so it fetches resources from GitHub.com for your extensions.

Backend Contexts

Backend Contexts are the heart of the site engine. You can create your own Backend Context by simply extending the BackendContext abstract class.

Make sure your class name ends with "Context" and that the beginning of your class name is the same as the result of getInternalName().


class ExampleContext extends BackendContext {

  public function getInternalName() {
    return "example";
  }

  public function getDisplayName() {
    return "My Example Context";
  }

  public function isDependentOnScope($scopeKey) {
    return false;
  }

  public function getConsumableParams() {
    return Array("hello");
  }

  public function filterParam($paramName, $paramValue, $whitelist = Array()) {
    switch($paramName) {
      case "hello": return $paramValue;
    }
    return null;
  }

  public function &execute(ScopeContext &$Scope, PageContext &$Page) {
    $App =& $this->getApplicationContext();
    $Render =& $App->getRenderContext();

    $params = Array(
      "hello" => $this->getParam($Page, "hello", "")
    );

    $out =& $Render->getRenderOutput();
    $out->setCacheable(true);
    $out->getHDF()->set("hello", $params["hello"]);

    return $out;
  }
}
Personal tools