Text helper library.
Text manipulations: Highlight, excerpt, truncate, strip of links, convert email addresses to mailto: links...
Cake\View\Helper\TextHelper Cake\Utility\Text__call( string $method , array $params )
Call methods from String utility class
$method $params mixedCake\View\Helper::__call() __construct( Cake\View\View $View , array $config [] )
Constructor
engine Class name to use to replace String functionality. The class needs to be placed in the Utility directory.Cake\View\View $View $config optional [] Cake\Core\Exception\ExceptionCake\View\Helper::__construct() _insertPlaceHolder( array $matches )
Saves the placeholder for a string, for later use. This gets around double escaping content in URL's.
$matches string_linkEmails( string $text , array $options )
Links email addresses
$text $options stringCake\View\Helper\TextHelper::autoLinkEmails()_linkUrls( string $text , array $htmlOptions )
Replace placeholders with links.
$text $htmlOptions stringautoLink( string $text , array $options [] )
Convert all links and email addresses to HTML links.
escape Control HTML escaping of input. Defaults to true.$text $options optional [] stringautoLinkEmails( string $text , array $options [] )
Adds email links (<a href="mailto:....) to a given text.
escape Control HTML escaping of input. Defaults to true.$text $options optional [] stringautoLinkUrls( string $text , array $options [] )
Adds links (<a href=....) to a given text, by finding text that begins with strings like http:// and ftp://.
escape Control HTML escaping of input. Defaults to true.$text $options optional [] stringautoParagraph( string $text )Formats paragraphs around given text for all line breaks
added for double line return
$text stringand
tags
excerpt( string $text , string $phrase , integer $radius 100 , string $ending '...' )
Extracts an excerpt from the text surrounding the phrase with a number of characters on each side determined by radius.
$text $phrase $radius optional 100 $ending optional '...' stringCake\Utility\Text::excerpt()highlight( string $text , string $phrase , array $options [] )
Highlights a given phrase in a text. You can specify any expression in highlighter that may include the \1 expression to include the $phrase found.
$text $phrase $options optional [] stringCake\Utility\Text::highlight()implementedEvents( )
Event listeners.
arrayCake\View\Helper::implementedEvents() stripLinks( string $text )
Strips given text of all links (<a href=....)
$text stringCake\Utility\Text::stripLinks()tail( string $text , integer $length 100 , array $options [] )
Truncates text starting from the end.
Cuts a string to the length of $length and replaces the first characters with the ellipsis if the text is longer than length.
ellipsis Will be used as Beginning and prepended to the trimmed stringexact If false, $text will not be cut mid-word$text $length optional 100 $options optional [] stringCake\Utility\Text::tail()toList( array $list , string $and null , string $separator ', ' )
Creates a comma separated list where the last two items are joined with 'and', forming natural language.
$list $and optional null $separator optional ', ' stringCake\Utility\Text::toList()truncate( string $text , integer $length 100 , array $options [] )
Truncates text.
Cuts a string to the length of $length and replaces the last characters with the ellipsis if the text is longer than length.
ellipsis Will be used as Ending and appended to the trimmed stringexact If false, $text will not be cut mid-wordhtml If true, HTML tags would be handled correctly$text $length optional 100 $options optional [] stringCake\Utility\Text::truncate()__debugInfo( )
Returns an array that can be used to describe the internal state of this object.
array__get( string $name )
Lazy loads helpers.
$name Cake\View\Helper|null_confirm( string $message , string $okCode , string $cancelCode '' , array $options [] )
Returns a string to be used as onclick handler for confirm dialogs.
$message $okCode $cancelCode optional '' $options optional [] stringaddClass( array $options [] , string $class null , string $key 'class' )
Adds the given class to the element options
$options optional [] $class optional null $key optional 'class' array_configDelete( string $key )
Delete a single config key
$key Cake\Core\Exception\Exception_configRead( string|null $key )
Read a config variable
$key mixed_configWrite( string|array $key , mixed $value , boolean|string $merge false )
Write a config variable
$key $value $merge optional false Cake\Core\Exception\Exceptionconfig( string|array|null $key null , mixed|null $value null , boolean $merge true )
Reading the whole config:
$this->config();
Reading a specific value:
$this->config('key');
Reading a nested value:
$this->config('some.nested.key');
Setting a specific value:
$this->config('key', $value);
Setting a nested value:
$this->config('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->config(['one' => 'value', 'another' => 'value']);
$key optional null $value optional null $merge optional true mixedCake\Core\Exception\ExceptionconfigShallow( string|array $key , mixed|null $value null )
Merge provided config with existing config. Unlike config() which does a recursive merge for nested keys, this method does a simple merge.
Setting a specific value:
$this->config('key', $value);
Setting a nested value:
$this->config('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->config(['one' => 'value', 'another' => 'value']);
$key $value optional null mixedpublic array
Holds the fields ['field_name' => ['type' => 'string', 'length' => 100]], primaryKey and validates ['field_name']
[]
protected boolean
Whether the config property has already been configured with defaults
false public Cake\View\Helper\HtmlHelper
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/3.1/class-Cake.View.Helper.TextHelper.html