PHP CKEditor Library: Use the CKEditor to edit HTML in a form input

Recommend this page to a friend!
  Info   View files Documentation   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2021-01-23 (6 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 47 All time: 10,079 This week: 299Up
Version License PHP version Categories
ckeditor 1.0.0Custom (specified...5HTML, PHP 5, Libraries
Description Author

This package provides a plugin to Use the CKEditor to edit HTML in a form input in applications based on the CakePHP framework.

It can be used from a CakePHP controller class to request that the plugin makes the CKEditor JavaScript library be loaded in the current page with the option specify a given version to be loaded.

Applications can tell specify the place in their pages template the editor will be loaded so it can be rendered according to the application needs.

Innovation Award
PHP Programming Innovation award nominee
January 2021
Number 3
The CKEditor is a JavaScript components that is used to Web based user interfaces to create and edit HTML documents.

This package provides a solution to integrate the CKEditor in PHP based Web applications that use the the CakePHP framework.

Manuel Lemos
Picture of Everton C B Junior
  Performance   Level  
Name: Everton C B Junior <contact>
Classes: 1 package by
Country: Brazil Brazil
Age: 42
All time rank: 4393355 in Brazil Brazil
Week rank: 526 Up28 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 1x

Details

CKEditor plugin for CakePHP 3.x with version select

Installation

You can install this plugin into your CakePHP application using composer. This is a personal version of: https://github.com/CakeCoded/CkEditor with the possibility of choose the version and distribution.

The recommended way to install composer packages is:

composer require ebarrosjr/ckeditor

Then in config/bootstrap.php add:

Plugin::load('CkEditor');

In either src/Controller/AppController.php, or any controller where you want to use CKEditor, add:


public $helpers = ['CkEditor.Ck' => [
	'distribution' => 'full', // Default Option :: Others options => 'basic', 'standard'
	'version' => '4.11.4', //Default option, others via CDN page
	'script' => null // You can now point to a custom ckeditor JS file
]];

Finally, in your template file, simply add this to call CKEditor:

echo $this->Ck->input('field_name');

This is the equilivant of using

echo $this->Form->input('field_name');

Except that CKEditor will be loaded instead of a text area!

Advanced Options

You can make adjustments to CKEditor and the form input as needed. There is full flexibility in this regard.

The full explaination is as follows:

echo $this->Form->input($input, $options, $ckEditorOptions, $ckEditorUrl);
@param string $input

The name of the field, can be field_name or model.field_name

@param array $options

Options include $options['label'] for a custom label and any other custom Form Helper options

@param array $ckEditorOptions

This will pass any options from http://docs.ckeditor.com/#!/guide/dev_configuration to CKEditor

@param string $ckEditorUrl

This gives an option to overwrite the CKEditor URL. You can use a local URL then if required.

Examples

Use an associated field name

echo $this->Ck->input('category.description');

Generate a custom label

echo $this->Ck->input('field_name', ['label' => 'A unique label']);

Add options to CKEditor from http://docs.ckeditor.com/#!/guide/dev_configuration

echo $this->Ck->input('field_name', [], ['fullPage' => true, 'allowedContent' => 'true']);

Load a local version of CKEditor, or a different version

echo $this->Ck->input('field_name', [], [], '/js/ckeditor.js');

Example showing all the options together

echo $this->Ck->input('field_name', ['label' => 'A unique label'], ['fullPage' => true, 'allowedContent' => 'true'], '/js/ckeditor.js');
  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Files folder imagetests (1 file, 1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageView (1 directory)

  Files folder image Files  /  src  /  View  
File Role Description
Files folder imageHelper (1 file)

  Files folder image Files  /  src  /  View  /  Helper  
File Role Description
  Plain text file CkHelper.php Class Class source

  Files folder image Files  /  tests  
File Role Description
Files folder imageTestCase (1 directory)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script

  Files folder image Files  /  tests  /  TestCase  
File Role Description
Files folder imageView (1 directory)

  Files folder image Files  /  tests  /  TestCase  /  View  
File Role Description
Files folder imageHelper (1 file)

  Files folder image Files  /  tests  /  TestCase  /  View  /  Helper  
File Role Description
  Plain text file CKHelperTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:47
This week:0
All time:10,079
This week:299Up

For more information send a message to info at phpclasses dot org.