| @@ -7,27 +7,40 @@ | ||
| 7 | 7 | defined('ABSPATH') or die("Access denied"); |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Get Add-New-Block view markups. |
| 11 | -* | |
| 11 | +* | |
| 12 | 12 | * The method is resposible for selecting the correct template |
| 13 | 13 | * and initialize template vars. |
| 14 | -* | |
| 14 | +* | |
| 15 | 15 | * @author Ahmed Said |
| 16 | 16 | * @version 6 |
| 17 | 17 | */ |
| 18 | 18 | class CJTBlocksNewView extends CJTView { |
| 19 | - | |
| 19 | + | |
| 20 | 20 | /** |
| 21 | 21 | * put your comment there... |
| 22 | - * | |
| 22 | + * | |
| 23 | 23 | * @var mixed |
| 24 | 24 | */ |
| 25 | 25 | public $position; |
| 26 | - | |
| 26 | + | |
| 27 | 27 | /** |
| 28 | + * Initialize view object. | |
| 29 | + * | |
| 30 | + * @see CJTView for more details | |
| 31 | + * @return void | |
| 32 | + */ | |
| 33 | + public function __construct($parameters) { | |
| 34 | + parent::__construct($parameters); | |
| 35 | + // Enqueue Styles & Scripts. | |
| 36 | + add_action('admin_print_styles', array(__CLASS__, 'enququeStyles')); | |
| 37 | + add_action('admin_print_scripts', array(__CLASS__, 'enququeScripts')); | |
| 38 | + } | |
| 39 | + | |
| 40 | + /** | |
| 28 | 41 | * Output Add New Block markups. |
| 29 | - * | |
| 42 | + * | |
| 30 | 43 | * @return void |
| 31 | 44 | */ |
| 32 | 45 | public function display() { |
| 33 | 46 | $defaultValues = array('position'); |
| @@ -38,12 +51,12 @@ | ||
| 38 | 51 | } |
| 39 | 52 | } |
| 40 | 53 | echo $this->getTemplate('default'); |
| 41 | 54 | } |
| 42 | - | |
| 55 | + | |
| 43 | 56 | /** |
| 44 | - * Output JavaScript files requirred to Add-New-Block view to run. | |
| 45 | - * | |
| 57 | + * Output Javascript files requirred to Add-New-Block view to run. | |
| 58 | + * | |
| 46 | 59 | * @return void |
| 47 | 60 | */ |
| 48 | 61 | public static function enququeScripts() { |
| 49 | 62 | // Use related scripts. |
| @@ -54,12 +67,12 @@ | ||
| 54 | 67 | 'framework:js:misc:{CJT-}simple-error-dialog', |
| 55 | 68 | 'views:blocks:new:public:js:{CJT-}add-new-block' |
| 56 | 69 | ); |
| 57 | 70 | } |
| 58 | - | |
| 71 | + | |
| 59 | 72 | /** |
| 60 | 73 | * Output CSS files required to Add-New-Block view. |
| 61 | - * | |
| 74 | + * | |
| 62 | 75 | * @return void |
| 63 | 76 | */ |
| 64 | 77 | public static function enququeStyles() { |
| 65 | 78 | // Use related styles. |
| @@ -68,9 +81,9 @@ | ||
| 68 | 81 | 'framework:css:{CJT-}error-dialog', |
| 69 | 82 | 'framework:css:{CJT-}forms' |
| 70 | 83 | ); |
| 71 | 84 | } |
| 72 | - | |
| 85 | + | |
| 73 | 86 | } // End class. |
| 74 | 87 | |
| 75 | 88 | // Hookable!! |
| 76 | 89 | CJTBlocksNewView::define('CJTBlocksNewView'); |