PluginProbe
CSS & JavaScript Toolbox / 8.0.3
CSS & JavaScript Toolbox v8.0.3
trunk 0.3 0.8 10 10.1 11 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 11.9.1 12 12.0 12.0.1 12.0.3 12.0.4 12.0.5 12.0.6 12.0.7 6.0 6.0.11 All 60 releases
css-javascript-toolbox / framework / view / block / parameter / base / abstract.php

abstract.php in CSS & JavaScript Toolbox 8.0.3, at framework/view/block/parameter/base/abstract.php

129 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 *
4 */
5
6 /**
7 *
8 */
9 abstract class CJT_Framework_View_Block_Parameter_Base_Abstract
10 extends CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Base_Abstract
11 implements CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Interface_Type,
12 CJT_Framework_View_Block_Parameter_Interface_Type {
13
14 /**
15 * put your comment there...
16 *
17 */
18 public function __toString() {
19 // Get class file name.
20 $content = $this->getTypeObject()->getFactory()->getClassFile(get_class($this), 'index.phtml');
21 // Get content on output buffer.
22 ob_start();
23 include $content;
24 return ob_get_clean();
25 }
26
27 /**
28 * put your comment there...
29 *
30 */
31 public function enqueueScripts() {return array();}
32
33 /**
34 * put your comment there...
35 *
36 */
37 public function enqueueStyles() {return array();}
38
39 /**
40 * put your comment there...
41 *
42 * @param mixed $parameter
43 */
44 public function getBaseTypeFactory($parameter) {
45 // Hold local instance!
46 static $baseTypeFactory;
47 if (!$baseTypeFactory) {
48 $baseTypeFactory = new CJT_Framework_Developer_Interface_Block_Shortcode_Parameters_Factory();
49 }
50 // Type factory
51 return array(
52 'factory' => $baseTypeFactory,
53 'typeName' => $parameter->getOriginalType(),
54 );
55 }
56
57 /**
58 * put your comment there...
59 *
60 */
61 protected function getControlName() {
62 return $this->getDefinition()->getName(true);
63 }
64
65 /**
66 * put your comment there...
67 *
68 */
69 protected function getElementId() {
70 // Get element name.
71 $name = $this->getName();
72 // Replace all [ and ] to dashes!
73 $id = str_replace(array('[', ']'), '-', $name);
74 return $id;
75 }
76
77 /**
78 * put your comment there...
79 *
80 */
81 public function getName() {
82 // Initialize.
83 $name = '';
84 $names = array();
85 // Add current parameter name as first.
86 $names[] = $this->getControlName();
87 // Unshift all the parent names at the begning of the names list!
88 $parent = $this;
89 while ($parent = $parent->getParent()) {
90 array_unshift($names, $parent->getControlName());
91 }
92 // Use first item as the name and everything else as array.
93 $name = 'form-data';
94 // Get everything else as array.
95 if (!empty($names)) {
96 $name .= '[' . implode('][', $names) . ']';
97 }
98 // Return string name
99 return $name;
100 }
101
102 /**
103 * put your comment there...
104 *
105 * @param mixed $name
106 */
107 protected function getTemplate($name) {
108 // Get RENDERER class name.
109 $path = explode('_', get_class($this));
110 $rendererName = array_pop($path);
111 // For now it only support getting standard templates
112 // from the abstract class.
113 // In the future it might used to get template overrided in the
114 // $this object class.
115 ob_start();
116 include "abstract/template/{$name}.phtml";
117 return ob_get_clean();
118 }
119
120 /**
121 * put your comment there...
122 *
123 */
124 public function shortcode() {
125 return $this->getTypeObject()->shortcode();
126 }
127
128 } // End class.
129