CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.0 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.0
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Console
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • I18n
    • Log
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget

Class CheckboxWidget

Input widget for creating checkbox widgets.

Namespace: Cake\View\Widget

Property Summary

  • $_templates protected
    Cake\View\StringTemplate

    StringTemplate instance.

Method Summary

  • __construct() public

    Constructor.

  • _isChecked() protected

    Check whether or not the checkbox should be checked.

  • render() public

    Render a checkbox element.

  • secureFields() public

    Returns a list of fields that need to be secured for this widget. Fields are in the form of Model[field][suffix]

Method Detail

__construct() ¶ public

__construct(Cake\View\StringTemplate $templates)

Constructor.

Parameters
Cake\View\StringTemplate $templates

Templates list.

_isChecked() ¶ protected

_isChecked(array $data): bool

Check whether or not the checkbox should be checked.

Parameters
array $data

Data to look at and determine checked state.

Returns
bool

render() ¶ public

render(array $data, Cake\View\Form\ContextInterface $context): string

Render a checkbox element.

Data supports the following keys:

  • name - The name of the input.
  • value - The value attribute. Defaults to '1'.
  • val - The current value. If it matches value the checkbox will be checked. You can also use the 'checked' attribute to make the checkbox checked.
  • disabled - Whether or not the checkbox should be disabled.

Any other attributes passed in will be treated as HTML attributes.

Parameters
array $data

The data to create a checkbox with.

Cake\View\Form\ContextInterface $context

The current form context.

Returns
string

secureFields() ¶ public

secureFields(array $data): array

Returns a list of fields that need to be secured for this widget. Fields are in the form of Model[field][suffix]

Parameters
array $data
Returns
array

Property Detail

$_templates ¶ protected

StringTemplate instance.

Type
Cake\View\StringTemplate
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs