FieldHandlerInterface
interface FieldHandlerInterface implements ViewsHandlerInterface (View source)
Base field handler that has no options and renders an unformatted field.
Methods
Gets the definition of the plugin implementation.
Gets the base_plugin_id of the plugin instance.
Gets the derivative_id of the plugin instance.
Filter out stored options depending on the defined options.
Moves form elements into fieldsets for presentation purposes.
{@inheritdoc}
Initialize the plugin.
Handle any special handling on the validate form.
Adds elements for available core tokens to a form.
Returns an array of available token replacements.
Flattens the structure of form elements.
Returns a string with any core tokens replaced.
Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
Provide a form to edit options for this plugin.
Provide a full list of possible theme templates used by this style.
Determines if the handler is considered 'broken', meaning it's a placeholder used when a handler can't be found.
Ensure the main table for this handler is in the query. This is used a lot.
Sanitize the value for output.
Fetches a handler to join one table to a primary table from the data cache.
Run after the view is executed, before the result is cached.
Called just prior to query(), this lets a handler set up any relationship it needs.
Return a string representing this handler's name in the UI.
Breaks x,y,z and x+y+z into an array.
Adds an ORDER BY clause to the query for click sort columns.
Determines if this field is click sortable.
Gets this field's label.
Returns an HTML element based upon the field's element type.
Returns an HTML element for the label based upon the field's element type.
Returns an HTML element for the wrapper based upon the field's element type.
Provides a list of elements valid for field HTML.
Returns the class of the field.
Replaces a value with tokens from the last field.
Returns the class of the field's label.
Returns the class of the field's wrapper.
Determines if this field will be available as an option to group the result by in the style settings.
Checks if a field value is empty.
Performs an advanced text render for the item.
Gets the 'render' tokens to use for advanced rendering.
Details
string
getPluginId()
Gets the plugin_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
string
getBaseId()
Gets the base_plugin_id of the plugin instance.
string|null
getDerivativeId()
Gets the derivative_id of the plugin instance.
string
getProvider()
Returns the plugin provider.
pluginTitle()
Return the human readable name of the display.
This appears on the ui beside each plugin and beside the settings link.
usesOptions()
Returns the usesOptions property.
filterByDefinedOptions(array $storage)
Filter out stored options depending on the defined options.
validateOptionsForm($form, FormStateInterface $form_state)
Validate the options form.
summaryTitle()
Returns the summary of the settings in the display.
static array
preRenderAddFieldsetMarkup(array $form)
Moves form elements into fieldsets for presentation purposes.
Many views forms use #tree = TRUE to keep their values in a hierarchy for easier storage. Moving the form elements into fieldsets during form building would break up that hierarchy. Therefore, we wait until the pre_render stage, where any changes we make affect presentation only and aren't reflected in $form_state->getValues().
static
create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
{@inheritdoc}
init(ViewExecutable $view, DisplayPluginBase $display, array $options = NULL)
Initialize the plugin.
submitOptionsForm($form, FormStateInterface $form_state)
Handle any special handling on the validate form.
globalTokenForm(array $form, FormStateInterface $form_state)
Adds elements for available core tokens to a form.
array
getAvailableGlobalTokens(bool $prepared = FALSE, array $types = [])
Returns an array of available token replacements.
static array
preRenderFlattenData(array $form)
Flattens the structure of form elements.
If a form element has #flatten = TRUE, then all of its children get moved to the same level as the element itself. So $form['to_be_flattened'][$key] becomes $form[$key], and $form['to_be_flattened'] gets unset.
string
globalTokenReplace(string $string = '', array $options = [])
Returns a string with any core tokens replaced.
destroy()
Clears a plugin.
An
validate()
Validate that the plugin is correct and can be saved.
query()
Add anything to the query that we might need to.
unpackOptions($storage, $options, $definition = NULL, $all = TRUE, $check = TRUE)
Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away.
buildOptionsForm($form, FormStateInterface $form_state)
Provide a form to edit options for this plugin.
themeFunctions()
Provide a full list of possible theme templates used by this style.
preQuery()
Run before the view is built.
This gives all the handlers some time to set up before any handler has been fully run.
string
getEntityType()
Determines the entity type used by this handler.
If this handler uses a relationship, the base class of the relationship is taken into account.
broken()
Determines if the handler is considered 'broken', meaning it's a placeholder used when a handler can't be found.
ensureMyTable()
Ensure the main table for this handler is in the query. This is used a lot.
bool
access(AccountInterface $account)
Check whether given user has access to this handler.
getJoin()
Get the join object that should be used for this handler.
This method isn't used a great deal, but it's very handy for easily getting the join if it is necessary to make some changes to it, such as adding an 'extra'.
ViewsRenderPipelineMarkup
sanitizeValue($value, $type = NULL)
Sanitize the value for output.
static JoinPluginBase
getTableJoin(string $table, string $base_table)
Fetches a handler to join one table to a primary table from the data cache.
getField($field = NULL)
Shortcut to get a handler's raw field value.
This should be overridden for handlers with formulae or other non-standard fields. Because this takes an argument, fields overriding this can just call return parent::getField($formula)
postExecute($values)
Run after the view is executed, before the result is cached.
This gives all the handlers some time to modify values. This is primarily used so that handlers that pull up secondary data can put it in the $values so that the raw data can be used externally.
showExposeForm($form, FormStateInterface $form_state)
Shortcut to display the exposed options form.
setRelationship()
Called just prior to query(), this lets a handler set up any relationship it needs.
adminLabel($short = FALSE)
Return a string representing this handler's name in the UI.
static object
breakString(string $str, bool $force_int = FALSE)
Breaks x,y,z and x+y+z into an array.
adminSummary()
Provide text for the administrative summary.
clickSort(string $order)
Adds an ORDER BY clause to the query for click sort columns.
bool
clickSortable()
Determines if this field is click sortable.
label()
Gets this field's label.
elementType(bool $none_supported = FALSE, bool $default_empty = FALSE, bool $inline = FALSE)
Returns an HTML element based upon the field's element type.
elementLabelType(bool $none_supported = FALSE, bool $default_empty = FALSE)
Returns an HTML element for the label based upon the field's element type.
elementWrapperType(bool $none_supported = FALSE, bool $default_empty = FALSE)
Returns an HTML element for the wrapper based upon the field's element type.
getElements()
Provides a list of elements valid for field HTML.
This function can be overridden by fields that want more or fewer elements available, though this seems like it would be an incredibly rare occurrence.
elementClasses(bool $row_index = NULL)
Returns the class of the field.
tokenizeValue(string $value, bool $row_index = NULL)
Replaces a value with tokens from the last field.
This function actually figures out which field was last and uses its tokens so they will all be available.
elementLabelClasses(bool $row_index = NULL)
Returns the class of the field's label.
elementWrapperClasses(bool $row_index = NULL)
Returns the class of the field's wrapper.
EntityInterface|null
getEntity(ResultRow $values)
Gets the entity matching the current row and relationship.
getValue(ResultRow $values, string $field = NULL)
Gets the value that's supposed to be rendered.
This api exists so that other modules can easy set the values of the field without having the need to change the render method as well.
bool
useStringGroupBy()
Determines if this field will be available as an option to group the result by in the style settings.
preRender(ResultRow[] $values)
Runs before any fields are rendered.
This gives the handlers some time to set up before any handler has been rendered.
string|MarkupInterface
render(ResultRow $values)
Renders the field.
string[]
postRender(ResultRow $row, $output)
Runs after every field has been rendered.
This is meant to be used mainly to deal with field handlers whose output cannot be cached at row level but can be cached at display level. The typical example is the row counter. For completely uncacheable field output placeholders should be used.
string|MarkupInterface
advancedRender(ResultRow $values)
Renders a field using advanced settings.
This renders a field normally, then decides if render-as-link and text-replacement rendering is necessary.
bool
isValueEmpty($value, bool $empty_zero, bool $no_skip_empty = TRUE)
Checks if a field value is empty.
string|MarkupInterface
renderText(array $alter)
Performs an advanced text render for the item.
This is separated out as some fields may render lists, and this allows each item to be handled individually.
array
getRenderTokens(mixed $item)
Gets the 'render' tokens to use for advanced rendering.
This runs through all of the fields and arguments that are available and gets their values. This will then be used in one giant str_replace().
string|MarkupInterface
theme(ResultRow $values)
Renders row values using $this->themeFunctions() as #theme.