BcFreezeHelper
extends BcFormHelper
in package
Uses
BcEventDispatcherTrait
Class BcFreezeHelper
Table of Contents
- $BcCkeditor : BcCkeditorHelper
- $BcHtml : BcHtmlHelper
- $BcUpload : BcUploadHelper
- $freezed : bool
- 凍結状態
- $helpers : array<string|int, mixed>
- Other helpers used by FormHelper
- $_View : View
- View
- $formId : string
- フォームID
- checkbox() : string
- チェックボックスを表示する
- ckeditor() : string
- CKEditorを出力する
- control() : string
- フォームコントロールを取得
- create() : string
- Returns an HTML form element.
- datePicker() : string
- カレンダーピッカー
- datepicker() : string
- カレンダーコントロール付きのテキストフィールド jquery-ui-1.7.2 必須
- dateTime() : string
- 日付タグを表示
- dateTimePicker() : string
- カレンダピッカーとタイムピッカー
- dispatchAfterForm() : string
- フォームの最後のフィールドの後に発動する前提としてイベントを発動する
- dispatchLayerEvent() : bool|Event
- イベントを発火
- editor() : string
- エディタを表示する
- email() : string
- テキストボックスを表示する
- end() : string
- Closes an HTML form, cleans up values set by FormHelper::create(), and writes hidden input fields where appropriate.
- file() : string
- ファイルタグを出力
- freeze() : void
- フォームを凍結させる
- freezeControll() : string
- 凍結時用のコントロールを取得する
- generateList() : mixed
- モデルよりリストを生成する
- getControlSource() : array<string|int, mixed>|false
- コントロールソースを取得する Model側でメソッドを用意しておく必要がある
- getId() : string
- フォームのIDを取得する
- getService() : array<string|int, mixed>|mixed|object
- Get Service
- getTable() : Table|false
- フィールドに紐づくテーブルを取得する
- hasService() : bool
- Has Service
- hidden() : string
- Creates a hidden input field.
- image() : string
- ファイルコントロール(画像)を表示する
- input() : string
- Generates a form input element complete with label and wrapper div
- number() : string
- 数値ボックスを表示する
- password() : string
- パスワードボックスを表示する
- prefTag() : string
- 都道府県用のSELECTタグを表示する
- radio() : string
- ラジオボタンを表示する
- select() : string
- select プルダウンメニューを表示
- selectText() : string
- 文字列保存用複数選択コントロール
- setId() : string
- フォームのIDを設定する
- submit() : string
- Creates a submit button element. This method will generate `<input />` elements that can be used to submit, and reset forms by using $options. image submits can be created by supplying an image path for $caption.
- tel() : string
- TELボックスを表示する
- text() : string
- テキストボックスを表示する
- textarea() : string
- テキストエリアを表示する
- wyear() : string
- 和暦年
- _generateOptions() : array<string|int, mixed>
- Generates option lists for common <select /> menus
- _selectOptions() : array<string|int, mixed>
- Returns an array of formatted OPTION/OPTGROUP elements
- createId() : string
- フォームのIDを作成する BcForm::create より呼出される事が前提
Properties
$BcCkeditor
public
BcCkeditorHelper
$BcCkeditor
$BcHtml
public
BcHtmlHelper
$BcHtml
$BcUpload
public
BcUploadHelper
$BcUpload
$freezed
凍結状態
public
bool
$freezed
= false
$helpers
Other helpers used by FormHelper
public
array<string|int, mixed>
$helpers
= ['Url', 'Js', 'Html', 'BaserCore.BcHtml', 'BaserCore.BcTime', 'BaserCore.BcText', 'BaserCore.BcUpload', 'BaserCore.BcCkeditor']
$_View
View
protected
View
$_View
$formId
フォームID
private
string
$formId
= null
Methods
checkbox()
チェックボックスを表示する
public
checkbox(string $fieldName[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $attributes : array<string|int, mixed> = []
-
html属性
Return values
string —htmlタグ
ckeditor()
CKEditorを出力する
public
ckeditor(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $fieldName : string
- $options : array<string|int, mixed> = []
Tags
Return values
string —control()
フォームコントロールを取得
public
control(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
CakePHPの標準仕様をカスタマイズ
- labelタグを自動で付けない
- legendタグを自動で付けない
- errorタグを自動で付けない
Parameters
- $fieldName : string
- $options : array<string|int, mixed> = []
Tags
Return values
string —create()
Returns an HTML form element.
public
create([mixed $context = null ][, array<string|int, mixed> $options = [] ]) : string
Options:
-
type
Form method defaults to autodetecting based on the form context. If the form context's isCreate() method returns false, a PUT request will be done. -
method
Set the form's method attribute explicitly. -
url
The URL the form submits to. Can be a string or a URL array. -
encoding
Set the accept-charset encoding for the form. Defaults toConfigure::read('App.encoding')
-
enctype
Set the form encoding explicitly. By defaulttype => file
will setenctype
tomultipart/form-data
. -
templates
The templates you want to use for this form. Any templates will be merged on top of the already loaded templates. This option can either be a filename in /config that contains the templates you want to load, or an array of templates to use. -
context
Additional options for the context class. For example the EntityContext accepts a 'table' option that allows you to set the specific Table class the form should be based on. -
idPrefix
Prefix for generated ID attributes. -
valueSources
The sources that values should be read from. See FormHelper::setValueSources() -
templateVars
Provide template variables for the formStart template.
Parameters
- $context : mixed = null
-
The context for which the form is being defined. Can be a ContextInterface instance, ORM entity, ORM resultset, or an array of meta data. You can use
null
to make a context-less form. - $options : array<string|int, mixed> = []
-
An array of html attributes and options.
Tags
Return values
string —An formatted opening FORM tag.
datePicker()
カレンダーピッカー
public
datePicker(mixed $fieldName[, mixed $options = [] ]) : string
jquery-ui-1系 必須
Parameters
- $fieldName : mixed
- $options : mixed = []
Tags
Return values
string —html
datepicker()
カレンダーコントロール付きのテキストフィールド jquery-ui-1.7.2 必須
public
datepicker(string $fieldName[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $attributes : array<string|int, mixed> = []
-
HTML属性
Return values
string —html
dateTime()
日付タグを表示
public
dateTime(string $fieldName[, string $dateFormat = 'DMY' ][, string $timeFormat = '12' ][, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $dateFormat : string = 'DMY'
-
日付フォーマット
- $timeFormat : string = '12'
-
時間フォーマット
- $attributes : array<string|int, mixed> = []
-
html属性
- 凍結時、$attributes['selected']に要素を格納することで日付を選択する (例) $attributes['selected'] = array('selected' => array('year' => '2010', 'month' => '4', 'day' => '1'))
Return values
string —htmlタグ
dateTimePicker()
カレンダピッカーとタイムピッカー
public
dateTimePicker(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
jquery.timepicker.js 必須
Parameters
- $fieldName : string
- $options : array<string|int, mixed> = []
Tags
Return values
string —dispatchAfterForm()
フォームの最後のフィールドの後に発動する前提としてイベントを発動する
public
dispatchAfterForm([string $type = '' ]) : string
発動側
フォームのの直前に記述して利用する
コールバック処理
プラグインのコールバック処理で CakeEvent::data['fields'] に 配列で行データを追加する事でフォームの最後に行を追加する事ができる。
イベント名
コントローラー名.Form.afterForm Or コントローラー名.Form.afterOptionForm
行データのキー(配列)
- title:見出欄
- input:入力欄
行データの追加例
$View = $event->subject(); // $event は、CakeEvent $input = $View->BcForm->input('Page.add_field', ['type' => 'input']); $event->setData('fields', [ [ 'title' => '追加フィールド', 'input' => $input ] ]);
Parameters
- $type : string = ''
-
フォームのタイプ タイプごとにイベントの登録ができる
Tags
Return values
string —行データ
dispatchLayerEvent()
イベントを発火
public
dispatchLayerEvent(string $name[, array<string|int, mixed> $data = [] ][, mixed $options = [] ]) : bool|Event
Parameters
- $name : string
- $data : array<string|int, mixed> = []
- $options : mixed = []
Tags
Return values
bool|Event —editor()
エディタを表示する
public
editor(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $fieldName : string
- $options : array<string|int, mixed> = []
Return values
string —email()
テキストボックスを表示する
public
email(string $fieldName[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $attributes : array<string|int, mixed> = []
-
html属性
Tags
Return values
string —htmlタグ
end()
Closes an HTML form, cleans up values set by FormHelper::create(), and writes hidden input fields where appropriate.
public
end([array<string|int, mixed> $secureAttributes = [] ]) : string
Resets some parts of the state, shared among multiple FormHelper::create() calls, to defaults.
Parameters
- $secureAttributes : array<string|int, mixed> = []
-
Secure attributes which will be passed as HTML attributes into the hidden input elements generated for the Security Component.
Tags
Return values
string —A closing FORM tag.
file()
ファイルタグを出力
public
file(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $fieldName : string
- $options : array<string|int, mixed> = []
Return values
string —freeze()
フォームを凍結させる
public
freeze() : void
Return values
void —freezeControll()
凍結時用のコントロールを取得する
public
freezeControll(string $fieldName, array<string|int, mixed> $options[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $options : array<string|int, mixed>
-
コントロールソース
- $attributes : array<string|int, mixed> = []
-
html属性
Return values
string —htmlタグ
generateList()
モデルよりリストを生成する
public
generateList(string $modelName[, mixed $conditions = [] ][, mixed $fields = [] ][, mixed $order = [] ]) : mixed
Parameters
- $modelName : string
- $conditions : mixed = []
- $fields : mixed = []
- $order : mixed = []
Return values
mixed —リストまたは、false
getControlSource()
コントロールソースを取得する Model側でメソッドを用意しておく必要がある
public
getControlSource(string $field[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>|false
Parameters
- $field : string
-
フィールド名
- $options : array<string|int, mixed> = []
Tags
Return values
array<string|int, mixed>|false —コントロールソース
getId()
フォームのIDを取得する
public
getId() : string
BcFormHelper::create() の後に呼び出される事を前提とする
Tags
Return values
string —フォームID
getService()
Get Service
public
getService( $service) : array<string|int, mixed>|mixed|object
Parameters
Tags
Return values
array<string|int, mixed>|mixed|object —getTable()
フィールドに紐づくテーブルを取得する
public
getTable(string $fieldName) : Table|false
Parameters
- $fieldName : string
Tags
Return values
Table|false —hasService()
Has Service
public
hasService( $service) : bool
Parameters
Tags
Return values
bool —hidden()
Creates a hidden input field.
public
hidden(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $fieldName : string
-
Name of a field, in the form of "Modelname.fieldname"
- $options : array<string|int, mixed> = []
-
Array of HTML attributes.
Tags
Return values
string —A generated hidden input
image()
ファイルコントロール(画像)を表示する
public
image(string $fieldName[, array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $imageAttributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $attributes : array<string|int, mixed> = []
-
html属性
- $imageAttributes : array<string|int, mixed> = []
-
画像属性
Return values
string —htmlタグ
input()
Generates a form input element complete with label and wrapper div
public
input(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Options
See each field type method for more information. Any options that are part of
$attributes or $options for the different type methods can be included in $options
for input().i
Additionally, any unknown keys that are not in the list below, or part of the selected type's options
will be treated as a regular html attribute for the generated input.
-
type
- Force the type of widget you want. e.g.type => 'select'
-
label
- Either a string label, or an array of options for the label. See FormHelper::label(). -
div
- Eitherfalse
to disable the div, or an array of options for the div. See HtmlHelper::div() for more options. -
options
- For widgets that take options e.g. radio, select. -
error
- Control the error message that is produced. Set tofalse
to disable any kind of error reporting (field error and error messages). -
errorMessage
- Boolean to control rendering error messages (field error will still occur). -
empty
- String or boolean to enable empty select box options. -
before
- Content to place before the label + input. -
after
- Content to place after the label + input. -
between
- Content to place between the label + input. -
format
- Format template for element order. Any element that is not in the array, will not be in the output.- Default input format order: array('before', 'label', 'between', 'input', 'after', 'error')
- Default checkbox format order: array('before', 'input', 'between', 'label', 'after', 'error')
- Hidden input will not be formatted
- Radio buttons cannot have the order of input and label elements controlled with these settings.
Parameters
- $fieldName : string
-
This should be "Modelname.fieldname"
- $options : array<string|int, mixed> = []
-
Each type of input takes different options.
Tags
Return values
string —Completed form widget.
number()
数値ボックスを表示する
public
number(string $fieldName[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $attributes : array<string|int, mixed> = []
-
html属性
Tags
Return values
string —htmlタグ
password()
パスワードボックスを表示する
public
password(string $fieldName[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $attributes : array<string|int, mixed> = []
-
html属性
- 凍結時に、valueはマスクして表示する。
Tags
Return values
string —htmlタグ
prefTag()
都道府県用のSELECTタグを表示する
public
prefTag(string $fieldName[, mixed $selected = null ][, array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $convertKey = false ]) : string
Parameters
- $fieldName : string
-
Name attribute of the SELECT
- $selected : mixed = null
-
Selected option
- $attributes : array<string|int, mixed> = []
-
Array of HTML options for the opening SELECT element
- $convertKey : array<string|int, mixed> = false
-
true value = "value" / false value = "key"
Return values
string —都道府県用のSELECTタグ
radio()
ラジオボタンを表示する
public
radio(string $fieldName[, array<string|int, mixed> $options = [] ][, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $options : array<string|int, mixed> = []
-
コントロールソース
- $attributes : array<string|int, mixed> = []
-
html属性
Return values
string —htmlタグ
select()
select プルダウンメニューを表示
public
select(string $fieldName[, array<string|int, mixed> $options = [] ][, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $options : array<string|int, mixed> = []
-
コントロールソース
- $attributes : array<string|int, mixed> = []
-
html属性
- $attributes['cols']が指定されている場合、値の文字の横幅を指定できる
Tags
Return values
string —$showEmpty htmlタグ
selectText()
文字列保存用複数選択コントロール
public
selectText(string $fieldName[, array<string|int, mixed> $options = [] ][, mixed $selected = null ][, array<string|int, mixed> $attributes = [] ][, mixed $showEmpty = '' ]) : string
Parameters
- $fieldName : string
-
id,nameなどの名前
- $options : array<string|int, mixed> = []
-
optionタグの値
- $selected : mixed = null
-
selectedを付与する要素
- $attributes : array<string|int, mixed> = []
-
htmlの属性
- $showEmpty : mixed = ''
-
空要素の表示/非表示、初期値
Return values
string —setId()
フォームのIDを設定する
public
setId( $id) : string
BcFormHelper::create() の後に呼び出される事を前提とする
Parameters
Tags
Return values
string —新規フォームID
submit()
Creates a submit button element. This method will generate `<input />` elements that can be used to submit, and reset forms by using $options. image submits can be created by supplying an image path for $caption.
public
submit([string $caption = null ][, array<string|int, mixed> $options = [] ]) : string
Options
-
div
- Include a wrapping div? Defaults to true. Accepts sub options similar to FormHelper::input(). -
before
- Content to include before the input. -
after
- Content to include after the input. -
type
- Set to 'reset' for reset inputs. Defaults to 'submit' -
confirm
- JavaScript confirmation message. - Other attributes will be assigned to the input element.
Options
-
div
- Include a wrapping div? Defaults to true. Accepts sub options similar to FormHelper::input(). - Other attributes will be assigned to the input element.
Parameters
- $caption : string = null
-
The label appearing on the button OR if string contains :// or the extension .jpg, .jpe, .jpeg, .gif, .png use an image if the extension exists, AND the first character is /, image is relative to webroot, OR if the first character is not /, image is relative to webroot/img.
- $options : array<string|int, mixed> = []
-
Array of options. See above.
Tags
Return values
string —A HTML submit button
tel()
TELボックスを表示する
public
tel(string $fieldName[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $attributes : array<string|int, mixed> = []
-
html属性
Tags
Return values
string —htmlタグ
text()
テキストボックスを表示する
public
text(string $fieldName[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $attributes : array<string|int, mixed> = []
-
html属性
- 凍結時に、$attributes["value"]が指定されている場合、その値がvalueになる。 指定されてない場合、$this->request->data[$model][$field]がvalueになる。
Tags
Return values
string —htmlタグ
textarea()
テキストエリアを表示する
public
textarea(mixed $fieldName[, mixed $attributes = [] ]) : string
Parameters
- $fieldName : mixed
- $attributes : mixed = []
Return values
string —htmlタグ
wyear()
和暦年
public
wyear(string $fieldName[, int $minYear = null ][, int $maxYear = null ][, string $selected = null ][, array<string|int, mixed> $attributes = [] ][, bool $showEmpty = true ]) : string
Parameters
- $fieldName : string
-
Prefix name for the SELECT element
- $minYear : int = null
-
First year in sequence
- $maxYear : int = null
-
Last year in sequence
- $selected : string = null
-
Option which is selected.
- $attributes : array<string|int, mixed> = []
-
Attribute array for the select elements.
- $showEmpty : bool = true
-
Show/hide the empty select option
Return values
string —_generateOptions()
Generates option lists for common <select /> menus
protected
_generateOptions(string $name[, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $name : string
-
List type name.
- $options : array<string|int, mixed> = []
-
Options list.
Return values
array<string|int, mixed> —_selectOptions()
Returns an array of formatted OPTION/OPTGROUP elements
protected
_selectOptions([array<string|int, mixed> $elements = [] ][, array<string|int, mixed> $parents = [] ][, bool $showParents = null ][, array<string|int, mixed> $attributes = [] ]) : array<string|int, mixed>
Parameters
- $elements : array<string|int, mixed> = []
-
Elements to format.
- $parents : array<string|int, mixed> = []
-
Parents for OPTGROUP.
- $showParents : bool = null
-
Whether to show parents.
- $attributes : array<string|int, mixed> = []
-
HTML attributes.
Return values
array<string|int, mixed> —createId()
フォームのIDを作成する BcForm::create より呼出される事が前提
protected
createId(EntityInterface $context[, array<string|int, mixed> $options = [] ]) : string
Parameters
- $context : EntityInterface
- $options : array<string|int, mixed> = []