MailformHelper
extends BcFreezeHelper
in package
メールフォームヘルパー
Table of Contents
- $BcBaser : BcBaserHelper
- $BcCkeditor : BcCkeditorHelper
- $BcHtml : BcHtmlHelper
- $BcUpload : BcUploadHelper
- $freezed : bool
- 凍結状態
- $helpers : array<string|int, mixed>
- ヘルパー
- $_View : View
- View
- $formId : string
- フォームID
- authCaptcha() : mixed
- 認証キャプチャを表示する
- checkbox() : string
- チェックボックスを表示する
- ckeditor() : string
- CKEditorを出力する
- control() : string
- メールフィールドのデータよりコントロールを生成する
- create() : string
- create ファイル添付の対応のためにデフォルト値を変更
- datepicker() : string
- カレンダーコントロール付きのテキストフィールド jquery-ui-1.7.2 必須
- datePicker() : string
- カレンダーピッカー
- 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側でメソッドを用意しておく必要がある
- getGroupValidErrors() : array<string|int, mixed>
- 指定したgroup_validをもつフィールドのエラーを取得する
- 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
- isGroupLastField() : bool
- メールフィールドのグループの最後か判定する
- 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
$BcBaser
public
BcBaserHelper
$BcBaser
$BcCkeditor
public
BcCkeditorHelper
$BcCkeditor
$BcHtml
public
BcHtmlHelper
$BcHtml
$BcUpload
public
BcUploadHelper
$BcUpload
$freezed
凍結状態
public
bool
$freezed
= false
$helpers
ヘルパー
public
array<string|int, mixed>
$helpers
= ['Html', 'BcTime', 'BcText', 'Js', 'BcUpload', 'BcCkeditor', 'BcBaser', 'BcContents', 'BcArray', 'Url']
$_View
View
protected
View
$_View
$formId
フォームID
private
string
$formId
= null
Methods
authCaptcha()
認証キャプチャを表示する
public
authCaptcha( $fieldName[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $fieldName :
- $options : array<string|int, mixed> = []
-
オプション(初期値 : [])
-
separate
: 画像と入力欄の区切り(初期値:'') -
class
: CSSクラス名(初期値:auth-captcha-image)
-
Return values
mixed —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> $attributes = [] ]) : string
Parameters
- $fieldName : string
-
フィールド文字列
- $attributes : array<string|int, mixed> = []
-
HTML属性
Tags
Return values
string —フォームコントロールのHTMLタグ
create()
create ファイル添付の対応のためにデフォルト値を変更
public
create([mixed $context = null ][, array<string|int, mixed> $options = [] ]) : string
Parameters
- $context : mixed = null
- $options : array<string|int, mixed> = []
Return values
string —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
datePicker()
カレンダーピッカー
public
datePicker(mixed $fieldName[, mixed $options = [] ]) : string
jquery-ui-1系 必須
Parameters
- $fieldName : mixed
- $options : mixed = []
Tags
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
画像の場合は画像タグ、その他の場合はファイルへのリンク そして削除用のチェックボックスを表示する
《オプション》 imgsize 画像のサイズを指定する rel A タグの rel 属性を指定 title A タグの title 属性を指定 link 大きいサイズへの画像へのリンク有無 delCheck 削除用チェックボックスの利用可否 force ファイルの存在有無に関わらず強制的に画像タグを表示するかどうか
Parameters
- $fieldName : string
- $options : array<string|int, mixed> = []
Tags
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 —コントロールソース
getGroupValidErrors()
指定したgroup_validをもつフィールドのエラーを取得する
public
getGroupValidErrors(ResultSetInterface $mailFields, string $groupValid[, array<string|int, mixed> $options = [] ][, bool $distinct = true ]) : array<string|int, mixed>
Parameters
- $mailFields : ResultSetInterface
- $groupValid : string
- $options : array<string|int, mixed> = []
- $distinct : bool = true
-
同じエラーメッセージをまとめる
Tags
Return values
array<string|int, mixed> —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.
isGroupLastField()
メールフィールドのグループの最後か判定する
public
isGroupLastField(ResultSet $mailFields, MailField $currentMailField) : bool
- 次のフィールドがないもの
- 次のフィールドがある、次のフィールドとグループが違うもの
Parameters
- $mailFields : ResultSet
- $currentMailField : MailField
Return values
bool —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> = []