GithubHelp home page GithubHelp logo

jeffersonsimaogoncalves / cakephp-fieldtypes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leoruhland/cakephp-fieldtypes

1.0 2.0 0.0 476 KB

FieldTypes plugin for CakePHP

License: MIT License

JavaScript 2.00% PHP 98.00%

cakephp-fieldtypes's Introduction

FieldTypes plugin for CakePHP

Note: This is a non-stable plugin for CakePHP 3.x at this time. It is currently under development and should be considered experimental.

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require jeffersonsimaogoncalves/cakephp-fieldtypes

Now load the plugin with the command:

bin/cake plugin load -r -b FieldTypes

Usage

You can use the FieldTypes extending core FormHelper with BootstrapUI.Form then setting the widgets you want to use.

$this->loadHelper('Form', [
    'className' => 'BootstrapUI.Form',
    'widgets' => [
        //Date
        'flatpickr' => ['FieldTypes\View\Widget\FlatpickrWidget', '_view'],
        'bootstrap-datepicker' => ['FieldTypes\View\Widget\BootstrapDatepickerWidget', '_view'],
        'bootstrap-datetimepicker' => ['FieldTypes\View\Widget\BootstrapDatetimepickerWidget', '_view'],

        //Color
        'bootstrap-colorpicker' => ['FieldTypes\View\Widget\BootstrapColorpickerWidget', '_view'],

        //Number
        'bootstrap-touchspin' => ['FieldTypes\View\Widget\BootstrapTouchspinWidget', '_view'],

        //Boolean
        'bootstrap-switch' => ['FieldTypes\View\Widget\BootstrapSwitchWidget', '_view'],

        //Content
        'summernote' => ['FieldTypes\View\Widget\SummernoteWidget', '_view'],
        'wysiwygjs' => ['FieldTypes\View\Widget\WysiwygjsWidget', '_view'],

        //Select
        'bootstrap-select' => ['FieldTypes\View\Widget\BootstrapSelectWidget', '_view'],
        'select2' => ['FieldTypes\View\Widget\Select2Widget', '_view'],

        //Other
        'stringtoslug' => ['FieldTypes\View\Widget\StringToSlugWidget', '_view'],
        'textcount' => ['FieldTypes\View\Widget\TextCounterWidget', '_view'],
    ]
]);

You can override default widgets too.

$this->loadHelper('Form', [
    'className' => 'BootstrapUI.Form',
    'widgets' => [
        'date' => ['FieldTypes\View\Widget\FlatpickrWidget', '_view'],
        'select' => ['FieldTypes\View\Widget\Select2Widget', '_view']
    ]
]);

And then, using it:

$this->Form->input('some_field', ['type' => 'summernote']);

It also works nice with CakeAdmin formFields.

public function postType() {
	return [
		'formFields' => [
			'some_field' => [
				'type' => 'summernote',
			],
		]
	];
};

Types

'type' => 'select2'

select2

'type' => 'select2', 'multiple' => true

select2

'type' => 'summernote'

summernote

'type' => 'datepicker'

datepicker

'type' => 'colorpicker'

colorpicker

'type' => 'touchspin'

touchspin

'type' => 'toggle'

toggle

Credits

This work is based on the code by Leonardo Ruhland.

cakephp-fieldtypes's People

Contributors

leoruhland avatar jeffersonsimaogoncalves avatar

Stargazers

Gábor Mihálcz avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.