Extension API

Personal tools
From Kryn.cms Wiki - Tutorials, Documentation and How Tos
Jump to: navigation, search

This describe primary the config.json values, where you can define many variables, which manipulates or completes thinks in the kryn.cms administration.

domainProperties

With domainProperties you can add additional fields on a domain. This is usefull if your extensions needs additional informations on a domain where you can later read in your php or template code.

This config item can't manage via the extension-editor.

All ka.fields are possible.

Example:

{
  "version": "0.0.2",
  ....
  "domainProperties": {
    "myExtension": {
       "fieldOne": {
         "label": "Label of FieldOne",
         "type": "file",
       },
       "fieldTwo": {
         "label": "Label of FieldTwo",
         "type": "checkbox",
       }
    }
  }
  ...
}

Read values:

PHP:

 
  class myExtension extends baseModule {
 
     public function myPlugin( $pConfig ){
 
        print "FieldOne: ".kryn::$domain['extproperties']['myExtension']['fieldOne']."<br />";
        print "FieldTwo: ".kryn::$domain['extproperties']['myExtension']['fieldTwo'];
 
     }
  }

Template:

 <div>
   fieldOne: {$_domain.extproperties.myExtension.fieldOne} <br />
   fieldTwo: {$_domain.extproperties.myExtension.fieldTwo}
 </div>


extendConfig

With extendConfig you can manipulate configs from other (installed) extensions.

For example, if you want to add a database table field or add a field to the window-add window of the publication extension, you can use this variable.

{
  "version": "0.0.2",
  ....
  "extendConfig": {
    "theExtensionCode": {
       "db": {
         "aTableFromTheOtherExtension": {
            "myNewField": [
              "varchar", "255", "-", false
            ]
         }
       },
       "admin": {
         "news": {
           "childs": {
             "myNewWindowUnderNews": {
               "title": "Window title",
               "type": "list",
               "class": "myExtension/myNewWindowForPublicationList" // this loads file: inc/modules/myExtension/myNewWindowForPublicationList.class.php
             }
           }
         }
       }
    }
  }
  ...
}