\CategoryHelper

Category Helper

カテゴリーの選択要素を提供します。
一覧での絞り込み
コンテンツ登録時の選択

Summary

Methods
Properties
Constants
beforeRender()
dropDownToggle()
select()
$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

dropDownToggle()

dropDownToggle(array  $options = array(), string  $element = 'dropdown_toggle_category') : string

Output categories drop down toggle

一覧での絞り込みを行う要素を提供します。

サンプルコード

<?php
    echo $this->Category->dropDownToggle(
        array(
        'empty' => true,
        'displayMenu' => true,
    )
);
?>

出力結果

<ul class="dropdown-menu" role="menu">
    <li class="active">
        <a href="/faqs/faq_questions/index/4?frame_id=8">カテゴリ選択</a>
    </li>
    <li>
        <a href="/faqs/faq_questions/index/4/category_id:1?frame_id=8">国語</a>
    </li>
    <li>
        <a href="/faqs/faq_questions/index/4/category_id:2?frame_id=8">算数</a>
    </li>
    <li>
        <a href="/faqs/faq_questions/index/4/category_id:3?frame_id=8">理科</a>
    </li>
    <li>
        <a href="/faqs/faq_questions/index/4/category_id:4?frame_id=8">社会</a>
    </li>
</ul>

Parameters

array $options

Array of options and HTML arguments.

  • empty: String is empty label.
  • header: String is header label.
  • divider: True is divider.
  • displayMenu: True is display menu. False is
  • tag only.
  • displayEmpty: True is empty display. False is not display.
string $element

String of element template name

  • dropdown_toggle_category: Dropdown menu template
  • tab_category: tab menu template

Returns

string —

HTML tags

select()

select(string  $fieldName, array  $attributes = array()) : string

Output categories select element

コンテンツ登録時のカテゴリー選択要素を提供します。

サンプルコード

<?php
    echo $this->Category->select(
        'FaqQuestion.category_id',
        array('empty' => true)
    );
?>

出力結果

<div class="form-group">
    <div class="input select">
        <label for="FaqQuestionCategoryId">カテゴリ</label>
        <select name="data[FaqQuestion][category_id]" class="form-control" id="FaqQuestionCategoryId">
            <option value="0">カテゴリ選択</option>
            <option value="1">国語</option>
            <option value="2">算数</option>
            <option value="3">理科</option>
            <option value="4">社会</option>
        </select>
    </div>
    <div class="has-error"></div>
</div>

Parameters

string $fieldName

This should be "Modelname.fieldname"

array $attributes

Array of attributes and HTML arguments.

Returns

string —

HTML tags