User Tools

Site Tools


documentation:create_first_plugin

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
documentation:create_first_plugin [2015/09/03 04:01]
mooeditor [Create an element]
documentation:create_first_plugin [2015/09/03 04:08]
mooeditor [Create an element]
Line 688: Line 688:
  
 > New in version 2.2.1> Your ctp file must be place at /​app/​Plugin/​{plugin_name}/​View/​Widgets/​ instead of /​app/​Plugin/​{plugin}/​View/​Elements/​ > New in version 2.2.1> Your ctp file must be place at /​app/​Plugin/​{plugin_name}/​View/​Widgets/​ instead of /​app/​Plugin/​{plugin}/​View/​Elements/​
 +
  
 <file php myNotes.ctp>​ <file php myNotes.ctp>​
Line 765: Line 766:
 <?php $this->​Html->​scriptEnd();​ ?> <?php $this->​Html->​scriptEnd();​ ?>
 </​file>​ </​file>​
 +
  
 > New in version 2.2.1> You don't have to use $this→requestAction() method to get the need variables anymore e.g: <font 10.0ptline-height:​ 13.0pt;/​arial;;#​000000;;#​ffffff><?​php $notes = $this→requestAction(array('​plugin'​ ⇒ '​Note',​ '​controller'​ ⇒ '​notes',​ '​action'​ ⇒ '​myNotes'​),​ array('​uri'​ ⇒ $this→here));?></​font>​. Instead, create a file in //​app/​Plugin/​{plugin_name}/​Controller/​Widgets/​{your_element_name}Widget.php//,​ for <font 10.0ptline-height:​ 13.0pt;​font-family:​ Arial , Helvetica , FreeSans , sans-serif;/​Arial , Helvetica , FreeSans , sans-serif;;#​000000;;#​ffffff>​example:</​font>​ <font 10.0ptline-height:​ 13.0pt;​font-family:​ Arial , Helvetica , FreeSans , sans-serif;/​Arial , Helvetica , FreeSans , sans-serif;;#​000000;;#​ffffff>//​app/​Plugin/​Note/​Controller/​Widgets/​myNotesWidget.php//</​font>​ with the content like the below code: > New in version 2.2.1> You don't have to use $this→requestAction() method to get the need variables anymore e.g: <font 10.0ptline-height:​ 13.0pt;/​arial;;#​000000;;#​ffffff><?​php $notes = $this→requestAction(array('​plugin'​ ⇒ '​Note',​ '​controller'​ ⇒ '​notes',​ '​action'​ ⇒ '​myNotes'​),​ array('​uri'​ ⇒ $this→here));?></​font>​. Instead, create a file in //​app/​Plugin/​{plugin_name}/​Controller/​Widgets/​{your_element_name}Widget.php//,​ for <font 10.0ptline-height:​ 13.0pt;​font-family:​ Arial , Helvetica , FreeSans , sans-serif;/​Arial , Helvetica , FreeSans , sans-serif;;#​000000;;#​ffffff>​example:</​font>​ <font 10.0ptline-height:​ 13.0pt;​font-family:​ Arial , Helvetica , FreeSans , sans-serif;/​Arial , Helvetica , FreeSans , sans-serif;;#​000000;;#​ffffff>//​app/​Plugin/​Note/​Controller/​Widgets/​myNotesWidget.php//</​font>​ with the content like the below code:
-<code> +<file php myNotesWidget.ctp
-/* **myNotesWidget.ctp**  */+
 <?php <?php
 App::​uses('​Widget','​Controller/​Widgets'​);​ App::​uses('​Widget','​Controller/​Widgets'​);​
Line 781: Line 783:
         $controller->​set('​notes',​$notes);​         $controller->​set('​notes',​$notes);​
     }     }
-</code>+</file>
  
 ==== Create widget database ==== ==== Create widget database ====
Line 1119: Line 1121:
 Which case do we need? In common, almost plugin settings needn'​t a boot setting, but some still have one such as '​enabled'​ setting which makes us know whether user can access that plugin or not. Why do we need a boot setting? Because when we want to block access, we need to check enable or not in '​routes.php'​ file of plugin; And importantly,​ '​routes.php'​ file is loaded before the system loads unboot settings, so if we don't make '​enabled'​ setting by boot, we can't check it (because that setting doesn'​t exist at that time). Which case do we need? In common, almost plugin settings needn'​t a boot setting, but some still have one such as '​enabled'​ setting which makes us know whether user can access that plugin or not. Why do we need a boot setting? Because when we want to block access, we need to check enable or not in '​routes.php'​ file of plugin; And importantly,​ '​routes.php'​ file is loaded before the system loads unboot settings, so if we don't make '​enabled'​ setting by boot, we can't check it (because that setting doesn'​t exist at that time).
  
-**** New in version 2.2** >** +> New in version 2.2** ** In version 2.2, the "​{plugin}_enabled"​ setting have "​is_boot"​ field is '​1'​ by default when you created a new plugin
- +
-In version 2.2, the "​{plugin}_enabled"​ setting have "​is_boot"​ field is '​1'​ by default when you created a new plugin+
  
 ==== Create boot setting ==== ==== Create boot setting ====
documentation/create_first_plugin.txt · Last modified: 2015/09/03 00:08 (external edit)