回答編集履歴

3

テンプレートのデフォルトへの参照の追加

2017/03/28 06:50

投稿

tomcat0090
tomcat0090

スコア66

test CHANGED
@@ -43,3 +43,79 @@
43
43
  都度指定することも出来ますが、設定ファイルでまとめて指定することも出来ます。
44
44
 
45
45
  [FormHelper で使用するテンプレートのカスタマイズ](https://book.cakephp.org/3.0/ja/views/helpers/form.html#formhelper)
46
+
47
+
48
+
49
+ 指定できる templates のデフォルトは以下になります。
50
+
51
+ [cakephp/FormHelper.php at master · cakephp/cakephp](https://github.com/cakephp/cakephp/blob/master/src/View/Helper/FormHelper.php#L92)
52
+
53
+ ```php
54
+
55
+ 'templates' => [
56
+
57
+ 'button' => '<button{{attrs}}>{{text}}</button>',
58
+
59
+ 'checkbox' => '<input type="checkbox" name="{{name}}" value="{{value}}"{{attrs}}>',
60
+
61
+ 'checkboxFormGroup' => '{{label}}',
62
+
63
+ 'checkboxWrapper' => '<div class="checkbox">{{label}}</div>',
64
+
65
+ 'dateWidget' => '{{year}}{{month}}{{day}}{{hour}}{{minute}}{{second}}{{meridian}}',
66
+
67
+ 'error' => '<div class="error-message">{{content}}</div>',
68
+
69
+ 'errorList' => '<ul>{{content}}</ul>',
70
+
71
+ 'errorItem' => '<li>{{text}}</li>',
72
+
73
+ 'file' => '<input type="file" name="{{name}}"{{attrs}}>',
74
+
75
+ 'fieldset' => '<fieldset{{attrs}}>{{content}}</fieldset>',
76
+
77
+ 'formStart' => '<form{{attrs}}>',
78
+
79
+ 'formEnd' => '</form>',
80
+
81
+ 'formGroup' => '{{label}}{{input}}',
82
+
83
+ 'hiddenBlock' => '<div style="display:none;">{{content}}</div>',
84
+
85
+ 'input' => '<input type="{{type}}" name="{{name}}"{{attrs}}/>',
86
+
87
+ 'inputSubmit' => '<input type="{{type}}"{{attrs}}/>',
88
+
89
+ 'inputContainer' => '<div class="input {{type}}{{required}}">{{content}}</div>',
90
+
91
+ 'inputContainerError' => '<div class="input {{type}}{{required}} error">{{content}}{{error}}</div>',
92
+
93
+ 'label' => '<label{{attrs}}>{{text}}</label>',
94
+
95
+ 'nestingLabel' => '{{hidden}}<label{{attrs}}>{{input}}{{text}}</label>',
96
+
97
+ 'legend' => '<legend>{{text}}</legend>',
98
+
99
+ 'multicheckboxTitle' => '<legend>{{text}}</legend>',
100
+
101
+ 'multicheckboxWrapper' => '<fieldset{{attrs}}>{{content}}</fieldset>',
102
+
103
+ 'option' => '<option value="{{value}}"{{attrs}}>{{text}}</option>',
104
+
105
+ 'optgroup' => '<optgroup label="{{label}}"{{attrs}}>{{content}}</optgroup>',
106
+
107
+ 'select' => '<select name="{{name}}"{{attrs}}>{{content}}</select>',
108
+
109
+ 'selectMultiple' => '<select name="{{name}}[]" multiple="multiple"{{attrs}}>{{content}}</select>',
110
+
111
+ 'radio' => '<input type="radio" name="{{name}}" value="{{value}}"{{attrs}}>',
112
+
113
+ 'radioWrapper' => '{{label}}',
114
+
115
+ 'textarea' => '<textarea name="{{name}}"{{attrs}}>{{value}}</textarea>',
116
+
117
+ 'submitContainer' => '<div class="submit">{{content}}</div>',
118
+
119
+ ]
120
+
121
+ ```

2

文中のバージョンの記載が間違っていた

2017/03/28 06:50

投稿

tomcat0090
tomcat0090

スコア66

test CHANGED
@@ -1,4 +1,4 @@
1
- もしかしてですが、使用しているCakePHPのバージョンは3.4かそれ以前ではないでしょうか?
1
+ もしかしてですが、使用しているCakePHPのバージョンは3.3かそれ以前ではないでしょうか?
2
2
 
3
3
 
4
4
 
@@ -42,4 +42,4 @@
42
42
 
43
43
  都度指定することも出来ますが、設定ファイルでまとめて指定することも出来ます。
44
44
 
45
- https://book.cakephp.org/3.0/ja/views/helpers/form.html#formhelper
45
+ [FormHelper で使用するテンプレートのカスタマイズ](https://book.cakephp.org/3.0/ja/views/helpers/form.html#formhelper)

1

リンクを修正

2017/03/28 06:43

投稿

tomcat0090
tomcat0090

スコア66

test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- https://book.cakephp.org/3.0/ja/appendices/3-4-migration-guide.html#formhelper
5
+ [3.4 移行ガイド](https://book.cakephp.org/3.0/ja/appendices/3-4-migration-guide.html#formhelper)
6
6
 
7
7
  こちらによると、$this->Form->control メソッドはCakePHP3.4で追加されているようです。
8
8
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  - input メソッド。
18
18
 
19
- https://github.com/cakephp/cakephp/blob/master/src/View/Helper/FormHelper.php#L1157
19
+ [input メソッド](https://github.com/cakephp/cakephp/blob/master/src/View/Helper/FormHelper.php#L1157)
20
20
 
21
21
  ```php
22
22
 
@@ -32,7 +32,7 @@
32
32
 
33
33
  - control メソッド
34
34
 
35
- https://github.com/cakephp/cakephp/blob/master/src/View/Helper/FormHelper.php#L1063
35
+ [control メソッド](https://github.com/cakephp/cakephp/blob/master/src/View/Helper/FormHelper.php#L1063)
36
36
 
37
37
 
38
38