baserCMS クラスリファレンス

MailformHelper extends BcFreezeHelper
in package

メールフォームヘルパー

Table of Contents

Properties

$BcBaser  : BcBaserHelper
$BcCkeditor  : BcCkeditorHelper
$BcHtml  : BcHtmlHelper
$BcUpload  : BcUploadHelper
$freezed  : bool
凍結状態
$helpers  : array<string|int, mixed>
ヘルパー
$_View  : View
View
$formId  : string
フォームID

Methods

authCaptcha()  : void
認証キャプチャを表示する
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
凍結時用のコントロールを取得する
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
ファイルコントロール(画像)を表示する
isGroupLastField()  : bool
メールフィールドのグループの最後か判定する
number()  : string
数値ボックスを表示する
password()  : string
パスワードボックスを表示する
prefTag()  : string
都道府県用のSELECTタグを表示する
radio()  : string
ラジオボタンを表示する
select()  : string
select プルダウンメニューを表示
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
和暦年
createId()  : string
フォームのIDを作成する BcForm::create より呼出される事が前提

Properties

$helpers

ヘルパー

public array<string|int, mixed> $helpers = ['Html', 'BcTime', 'BcText', 'Js', 'BcUpload', 'BcCkeditor', 'BcBaser', 'BcContents', 'BcArray', 'Url']

Methods

authCaptcha()

認証キャプチャを表示する

public authCaptcha( $fieldName[, array<string|int, mixed> $options = [] ]) : void
Parameters
$fieldName :
$options : array<string|int, mixed> = []

オプション(初期値 : [])

  • separate : 画像と入力欄の区切り(初期値:'')
  • class : CSSクラス名(初期値:auth-captcha-image)
Tags
checked
noTodo

checkbox()

チェックボックスを表示する

public checkbox(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
$fieldName : string

フィールド文字列

$options : array<string|int, mixed> = []

html属性

Tags
checked
noTodo
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
checked
noTodo
Return values
string

control()

メールフィールドのデータよりコントロールを生成する

public control(string $fieldName[, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$fieldName : string

フィールド文字列

$attributes : array<string|int, mixed> = []

HTML属性

Tags
TODO

ucmitz 2022/09/08 FormHelper に control が追加になった事によりシグネチャが変わった メソッド名を変える必要あり。 以前のシグネチャは以下のとおり $type, $fieldName, $options, $attributes = [])

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> = []
Tags
checked
noTodo
Return values
string

datepicker()

カレンダーコントロール付きのテキストフィールド jquery-ui-1.7.2 必須

public datepicker(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
$fieldName : string

フィールド文字列

$options : array<string|int, mixed> = []

HTML属性

Tags
checked
noTodo
Return values
string

html

datePicker()

カレンダーピッカー

public datePicker(mixed $fieldName[, mixed $options = [] ]) : string

jquery-ui-1系 必須

Parameters
$fieldName : mixed
$options : mixed = []
Tags
checked
noTodo
unitTest
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
checked
noTodo
unitTest
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
checked
noTodo
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
checked
unitTest
noTodo
Return values
bool|Event

editor()

エディタを表示する

public editor(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
$fieldName : string
$options : array<string|int, mixed> = []
Tags
checked
noTodo
Return values
string

email()

テキストボックスを表示する

public email(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
$fieldName : string

フィールド文字列

$options : array<string|int, mixed> = []

html属性

Tags
checked
noTodo
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
link
https://book.cakephp.org/4/en/views/helpers/form.html#closing-the-form
checked
noTodo
unitTest
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
checked
noTodo
unitTest
Return values
string

freeze()

フォームを凍結させる

public freeze() : void
Tags
checked
noTodo

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属性

Tags
checked
noTodo
Return values
string

htmlタグ

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
checked
noTodo
unitTest
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
checked
noTodo
Return values
array<string|int, mixed>

getId()

フォームのIDを取得する

public getId() : string

BcFormHelper::create() の後に呼び出される事を前提とする

Tags
checked
noTodo
unitTest
Return values
string

フォームID

getService()

Get Service

public getService( $service) : array<string|int, mixed>|mixed|object
Parameters
$service :
Tags
checked
noTodo
unitTest
Return values
array<string|int, mixed>|mixed|object

getTable()

フィールドに紐づくテーブルを取得する

public getTable(string $fieldName) : Table|false
Parameters
$fieldName : string
Tags
checked
noTodo
unitTest
Return values
Table|false

hasService()

Has Service

public hasService( $service) : bool
Parameters
$service :
Tags
checked
noTodo
unitTest
Return values
bool

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> = []

画像属性

Tags
checked
noTodo
Return values
string

htmlタグ

isGroupLastField()

メールフィールドのグループの最後か判定する

public isGroupLastField(ResultSet $mailFields, MailField $currentMailField) : bool
  • 次のフィールドがないもの
  • 次のフィールドがある、次のフィールドとグループが違うもの
Parameters
$mailFields : ResultSet
$currentMailField : MailField
Tags
checked
noTodo
Return values
bool

number()

数値ボックスを表示する

public number(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
$fieldName : string

フィールド文字列

$options : array<string|int, mixed> = []

html属性

Tags
checked
noTodo
Return values
string

htmlタグ

password()

パスワードボックスを表示する

public password(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
$fieldName : string

フィールド文字列

$options : array<string|int, mixed> = []

html属性

  • 凍結時に、valueはマスクして表示する。
Tags
checked
noTodo
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"

Tags
checked
noTodo
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属性

Tags
checked
noTodo
Return values
string

htmlタグ

select()

select プルダウンメニューを表示

public select(string $fieldName[, iterable<string|int, mixed> $options = [] ][, array<string|int, mixed> $attributes = [] ]) : string
Parameters
$fieldName : string

フィールド文字列

$options : iterable<string|int, mixed> = []

コントロールソース

$attributes : array<string|int, mixed> = []

html属性

  • $attributes['cols']が指定されている場合、値の文字の横幅を指定できる
Tags
checked
noTodo
Return values
string

htmlタグ

setId()

フォームのIDを設定する

public setId( $id) : string

BcFormHelper::create() の後に呼び出される事を前提とする

Parameters
$id :

フォームID

Tags
checked
noTodo
unitTest
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
link
https://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::submit
checked
noTodo
unitTest
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
checked
noTodo
Return values
string

htmlタグ

text()

テキストボックスを表示する

public text(string $fieldName[, array<string|int, mixed> $options = [] ]) : string
Parameters
$fieldName : string

フィールド文字列

$options : array<string|int, mixed> = []

html属性

  • 凍結時に、$attributes["value"]が指定されている場合、その値がvalueになる。  指定されてない場合、$this->request->data[$model][$field]がvalueになる。
Tags
checked
noTodo
Return values
string

htmlタグ

textarea()

テキストエリアを表示する

public textarea(mixed $fieldName[, mixed $options = [] ]) : string
Parameters
$fieldName : mixed
$options : mixed = []
Tags
checked
noTodo
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

createId()

フォームのIDを作成する BcForm::create より呼出される事が前提

protected createId(EntityInterface $context[, array<string|int, mixed> $options = [] ]) : string
Parameters
$context : EntityInterface
$options : array<string|int, mixed> = []
Tags
checked
noTodo
unitTest
Return values
string

        
On this page

Search results