Drupal 8  8.0.2
HandlerBase Class Reference
Inheritance diagram for HandlerBase:

Public Member Functions

 __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 ()
 

Static Public Member Functions

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

 $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

 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

 $moduleHandler
 
 $viewsData
 
- Protected Attributes inherited from PluginBase
 $usesOptions = FALSE
 
 $renderer
 

Detailed Description

Base class for Views handler plugins.

Constructor & Destructor Documentation

__construct ( array  $configuration,
  $plugin_id,
  $plugin_definition 
)

Constructs a Handler 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.

Member Function Documentation

acceptExposedInput (   $input)

Take input from exposed handlers and assign to this handler, if necessary.

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.

adminLabel (   $short = FALSE)

{Return a string representing this handler's name in the UI.}

Implements ViewsHandlerInterface.

References t().

Referenced by AreaPluginBase\adminSummary(), Combine\validate(), and InOperator\validate().

Here is the call graph for this function:

Here is the caller graph for this function:

adminSummary ( )

{Provide text for the administrative summary.}

Implements ViewsHandlerInterface.

static breakString (   $str,
  $force_int = FALSE 
)
static

{Breaks x,y,z and x+y+z into an array.

Parameters
string$strThe string to split.
bool$force_intEnforce a numeric check.
Returns
A stdClass object containing value and operator properties.
}

Implements ViewsHandlerInterface.

Referenced by HandlerTest\testBreakString().

Here is the caller graph for this function:

broken ( )

{Determines if the handler is considered 'broken', meaning it's a a placeholder used when a handler can't be found.}

Implements ViewsHandlerInterface.

buildExposedForm ( $form,
FormStateInterface  $form_state 
)

Render our chunk of the exposed handler form when selecting

buildExposeForm ( $form,
FormStateInterface  $form_state 
)

Form for exposed handler options.

Referenced by HandlerBase\showExposeForm().

Here is the caller graph for this function:

buildExtraOptionsForm ( $form,
FormStateInterface  $form_state 
)

Provide a form for setting options.

buildGroupByForm ( $form,
FormStateInterface  $form_state 
)

Provide a form for aggregation settings.

References FormStateInterface\get(), and 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 HandlerBase\getModuleHandler(), and t().

Here is the call graph for this function:

canExpose ( )

Determine if a handler can be exposed.

caseTransform (   $string,
  $option 
)
protected

Transform a string by a certain method.

Parameters
$stringThe input you want to transform.
$optionHow do you want to transform it, possible values:
  • upper: Uppercase the string.
  • lower: lowercase the string.
  • ucfirst: Make the first char uppercase.
  • ucwords: Make each word in the string uppercase.
Returns
string The transformed string.

References Unicode\strtolower(), Unicode\strtoupper(), Unicode\ucfirst(), and Unicode\ucwords().

Here is the call graph for this function:

defaultExposeOptions ( )

Set new exposed option defaults when exposed setting is flipped on.

Referenced by HandlerBase\displayExposedForm().

Here is the caller graph for this function:

defineExtraOptions ( $option)

Provide defaults for the handler.

displayExposedForm (   $form,
FormStateInterface  $form_state 
)

Displays the Expose form.

References HandlerBase\defaultExposeOptions(), FormStateInterface\get(), FormStateInterface\set(), and FormStateInterface\setRebuild().

Here is the call graph for this function:

ensureMyTable ( )

{Ensure the main table for this handler is in the query. This is used a lot.}

Implements ViewsHandlerInterface.

References HandlerBase\query().

Referenced by Field\clickSort(), GroupByNumeric\query(), StatisticsLastUpdated\query(), Thread\query(), UserUid\query(), StatisticsLastCommentName\query(), BooleanOperatorString\query(), Status\query(), Access\query(), Current\query(), SortPluginBase\query(), EntityReverse\query(), Date\query(), Path\query(), Formula\query(), HistoryUserTimestamp\query(), Search\query(), NodeNewComments\query(), Bundle\query(), NodeTermData\query(), RelationshipPluginBase\query(), FieldPluginBase\query(), StringArgument\query(), BooleanOperator\query(), Field\query(), NumericFilter\query(), StringFilter\query(), GroupwiseMax\query(), FilterPluginBase\query(), Formula\summaryQuery(), StringArgument\summaryQuery(), and ArgumentPluginBase\summaryQuery().

Here is the call graph for this function:

Here is the caller graph for this function:

exposedInfo ( )

Get information about the exposed form for the form renderer.

getDateField ( )

Creates cross-database SQL dates.

Returns
string An appropriate SQL string for the db type and field type.

References HandlerBase\query().

Referenced by HandlerBase\getDateFormat().

Here is the call graph for this function:

Here is the caller graph for this function:

getDateFormat (   $format)

Creates cross-database SQL date formatting.

Parameters
string$formatA format string for the result, like 'Y-m-d H:i:s'.
Returns
string An appropriate SQL string for the DB type and field type.

References HandlerBase\getDateField(), and HandlerBase\query().

Referenced by Date\getFormula(), and Date\query().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns
string The machine name of the entity type.
}

Implements ViewsHandlerInterface.

References HandlerBase\getViewsData().

Referenced by Field\access(), BulkForm\getEntityTypeId(), EntityOperations\getEntityTypeId(), Bundle\init(), BulkForm\init(), and BulkForm\loadEntityFromBulkFormKey().

Here is the call graph for this function:

Here is the caller graph for this function:

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)}

Implements ViewsHandlerInterface.

References HandlerBase\query().

Referenced by GroupByNumeric\adminLabel(), and GroupByNumeric\query().

Here is the call graph for this function:

Here is the caller graph for this function:

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'.}

Implements ViewsHandlerInterface.

References HandlerBase\getTableJoin(), and HandlerBase\query().

Here is the call graph for this function:

getModuleHandler ( )
protected

Gets the module handler.

Returns

References Drupal\moduleHandler().

Referenced by HandlerBase\buildOptionsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

static getTableJoin (   $table,
  $base_table 
)
static

{Fetches a handler to join one table to a primary table from the data cache.

Parameters
string$tableThe table to join from.
string$base_tableThe table to join to.
Returns
}

Implements ViewsHandlerInterface.

References Views\pluginManager(), and Views\viewsData().

Referenced by ManyToOneHelper\addTable(), HandlerBase\getJoin(), Sql\getJoinData(), and ArgumentPluginBase\summaryNameField().

Here is the call graph for this function:

Here is the caller graph for this function:

getViewsData ( )
protected

Gets views data service.

Returns

References Views\viewsData().

Referenced by RelationshipPluginBase\calculateDependencies(), and HandlerBase\getEntityType().

Here is the call graph for this function:

Here is the caller graph for this function:

hasExtraOptions ( )

If a handler has 'extra options' it will get a little settings widget and another form called extra_options.

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.

References HandlerBase\query(), and PluginBase\unpackOptions().

Here is the call graph for this function:

isAGroup ( )

Returns TRUE if the exposed filter works like a grouped filter.

isExposed ( )

Determine if this item is 'exposed', meaning it provides form elements to let users modify the view.

Returns
TRUE/FALSE

Referenced by FilterPluginBase\canBuildGroup(), SortPluginBase\getCacheContexts(), FilterPluginBase\getCacheContexts(), and FilterPluginBase\isAGroup().

Here is the caller graph for this function:

multipleExposedInput ( )

Define if the exposed input has to be submitted multiple times. This is TRUE when exposed filters grouped are using checkboxes as widgets.

placeholder ( )
protected

Provides a unique placeholders for handlers.

Returns
string A placeholder which contains the table and the fieldname.

References HandlerBase\query().

Referenced by FieldTest\getPlaceholder(), Formula\query(), Search\query(), and StringArgument\query().

Here is the call graph for this function:

Here is the caller graph for this function:

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.}

Implements ViewsHandlerInterface.

preQuery ( )

{Run before the view is built.This gives all the handlers some time to set up before any handler has been fully run.}

Implements ViewsHandlerInterface.

sanitizeValue (   $value,
  $type = NULL 
)

{Sanitize the value for output.

Parameters
$valueThe value being rendered.
$typeThe type of sanitization needed. If not provided, ::escape() is used.
Returns
Returns the safe value.
}

Implements ViewsHandlerInterface.

References Html\escape(), Xss\filter(), Xss\filterAdmin(), and UrlHelper\stripDangerousProtocols().

Referenced by Title\preRender(), DblogOperations\render(), Url\render(), FieldTest\render(), DblogMessage\render(), File\render(), Node\render(), UserData\render(), NumericField\render(), PrerenderList\renderItems(), LinkBase\renderLink(), and TextCustom\renderTextarea().

Here is the call graph for this function:

Here is the caller graph for this function:

setModuleHandler ( ModuleHandlerInterface  $module_handler)

Sets the module handler.

Parameters
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler.

References Drupal\moduleHandler().

Here is the call graph for this function:

setRelationship ( )

{Called just prior to query(), this lets a handler set up any relationship it needs.}

Implements ViewsHandlerInterface.

setViewsData ( ViewsData  $views_data)

{}

showExposeButton ( $form,
FormStateInterface  $form_state 
)

Shortcut to display the expose/hide button.

showExposeForm ( $form,
FormStateInterface  $form_state 
)

Shortcut to display the exposed options form.

Implements ViewsHandlerInterface.

References HandlerBase\buildExposeForm(), Element\children(), and FormStateInterface\get().

Referenced by SortPluginBase\buildOptionsForm(), and FilterPluginBase\buildOptionsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

storeExposedInput (   $input,
  $status 
)

If set to remember exposed input in the session, store it there.

submitExposed ( $form,
FormStateInterface  $form_state 
)

Submit the exposed handler form

submitExposeForm (   $form,
FormStateInterface  $form_state 
)

Perform any necessary changes to the form exposes prior to storage. There is no need for this function to actually store the data.

Referenced by SortPluginBase\submitOptionsForm(), and FilterPluginBase\submitOptionsForm().

Here is the caller graph for this function:

submitExtraOptionsForm (   $form,
FormStateInterface  $form_state 
)

Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.

submitGroupByForm ( $form,
FormStateInterface  $form_state 
)

Perform any necessary changes to the form values prior to storage. There is no need for this function to actually store the data.

References FormStateInterface\get(), and FormStateInterface\getValue().

Here is the call graph for this function:

submitTemporaryForm (   $form,
FormStateInterface  $form_state 
)

A submit handler that is used for storing temporary items when using multi-step changes, such as ajax requests.

References FormStateInterface\get(), ViewExecutable\getHandlerTypes(), FormStateInterface\getValue(), Views\handlerManager(), FormStateInterface\setRebuild(), and PluginBase\submitOptionsForm().

Here is the call graph for this function:

usesGroupBy ( )

Provides the handler some groupby.

validate ( )

{Validate that the plugin is correct and can be saved.

Returns
An array of error strings to tell the user what is wrong with this plugin.
}

Implements ViewsPluginInterface.

validateExposed ( $form,
FormStateInterface  $form_state 
)

Validate the exposed handler form

validateExposeForm (   $form,
FormStateInterface  $form_state 
)

Validate the options form.

Referenced by SortPluginBase\validateOptionsForm().

Here is the caller graph for this function:

validateExtraOptionsForm (   $form,
FormStateInterface  $form_state 
)

Validate the options form.


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