Drupal 8  8.0.2
Field Class Reference
Inheritance diagram for Field:

Public Member Functions

 __construct (array $configuration, $plugin_id, $plugin_definition, EntityManagerInterface $entity_manager, FormatterPluginManager $formatter_plugin_manager, FieldTypePluginManagerInterface $field_type_plugin_manager, LanguageManagerInterface $language_manager, RendererInterface $renderer)
 
 init (ViewExecutable $view, DisplayPluginBase $display, array &$options=NULL)
 
 access (AccountInterface $account)
 
 query ($use_groupby=FALSE)
 
 add_field_table ($use_groupby)
 
 clickSortable ()
 
 clickSort ($order)
 
 buildOptionsForm (&$form, FormStateInterface $form_state)
 
 multiple_options_form (&$form, FormStateInterface $form_state)
 
 buildGroupByForm (&$form, FormStateInterface $form_state)
 
 submitGroupByForm (&$form, FormStateInterface $form_state)
 
 renderItems ($items)
 
 preRender (&$values)
 
 getItems (ResultRow $values)
 
 render_item ($count, $item)
 
 calculateDependencies ()
 
 getCacheMaxAge ()
 
 getCacheContexts ()
 
 getCacheTags ()
 
- Public Member Functions inherited from FieldPluginBase
 init (ViewExecutable $view, DisplayPluginBase $display, array &$options=NULL)
 
 query ()
 
 clickSort ($order)
 
 clickSortable ()
 
 label ()
 
 elementType ($none_supported=FALSE, $default_empty=FALSE, $inline=FALSE)
 
 elementLabelType ($none_supported=FALSE, $default_empty=FALSE)
 
 elementWrapperType ($none_supported=FALSE, $default_empty=FALSE)
 
 getElements ()
 
 elementClasses ($row_index=NULL)
 
 tokenizeValue ($value, $row_index=NULL)
 
 elementLabelClasses ($row_index=NULL)
 
 elementWrapperClasses ($row_index=NULL)
 
 getEntity (ResultRow $values)
 
 getValue (ResultRow $values, $field=NULL)
 
 useStringGroupBy ()
 
 submitOptionsForm (&$form, FormStateInterface $form_state)
 
 buildOptionsForm (&$form, FormStateInterface $form_state)
 
 adminSummary ()
 
 preRender (&$values)
 
 render (ResultRow $values)
 
 postRender (ResultRow $row, $output)
 
 advancedRender (ResultRow $values)
 
 isValueEmpty ($value, $empty_zero, $no_skip_empty=TRUE)
 
 renderText ($alter)
 
 theme (ResultRow $values)
 
 themeFunctions ()
 
 adminLabel ($short=FALSE)
 
- Public Member Functions inherited from HandlerBase
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 init (ViewExecutable $view, DisplayPluginBase $display, array &$options=NULL)
 
 adminLabel ($short=FALSE)
 
 getField ($field=NULL)
 
 sanitizeValue ($value, $type=NULL)
 
 buildOptionsForm (&$form, FormStateInterface $form_state)
 
 setModuleHandler (ModuleHandlerInterface $module_handler)
 
 usesGroupBy ()
 
 buildGroupByForm (&$form, FormStateInterface $form_state)
 
 submitGroupByForm (&$form, FormStateInterface $form_state)
 
 hasExtraOptions ()
 
 defineExtraOptions (&$option)
 
 buildExtraOptionsForm (&$form, FormStateInterface $form_state)
 
 validateExtraOptionsForm ($form, FormStateInterface $form_state)
 
 submitExtraOptionsForm ($form, FormStateInterface $form_state)
 
 canExpose ()
 
 defaultExposeOptions ()
 
 exposedInfo ()
 
 buildExposedForm (&$form, FormStateInterface $form_state)
 
 validateExposed (&$form, FormStateInterface $form_state)
 
 submitExposed (&$form, FormStateInterface $form_state)
 
 buildExposeForm (&$form, FormStateInterface $form_state)
 
 validateExposeForm ($form, FormStateInterface $form_state)
 
 submitExposeForm ($form, FormStateInterface $form_state)
 
 showExposeButton (&$form, FormStateInterface $form_state)
 
 showExposeForm (&$form, FormStateInterface $form_state)
 
 access (AccountInterface $account)
 
 preQuery ()
 
 query ()
 
 postExecute (&$values)
 
 setRelationship ()
 
 ensureMyTable ()
 
 adminSummary ()
 
 isExposed ()
 
 isAGroup ()
 
 multipleExposedInput ()
 
 acceptExposedInput ($input)
 
 storeExposedInput ($input, $status)
 
 getJoin ()
 
 validate ()
 
 broken ()
 
 getDateFormat ($format)
 
 getDateField ()
 
 setViewsData (ViewsData $views_data)
 
 getEntityType ()
 
 displayExposedForm ($form, FormStateInterface $form_state)
 
 submitTemporaryForm ($form, FormStateInterface $form_state)
 
- Public Member Functions inherited from PluginBase
 __construct (array $configuration, $plugin_id, $plugin_definition)
 
 init (ViewExecutable $view, DisplayPluginBase $display, array &$options=NULL)
 
 filterByDefinedOptions (array &$storage)
 
 unpackOptions (&$storage, $options, $definition=NULL, $all=TRUE, $check=TRUE)
 
 destroy ()
 
 buildOptionsForm (&$form, FormStateInterface $form_state)
 
 validateOptionsForm (&$form, FormStateInterface $form_state)
 
 submitOptionsForm (&$form, FormStateInterface $form_state)
 
 query ()
 
 themeFunctions ()
 
 validate ()
 
 summaryTitle ()
 
 pluginTitle ()
 
 usesOptions ()
 
 globalTokenReplace ($string= '', array $options=array())
 
 getAvailableGlobalTokens ($prepared=FALSE, array $types=array())
 
 globalTokenForm (&$form, FormStateInterface $form_state)
 
 calculateDependencies ()
 
 getProvider ()
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 
- Public Member Functions inherited from DerivativeInspectionInterface
 getBaseId ()
 
 getDerivativeId ()
 
- Public Member Functions inherited from FieldHandlerInterface
 getRenderTokens ($item)
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
- Static Public Member Functions inherited from FieldPluginBase
static trimText ($alter, $value)
 
- Static Public Member Functions inherited from HandlerBase
static getTableJoin ($table, $base_table)
 
static breakString ($str, $force_int=FALSE)
 
- Static Public Member Functions inherited from PluginBase
static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
static preRenderAddFieldsetMarkup (array $form)
 
static preRenderFlattenData ($form)
 
static queryLanguageSubstitutions ()
 

Data Fields

 $items = array()
 
 $multiple
 
 $limit_values
 
 $base_table
 
- Data Fields inherited from FieldPluginBase
const RENDER_TEXT_PHASE_SINGLE_ITEM = 0
 
const RENDER_TEXT_PHASE_COMPLETELY = 1
 
const RENDER_TEXT_PHASE_EMPTY = 2
 
 $field_alias = 'unknown'
 
 $aliases = array()
 
 $original_value = NULL
 
 $additional_fields = array()
 
- Data Fields inherited from HandlerBase
 $query = NULL
 
 $table
 
 $tableAlias
 
 $actualTable
 
 $realField
 
 $field
 
 $actualField
 
 $relationship = NULL
 
- Data Fields inherited from PluginBase
const INCLUDE_NEGOTIATED = 16
 
const INCLUDE_ENTITY = 32
 
const VIEWS_QUERY_LANGUAGE_SITE_DEFAULT = '***LANGUAGE_site_default***'
 
 $options = array()
 
 $view = NULL
 
 $displayHandler
 
 $definition
 

Protected Member Functions

 getEntityManager ()
 
 getFieldStorageDefinition ()
 
 defineOptions ()
 
 prepareItemsByDelta (array $all_values)
 
 getEntityFieldRenderer ()
 
 createEntityForGroupBy (EntityInterface $entity, ResultRow $row)
 
 documentSelfTokens (&$tokens)
 
 addSelfTokens (&$tokens, $item)
 
 getTableMapping ()
 
- Protected Member Functions inherited from FieldPluginBase
 allowAdvancedRender ()
 
 addAdditionalFields ($fields=NULL)
 
 defineOptions ()
 
 getPreviousFieldLabels ()
 
 renderAltered ($alter, $tokens)
 
 renderTrimText ($alter, $value)
 
 renderAsLink ($alter, $text, $tokens)
 
 getFieldTokenPlaceholder ()
 
 getTokenValuesRecursive (array $array, array $parent_keys=array())
 
 addSelfTokens (&$tokens, $item)
 
 documentSelfTokens (&$tokens)
 
 linkGenerator ()
 
 getRenderer ()
 
- Protected Member Functions inherited from HandlerBase
 defineOptions ()
 
 caseTransform ($string, $option)
 
 getModuleHandler ()
 
 placeholder ()
 
 getViewsData ()
 
- Protected Member Functions inherited from PluginBase
 defineOptions ()
 
 setOptionDefaults (array &$storage, array $options)
 
 doFilterByDefinedOptions (array &$storage, array $options)
 
 viewsTokenReplace ($text, $tokens)
 
 listLanguages ($flags=LanguageInterface::STATE_ALL, array $current_values=NULL)
 
 getRenderer ()
 

Protected Attributes

 $formatterOptions
 
 $entityManager
 
 $formatterPluginManager
 
 $languageManager
 
 $renderer
 
 $fieldTypePluginManager
 
 $entityFieldRenderer
 
- Protected Attributes inherited from FieldPluginBase
 $linkGenerator
 
 $renderer
 
- Protected Attributes inherited from HandlerBase
 $moduleHandler
 
 $viewsData
 
- Protected Attributes inherited from PluginBase
 $usesOptions = FALSE
 
 $renderer
 

Detailed Description

A field that displays entity field data.

Todo:
Rename the class https://www.drupal.org/node/2408667

("field")

Constructor & Destructor Documentation

__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition,
EntityManagerInterface  $entity_manager,
FormatterPluginManager  $formatter_plugin_manager,
FieldTypePluginManagerInterface  $field_type_plugin_manager,
LanguageManagerInterface  $language_manager,
RendererInterface  $renderer 
)

Constructs a object.

Parameters
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin_id for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe field formatter plugin manager.
\Drupal\Core\Field\FormatterPluginManager$formatter_plugin_managerThe field formatter plugin manager.
\Drupal\Core\Field\FieldTypePluginManagerInterface$field_type_plugin_managerThe field plugin type manager.
\Drupal\Core\Language\LanguageManagerInterface$language_managerThe language manager.
\Drupal\Core\Render\RendererInterface$rendererThe renderer.

References Drupal\entityManager(), and Drupal\languageManager().

Here is the call graph for this function:

Member Function Documentation

access ( AccountInterface  $account)

{Check whether given user has access to this handler.

Parameters
AccountInterface$accountThe user account to check.
Returns
bool TRUE if the user has access to the handler, FALSE otherwise.
}

Implements ViewsHandlerInterface.

References Drupal\entityManager(), and HandlerBase\getEntityType().

Here is the call graph for this function:

add_field_table (   $use_groupby)

Determine if the field table should be added to the query.

Referenced by Field\query().

Here is the caller graph for this function:

buildGroupByForm ( $form,
FormStateInterface  $form_state 
)

Extend the groupby form with group columns.

References t().

Here is the call graph for this function:

buildOptionsForm ( $form,
FormStateInterface  $form_state 
)

{Provide a form to edit options for this plugin.}

Implements ViewsPluginInterface.

References Field\multiple_options_form(), FormHelper\rewriteStatesSelector(), and t().

Here is the call graph for this function:

calculateDependencies ( )

{Calculates dependencies for the configured plugin.Dependencies are saved in the plugin's configuration entity and are used to determine configuration synchronization order. For example, if the plugin integrates with specific user roles, this method should return an array of dependencies listing the specified roles.

Returns
array An array of dependencies grouped by type (config, content, module, theme). For example:
array(
'config' => array('user.role.anonymous', 'user.role.authenticated'),
'content' => array('node:article:f0a189e6-55fb-47fb-8005-5bef81c44d6d'),
'module' => array('node', 'user'),
'theme' => array('seven'),
);
See Also
::getConfigDependencyName()
}

Implements DependentPluginInterface.

clickSort (   $order)

Called to determine what to tell the clicksorter.

Implements FieldHandlerInterface.

References HandlerBase\ensureMyTable(), Field\getFieldStorageDefinition(), Field\getTableMapping(), and FieldPluginBase\query().

Here is the call graph for this function:

clickSortable ( )

{Determines if this field is click sortable.

Returns
bool The value of 'click sortable' from the plugin definition, this defaults to TRUE if not set.
}

Implements FieldHandlerInterface.

static create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

{Creates an instance of the plugin.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe container to pull out services used in the plugin.
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin ID for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
Returns
static Returns an instance of this plugin.
}

Implements ContainerFactoryPluginInterface.

createEntityForGroupBy ( EntityInterface  $entity,
ResultRow  $row 
)
protected

Creates a fake entity with grouped field values.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity to be processed.
\Drupal\views\ResultRow$rowThe result row object containing the values.
Returns
bool| Returns a new entity object containing the grouped field values.
defineOptions ( )
protected

{}

References Field\getFieldStorageDefinition().

Here is the call graph for this function:

getCacheContexts ( )

{The cache contexts associated with this object.These identify a specific variation/representation of the object.Cache contexts are tokens: placeholders that are converted to cache keys by the service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache.

Returns
string[] An array of cache context tokens, used to generate a cache ID.
See Also
::convertTokensToKeys()
}

Implements CacheableDependencyInterface.

getCacheMaxAge ( )

{The maximum age for which this object may be cached.

Returns
int The maximum time in seconds that this object may be cached.
}

Implements CacheableDependencyInterface.

getCacheTags ( )

{The cache tags associated with this object.When this object is modified, these cache tags will be invalidated.

Returns
string[] A set of cache tags.
}

Implements CacheableDependencyInterface.

References CacheableDependencyInterface\getCacheTags().

Here is the call graph for this function:

getEntityFieldRenderer ( )
protected

Returns the entity field renderer.

Returns
The entity field renderer.

Referenced by Field\query().

Here is the caller graph for this function:

getEntityManager ( )
protected

{}

getFieldStorageDefinition ( )
protected

Gets the field storage of the used field.

Returns

References Drupal\entityManager().

Referenced by Field\clickSort(), Field\defineOptions(), and Field\query().

Here is the call graph for this function:

Here is the caller graph for this function:

getItems ( ResultRow  $values)

Gets an array of items for the field.

Parameters
\Drupal\views\ResultRow$valuesThe result row object containing the values.
Returns
array An array of items for the field.

Implements MultiItemsFieldHandlerInterface.

getTableMapping ( )
protected

Gets the table mapping for the entity type of the field.

Returns
The table mapping.

Referenced by Field\clickSort(), and Field\query().

Here is the caller graph for this function:

init ( ViewExecutable  $view,
DisplayPluginBase  $display,
array &  $options = NULL 
)

{Initialize the plugin.

Parameters
\Drupal\views\ViewExecutable$viewThe view object.
\Drupal\views\Plugin\views\display\DisplayPluginBase$displayThe display handler.
array$optionsThe options configured for this plugin.
}

Implements ViewsPluginInterface.

multiple_options_form ( $form,
FormStateInterface  $form_state 
)

Provide options for multiple value fields.

References FieldStorageDefinitionInterface\CARDINALITY_UNLIMITED, and t().

Referenced by Field\buildOptionsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

prepareItemsByDelta ( array  $all_values)
protected

Adapts the $items according to the delta configuration.

This selects displayed deltas, reorders items, and takes offsets into account.

Parameters
array$all_valuesThe items for individual rendering.
Returns
array The manipulated items.

Referenced by Field\renderItems().

Here is the caller graph for this function:

preRender ( $values)

{Runs before any fields are rendered.This gives the handlers some time to set up before any handler has been rendered.

Parameters
\Drupal\views\ResultRow[]$values An array of all ResultRow objects returned from the query.
}

Implements FieldHandlerInterface.

query (   $use_groupby = FALSE)

Called to add the field to a query.

By default, all needed data is taken from entities loaded by the query plugin. Columns are added only if they are used in groupings.

References Field\add_field_table(), FieldPluginBase\addAdditionalFields(), HandlerBase\ensureMyTable(), Field\getEntityFieldRenderer(), Field\getFieldStorageDefinition(), Field\getTableMapping(), and FieldPluginBase\query().

Here is the call graph for this function:

render_item (   $count,
  $item 
)

Renders a single item of a row.

Parameters
int$countThe index of the item inside the row.
mixed$itemThe item for the field to render.
Returns
string The rendered output.

Implements MultiItemsFieldHandlerInterface.

renderItems (   $items)

Render all items in this field together.

When using advanced render, each possible item in the list is rendered individually. Then the items are all pasted together.

Implements MultiItemsFieldHandlerInterface.

References Xss\filterAdmin(), and Field\prepareItemsByDelta().

Here is the call graph for this function:


The documentation for this class was generated from the following file: