\LikeHelper

Like Helper

イイネ!、ヤダネ!の画面表示機能を提供します。

Summary

Methods
Properties
Constants
beforeRender()
setting()
display()
buttons()
$helpers
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$helpers

$helpers : array

Other helpers used by FormHelper

Type

array

Methods

beforeRender()

beforeRender(string  $viewFile) : void

Before render callback. beforeRender is called before the view file is rendered.

Overridden in subclasses.

Parameters

string $viewFile

The view file that is going to be rendered

setting()

setting(string  $likeFieldName, string  $unlikeFieldName, array  $attributes = array()) : string

Output use like setting element

イイネ!、ヤダネ!使用設定HTMLを返します。
使用有無のフィールド名を指定してください。
(フィールド名は、use_like,use_unlike固定で良いのでは?)

Sample code

template file(ctp file)
<?php echo $this->Like->setting('BbsSetting.use_like', 'BbsSetting.use_unlike');

Parameters

string $likeFieldName

This should be "Modelname.fieldname" for use_like field

string $unlikeFieldName

This should be "Modelname.fieldname" for use_unlike field

array $attributes

Array of attributes and HTML arguments.

Returns

string —

HTML tags

display()

display(array  $setting, array  $content, array  $attributes = array()) : string

Output like and unlike display element

イイネ!、ヤダネ!表示HTMLを返します。(表示のみでクリックできません)
設定データ配列、コンテンツデータ配列を指定してください。
設定データ配列のuse_like,use_unlikeを判断し、コンテンツデータ配列のLike.unlike_countを表示します。

Sample code

template file(ctp file)
<?php echo $this->Like->display($bbsSetting, $bbsArticle); ?>

Parameters

array $setting

Array of use like setting data.

array $content

Array of content data with like count.

array $attributes

Array of attributes and HTML arguments.

Returns

string —

HTML tags

buttons()

buttons(array  $model, array  $setting, array  $content, array  $attributes = array()) : string

Output like and unlike buttons element

イイネ!、ヤダネ!ボタンHTMLを返します。
コンテンツモデル名、設定データ配列、コンテンツデータ配列を指定してください。
設定データ配列のuse_like,use_unlikeを判断し、コンテンツデータ配列のLike.unlike_countを表示します。
コンテンツデータ配列のコンテンツモデル名.keyでカウントデータを更新します。

Sample code

template file(ctp file)
<?php echo $this->Like->buttons('BbsArticle', $bbsSetting, $bbsArticle); ?>

Parameters

array $model

String of model name

array $setting

Array of use like setting data.

array $content

Array of content data with like count.

array $attributes

Array of attributes and HTML arguments.

Returns

string —

HTML tags