Created
January 17, 2017 23:17
-
-
Save cleggypdc/421ebaac7f04baffaad57ed58f2289bd to your computer and use it in GitHub Desktop.
Pimcore Custom Field example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//place me in /plugins/MyPlugin/lib/HiLifeAdminTheme/Plugin.php | |
namespace MyPlugin; | |
use Pimcore\API\Plugin as PluginLib; | |
class Plugin extends PluginLib\AbstractPlugin implements PluginLib\PluginInterface | |
{ | |
public static function install() | |
{ | |
// implement your own logic here | |
return true; | |
} | |
public static function uninstall() | |
{ | |
// implement your own logic here | |
return true; | |
} | |
public static function isInstalled() | |
{ | |
// implement your own logic here | |
return true; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//place me in /plugins/MyPlugin/lib/Pimcore/Model/Object/ClassDefinition/Data/Inputnolabel.php | |
namespace Pimcore\Model\Object\ClassDefinition\Data; | |
use Pimcore\Model; | |
class Inputnolabel extends Model\Object\ClassDefinition\Data\Input { | |
/** | |
* Static type of this element | |
* | |
* @var string | |
*/ | |
public $fieldtype = "inputnolabel"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<zend-config xmlns:zf="http://framework.zend.com/xml/zend-config-xml/1.0/"> | |
<plugin> | |
<!-- place me in /plugins/MyPlugin/plugin.xml --> | |
<!-- the plugin name [A-Za-z_] --> | |
<pluginName>MyPlugin</pluginName> | |
<!-- a short description --> | |
<pluginDescription><![CDATA[Provides custom input with no label]]></pluginDescription> | |
<!-- meta data --> | |
<pluginVersion>1.0</pluginVersion> | |
<pluginRevision>1</pluginRevision> | |
<pluginBuildTimestamp>0</pluginBuildTimestamp> | |
<!-- className of the plugin which extends Pimcore_API_Plugin_Abstract--> | |
<pluginClassName>\MyPlugin\Plugin</pluginClassName> | |
<!-- include paths relative to plugin-directory --> | |
<pluginIncludePaths> | |
<path>/MyPlugin/lib</path> | |
</pluginIncludePaths> | |
<!-- namespaces to register with autoloader--> | |
<pluginNamespaces> | |
<namespace>MyPlugin</namespace> | |
</pluginNamespaces> | |
<!-- js files with path relative to plugin-directory --> | |
<pluginJsPaths> | |
<path>/plugins/MyPlugin/static/js/object/classes/data/inputnolabel.js</path> | |
<path>/plugins/MyPlugin/static/js/object/tags/inputnolabel.js</path> | |
</pluginJsPaths> | |
</plugin> | |
</zend-config> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//place me in /plugins/MyPlugin/static/js/object/classes/data/inputnolabel.js | |
pimcore.registerNS("pimcore.object.classes.data.inputnolabel"); | |
pimcore.object.classes.data.inputnolabel = Class.create(pimcore.object.classes.data.input, { | |
type: "inputnolabel", | |
initialize: function (treeNode, initData) { | |
this.type = "inputnolabel"; | |
this.initData(initData); | |
this.treeNode = treeNode; | |
}, | |
getTypeName: function () { | |
return t("inputnolabel"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment