Overview

Namespaces

  • None
  • PHP

Classes

  • Breadcrumb
  • Breadcrumbs
  • CacheFile
  • Comment
  • CommentArray
  • CommentFilter
  • CommentForm
  • CommentList
  • Config
  • Database
  • DatabaseQuery
  • DatabaseQuerySelect
  • DatabaseQuerySelectFulltext
  • DatabaseStopwords
  • Debug
  • Field
  • Fieldgroup
  • Fieldgroups
  • FieldgroupsArray
  • Fields
  • FieldsArray
  • Fieldtype
  • FieldtypeMulti
  • Fieldtypes
  • FileLog
  • FilenameArray
  • Fuel
  • HookEvent
  • ImageSizer
  • Inputfield
  • InputfieldsArray
  • InputfieldWrapper
  • Language
  • LanguageParser
  • Languages
  • LanguagesPageFieldValue
  • LanguageSupportInstall
  • LanguageTranslator
  • Markdown_Parser
  • MarkdownExtra_Parser
  • ModuleJS
  • ModulePlaceholder
  • Modules
  • Notice
  • NoticeError
  • NoticeMessage
  • Notices
  • NullPage
  • Page
  • PageArray
  • Pagefile
  • Pagefiles
  • PagefilesManager
  • PageFinder
  • Pageimage
  • Pageimages
  • PagerNav
  • PagerNavItem
  • Pages
  • PagesAccess
  • PagesSortfields
  • PagesType
  • Paths
  • Permission
  • Permissions
  • Process
  • ProcessController
  • ProcessWire
  • Role
  • Roles
  • Sanitizer
  • Selector
  • SelectorBitwiseAnd
  • SelectorContains
  • SelectorContainsLike
  • SelectorContainsWords
  • SelectorEnds
  • SelectorEqual
  • SelectorGreaterThan
  • SelectorGreaterThanEqual
  • SelectorLessThan
  • SelectorLessThanEqual
  • SelectorNotEqual
  • Selectors
  • SelectorStarts
  • Session
  • SessionCSRF
  • SmartyPants_Parser
  • SmartyPantsTypographer_Parser
  • SystemUpdate1
  • Template
  • TemplateFile
  • Templates
  • TemplatesArray
  • Textformatter
  • Textile
  • User
  • Users
  • Wire
  • WireArray
  • WireData
  • WireInput
  • WireInputData
  • WireSaveableItems
  • WireSaveableItemsLookup
  • WireUpload

Interfaces

  • CommentFormInterface
  • CommentListInterface
  • ConfigurableModule
  • FieldtypeLanguageInterface
  • FieldtypePageTitleCompatible
  • HasLookupItems
  • HasRoles
  • InputfieldHasArrayValue
  • Module
  • Saveable
  • TrackChanges

Exceptions

  • ProcessController404Exception
  • ProcessControllerPermissionException
  • Wire404Exception
  • WireDatabaseException
  • WireException
  • WirePermissionException

Functions

  • __
  • _n
  • _x
  • fuel
  • identify_modifier_markdown
  • Markdown
  • mdwp_add_p
  • mdwp_hide_tags
  • mdwp_show_tags
  • mdwp_strip_p
  • ProcessWireClassLoader
  • ProcessWireHostSiteConfig
  • ProcessWireShutdown
  • removeNewlines
  • SmartDashes
  • SmartEllipsis
  • SmartQuotes
  • smarty_modifier_markdown
  • smarty_modifier_smartypants
  • SmartyPants
  • tabIndent
  • unregisterGLOBALS
  • wire
  • wireDecodeJSON
  • wireEncodeJSON
  • wireMkdir
  • Overview
  • Namespace
  • Class
  • Tree
  • Download

Class FieldtypeMulti

ProcessWire FieldtypeMulti

Interface and some functionality for Fieldtypes that can contain multiple values.

ProcessWire 2.x Copyright (C) 2010 by Ryan Cramer Licensed under GNU/GPL v2, see LICENSE.TXT

http://www.processwire.com http://www.ryancramer.com

Wire implements TrackChanges
Extended by WireData implements IteratorAggregate
Extended by Fieldtype implements Module
Extended by FieldtypeMulti
Abstract
Located at core/FieldtypeMulti.php
Methods summary
public array
# getDatabaseSchema( Field $field )

Modify the default schema provided by Fieldtype to include a 'sort' field, and integrate that into the primary key.

Modify the default schema provided by Fieldtype to include a 'sort' field, and integrate that into the primary key.

Parameters

$field
Field
In case it's needed for the schema, but usually should not.

Returns

array
public Fieldtypes|null
# ___getCompatibleFieldtypes( Field $field )

Get an array of Fieldtypes that are compatible with this one (i.e. ones the user may change the type to)

Get an array of Fieldtypes that are compatible with this one (i.e. ones the user may change the type to)

Parameters

$field
Field
Just in case it's needed

Returns

Fieldtypes|null
public string|integer|object
# getBlankValue( Page $page, Field $field )

Per Fieldtype interface, return a blank value of this Fieldtype

Per Fieldtype interface, return a blank value of this Fieldtype

Parameters

$page
Page
$field
Field

Returns

string|integer|object
public string|integer|WireArray|object
# sanitizeValue( Page $page, Field $field, string|integer|WireArray|object $value )

Per the Fieldtype interface, sanitize the combined value for use in a Page

Per the Fieldtype interface, sanitize the combined value for use in a Page

In this case, make sure that it's a WireArray (able to hold multiple values)

Parameters

$page
Page
$field
Field
$value
string|integer|WireArray|object

Returns

string|integer|WireArray|object
public string|integer|array|object
# ___wakeupValue( Page $page, Field $field, string|integer|array $value )

Process the value to convert it from array to whatever object it needs to be

Process the value to convert it from array to whatever object it needs to be

Parameters

$page
Page
$field
Field
$value
string|integer|array

Returns

string|integer|array|object
$value
public string|integer
# ___sleepValue( Page $page, Field $field, string|integer|array|object $value )

Given an 'awake' value, as set by wakeupValue, convert the value back to a basic type for storage in DB.

Given an 'awake' value, as set by wakeupValue, convert the value back to a basic type for storage in DB.

FieldtypeMulti::savePageField expects values as an array, so we convert the $value object to an array

Note that FieldtypeMulti is designed around potentially supporting more than just the 'data' field in the table, so other fieldtypes may want to override this and return an array of associative arrays containing a 'data' field and any other fields that map to the table. i.e. $values[] = array('data' => $data, 'description' => $description), etc. See FieldtypePagefiles module class for an example of this.

Parameters

$page
Page
$field
Field
$value
string|integer|array|object

Returns

string|integer
public boolean
# ___savePageField( Page $page, Field $field )

Per the Fieldtype interface, Save the given Field from the given Page to the database

Per the Fieldtype interface, Save the given Field from the given Page to the database

Because the number of values may have changed, this method plays it safe and deletes all the old values and reinserts them as new.

Parameters

$page
Page
$field
Field

Returns

boolean
public DatabaseQuerySelect|null
# getLoadQueryAutojoin( Field $field, DatabaseQuerySelect $query )

Return the query used for Autojoining this field (if different from getLoadQuery) or NULL if autojoin not allowed.

Return the query used for Autojoining this field (if different from getLoadQuery) or NULL if autojoin not allowed.

Parameters

$field
Field
$query
DatabaseQuerySelect

Returns

DatabaseQuerySelect|null
public DatabaseQuery
# getMatchQuery( DatabaseQuerySelect $query, string $table, string $subfield, string $operator, mixed $value )

Get the query that matches a Fieldtype table's data with a given value

Get the query that matches a Fieldtype table's data with a given value

Possible template method: If overridden, children should NOT call this parent method.

Parameters

$query
DatabaseQuerySelect
$table
string
The table name to use
$subfield
string
$field Name of the field (typically 'data', unless selector explicitly specified another)
$operator
string
The comparison operator
$value
mixed
The value to find

Returns

DatabaseQuery
$query
Methods inherited from Fieldtype
___createField(), ___deleteField(), ___deletePageField(), ___formatValue(), ___getConfigAdvancedInputfields(), ___getConfigInputfields(), ___install(), ___loadPageField(), ___uninstall(), __toString(), get(), getDefaultValue(), getInputfield(), getLoadQuery(), getModuleInfo(), init(), isAdvanced(), isAutoload(), isSingular(), trimDatabaseSchema()
Methods inherited from WireData
__get(), __isset(), __set(), __unset(), getArray(), getIterator(), has(), isEqual(), remove(), set(), setArray()
Methods inherited from Wire
_(), ___changed(), __call(), _n(), _x(), addHook(), addHookAfter(), addHookBefore(), addHookProperty(), className(), error(), fuel(), getAllFuel(), getChanges(), getFuel(), getHooks(), isChanged(), isHooked(), message(), removeHook(), resetTrackChanges(), runHooks(), setFuel(), setTrackChanges(), trackChange(), trackChanges(), untrackChange(), useFuel()
Constants summary
string multiValueSeparator "\0,"
#

Separator for multi values when using GROUP_CONCAT()

Separator for multi values when using GROUP_CONCAT()

TODO sanitize set() values from ever containing this separator

Properties summary
protected static integer $getMatchQueryCount 0
#

For internal use to count the number of calls to getMatchQuery

For internal use to count the number of calls to getMatchQuery

Used for creating unique table names to the same field in the same query

Properties inherited from WireData
$data
Properties inherited from Wire
$changes, $defaultHookOptions, $fuel, $hookMethodCache, $localHooks, $staticHooks, $trackChanges, $useFuel
ProcessWire API documentation generated by ApiGen 2.6.0