FIELD_USE_LIKE
FIELD_USE_LIKE = 'use_like' : string
フィールド名
BlockSetting Behavior
setup(\Model $model, array $settings = array()) : void
setup
App::uses('BlockSettingBehavior', 'Blocks.Model/Behavior');
public $actsAs = array(
'Blocks.BlockSetting' => array(
BlockSettingBehavior::USE_WORKFLOW,
BlockSettingBehavior::USE_LIKE,
BlockSettingBehavior::USE_UNLIKE,
BlockSettingBehavior::USE_COMMENT,
BlockSettingBehavior::USE_COMMENT_APPROVAL,
'auto_play',
),
),
\Model | $model | モデル |
array | $settings | 設定値 |
saveBlockSetting(\Model $model, string $blockKey = null, integer $roomId = null) : mixed
BlockSettingデータ保存
各プラグインの[横]の入力値を、BlockSettingをブロックキーで検索した縦データにセット or データなしなら、新規作成データが取得できるので、ブロックキーをセット して、縦データをsaveManyでまとめて保存します。
//(例)各プラグインのBlockSettingControllerからの登録処理 [横]データ
array(
'VideoSetting' => array(
'use_comment' => '1',
'use_like' => '1',
'use_unlike' => '0',
'auto_play' => '0',
'use_comment' => '1',
)
)
↓
↓ ブロックキーで検索した[縦]データにセット
↓
array(
'use_comment' => array(
'id' => '1', // 新規登録時はidない
'plugin_key' => 'videos',
'room_id' => '2',
'block_key' => '2e86eb72e9cbd0ffa87ea23c81d4e3b7',
'field_name' => 'use_comment',
'value' => '1',
'type' => 'boolean',
),
'use_like' => array(
'id' => '1',
'plugin_key' => 'videos',
'room_id' => '2',
'block_key' => '2e86eb72e9cbd0ffa87ea23c81d4e3b7',
'field_name' => 'use_like',
'value' => '1',
'type' => 'boolean',
),
'use_unlike' => array(
'id' => '1',
'plugin_key' => 'videos',
'room_id' => '2',
'block_key' => '2e86eb72e9cbd0ffa87ea23c81d4e3b7',
'field_name' => 'use_unlike',
'value' => '0',
'type' => 'boolean',
),
'is_auto_play' => array(
'id' => '1',
'plugin_key' => 'videos',
'room_id' => '2',
'block_key' => '2e86eb72e9cbd0ffa87ea23c81d4e3b7',
'field_name' => 'auto_play',
'value' => '0',
'type' => 'boolean',
),
)
\Model | $model | モデル |
string | $blockKey | ブロックキー |
integer | $roomId | ルームID |
On success Model::$data if its not empty or true, false on failure
_getDefaultApproval(\Model $model, array $blockSettings, string $fieldName, integer $create) : array
use_workflow, use_comment_approvalの初期値取得 room.need_approvalによって、値変わる
\Model | $model | モデル |
array | $blockSettings | ブロックセッティングデータ |
string | $fieldName | フィールド名 |
integer | $create | 新規作成フラグ 0:更新、1:新規作成 |
ブロックセッティングデータ