DayDate
class DayDate extends Date (View source)
Argument handler for a day.
Traits
A trait containing helper methods for field definitions.
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.
Provides dependency injection friendly methods for serialization.
Provides a trait for the messenger service.
Constants
| DERIVATIVE_SEPARATOR |
A string which is used to separate base plugin IDs from the derivative ID. |
| INCLUDE_NEGOTIATED |
Include negotiated languages when listing languages. |
| INCLUDE_ENTITY |
Include entity row languages when listing languages. |
| VIEWS_QUERY_LANGUAGE_SITE_DEFAULT |
Query string to indicate the site default language. |
Properties
| protected string | $pluginId | The plugin_id. |
from PluginBase |
| protected array | $pluginDefinition | The plugin implementation definition. |
from PluginBase |
| protected array | $configuration | Configuration information passed into the plugin. |
from PluginBase |
| protected TranslationInterface | $stringTranslation | The string translation service. |
from StringTranslationTrait |
| protected array | $_serviceIds | An array of service IDs keyed by property name used for serialization. |
from DependencySerializationTrait |
| protected array | $_entityStorages | An array of entity type IDs keyed by the property name of their storages. |
from DependencySerializationTrait |
| protected MessengerInterface | $messenger | The messenger. |
from MessengerTrait |
| array | $options | Options for this plugin will be held here. |
from PluginBase |
| ViewExecutable | $view | The top object of a view. |
from PluginBase |
| DisplayPluginBase | $displayHandler | The display object this plugin is for. |
from PluginBase |
| array | $definition | Plugins's definition. |
from PluginBase |
| protected bool | $usesOptions | Denotes whether the plugin has an additional options form. |
from PluginBase |
| protected RendererInterface | $renderer | Stores the render API renderer. |
from PluginBase |
| QueryPluginBase | $query | Where the $query object will reside. |
from HandlerBase |
| string | $table | The table this handler is attached to. |
from HandlerBase |
| string | $tableAlias | The alias of the table of this handler which is used in the query. |
from HandlerBase |
| string | $realField | The actual field in the database table, maybe different on other kind of query plugins/special handlers. |
from HandlerBase |
| string | $field | With field you can override the realField if the real field is not set. |
from HandlerBase |
| string | $relationship | The relationship used for this field. |
from HandlerBase |
| protected ModuleHandlerInterface | $moduleHandler | The module handler. |
from HandlerBase |
| protected ViewsData | $viewsData | The views data service. |
from HandlerBase |
| $validator | from ArgumentPluginBase | ||
| $argument | from ArgumentPluginBase | ||
| $value | from ArgumentPluginBase | ||
| string | $name_table | The table to use for the name, should it not be in the same table as the argument. |
from ArgumentPluginBase |
| string | $name_field | The field to use for the name to use in the summary, which is the displayed output. For example, for the node: nid argument, the argument itself is the nid, but node.title is displayed. |
from ArgumentPluginBase |
| $formula | from Formula | ||
| protected string | $format | The date format used in the title. |
from Date |
| protected | $argFormat | {@inheritdoc} | |
| $option_name | from Date | ||
| protected RouteMatchInterface | $routeMatch | The route match. |
from Date |
| protected DateFormatterInterface | $dateFormatter | The date formatter service. |
from Date |
| protected FieldDefinitionInterface | $fieldDefinition | The field definition. |
from FieldAPIHandlerTrait |
| protected FieldStorageConfigInterface | $fieldStorageDefinition | The field storage definition. |
from FieldAPIHandlerTrait |
| protected EntityFieldManagerInterface | $entityFieldManager | The entity field manager. |
from FieldAPIHandlerTrait |
| protected bool | $calculateOffset | Determines if the timezone offset is calculated. |
from Date |
Methods
Constructs a new Date instance.
Translates a string to the current language or to a given language.
Formats a string containing a count of items.
Returns the number of plurals supported by a given language.
Gets the string translation service.
Creates an instance of the plugin.
Overrides Drupal\views\Plugin\views\HandlerBase:init().
Information about options for all kinds of purposes will be held here.
Fills up the options of the plugin with defaults.
Filter out stored options depending on the defined options.
Do the work to filter out stored options depending on the defined options.
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.
Lists the trusted callbacks provided by the implementing class.
Handle any special handling on the validate form.
Provide a full list of possible theme templates used by this style.
Returns a string with any core tokens replaced.
Replaces Views' tokens in a given string. The resulting string will be sanitized with Xss::filterAdmin.
Returns an array of available token replacements.
Adds elements for available core tokens to a form.
Moves form elements into fieldsets for presentation purposes.
Flattens the structure of form elements.
Calculates dependencies for the configured plugin.
Makes an array of languages, optionally including special languages.
Returns substitutions for Views queries for languages.
Return a string representing this handler's name in the UI.
Sanitize the value for output.
Perform any necessary changes to the form values prior to storage.
If a handler has 'extra options' it will get a little settings widget and another form called extra_options.
Perform any necessary changes to the form values prior to storage.
Set new exposed option defaults when exposed setting is flipped on.
Render our chunk of the exposed handler form when selecting.
Perform any necessary changes to the form exposes prior to storage.
Called just prior to query(), this lets a handler set up any relationship it needs.
Ensure the main table for this handler is in the query. This is used a lot.
Determine if this item is 'exposed', meaning it provides form elements to let users modify the view.
Define if the exposed input has to be submitted multiple times.
Take input from exposed handlers and assign to this handler, if necessary.
If set to remember exposed input in the session, store it there.
Determines if the handler is considered 'broken', meaning it's a placeholder used when a handler can't be found.
Fetches a handler to join one table to a primary table from the data cache.
Breaks x,y,z and x+y+z into an array.
A submit handler that is used for storing temporary items when using multi-step changes, such as ajax requests.
Calculates options stored on the handler.
Provide a list of default behaviors for this argument if the argument is not present.
Add an option to set the default value to the current date.
Provide a form for selecting further summary options when the default action is set to display one.
Handle the default action, which means our argument wasn't present.
This just returns true. The view argument builder will know where to find the argument from.
Determine if the argument is set to provide a default argument.
Set the empty argument value to the current date, formatted appropriately for this argument.
Add the name field, which is the field displayed in summary queries.
Some basic summary behavior that doesn't need to be repeated as much as code that goes into summaryQuery()
Sorts the summary based upon the user's selection. The base variant of this is usually adequate.
Provide the argument to use to link from the summary to the next level; this will be called once per row of a summary, and used as part of $view->getUrl().
Provides the name to use for the summary. By default this is just the name field.
Get the title this argument will assign the view, given the argument.
Called by the view object to get the title. This may be set by a validator so we don't necessarily call through to title().
Validate that this argument works. By default, all arguments are valid.
Called by the menu system to validate an argument.
Get the display or row plugin, if it exists.
Custom form radios process function.
Moves argument options into their place.
Sanitize validator options including derivatives with : for js.
Revert sanitized validator options.
Splits an argument into value and operator properties on this instance.
Returns a context definition for this argument.
Gets the field storage configuration.
Returns the entity field manager.
Details
in
Date at line 41
__construct(array $configuration, string $plugin_id, mixed $plugin_definition, RouteMatchInterface $route_match, DateFormatterInterface $date_formatter)
Constructs a new Date instance.
string
getPluginId()
Gets the plugin_id of the plugin instance.
string
getBaseId()
Gets the base_plugin_id of the plugin instance.
string|null
getDerivativeId()
Gets the derivative_id of the plugin instance.
array
getPluginDefinition()
Gets the definition of the plugin implementation.
bool
isConfigurable()
Determines if the plugin is configurable.
protected TranslatableMarkup
t(string $string, array $args = [], array $options = [])
Translates a string to the current language or to a given language.
See \Drupal\Core\StringTranslation\TranslatableMarkup::__construct() for important security information and usage guidelines.
In order for strings to be localized, make them available in one of the ways supported by the
protected
formatPlural($count, $singular, $plural, array $args = [], array $options = [])
Formats a string containing a count of items.
protected
getNumberOfPlurals($langcode = NULL)
Returns the number of plurals supported by a given language.
protected TranslationInterface
getStringTranslation()
Gets the string translation service.
$this
setStringTranslation(TranslationInterface $translation)
Sets the string translation service to use.
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
setMessenger(MessengerInterface $messenger)
Sets the messenger.
MessengerInterface
messenger()
Gets the messenger.
in
Date at line 84
static ContainerFactoryPluginInterface
create(ContainerInterface $container, array $configuration, string $plugin_id, mixed $plugin_definition)
Creates an instance of the plugin.
init(ViewExecutable $view, DisplayPluginBase $display, array $options = NULL)
Overrides Drupal\views\Plugin\views\HandlerBase:init().
protected array
defineOptions()
Information about options for all kinds of purposes will be held here.
protected
setOptionDefaults(array $storage, array $options)
Fills up the options of the plugin with defaults.
filterByDefinedOptions(array $storage)
Filter out stored options depending on the defined options.
protected
doFilterByDefinedOptions(array $storage, array $options)
Do the work to filter out stored options depending on the defined options.
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.
destroy()
Clears a plugin.
buildOptionsForm($form, FormStateInterface $form_state)
Provide a form to edit options for this plugin.
static string[]
trustedCallbacks()
Lists the trusted callbacks provided by the implementing class.
Trusted callbacks are public methods on the implementing class and can be invoked via \Drupal\Core\Security\DoTrustedCallbackTrait::doTrustedCallback().
validateOptionsForm($form, FormStateInterface $form_state)
Validate the options form.
submitOptionsForm($form, FormStateInterface $form_state)
Handle any special handling on the validate form.
query($group_by = FALSE)
Build the query based upon the formula.
themeFunctions()
Provide a full list of possible theme templates used by this style.
An
validate()
Validate that the plugin is correct and can be saved.
summaryTitle()
Returns the summary of the settings in the display.
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.
string
globalTokenReplace(string $string = '', array $options = [])
Returns a string with any core tokens replaced.
protected string
viewsTokenReplace($text, $tokens)
Replaces Views' tokens in a given string. The resulting string will be sanitized with Xss::filterAdmin.
array
getAvailableGlobalTokens(bool $prepared = FALSE, array $types = [])
Returns an array of available token replacements.
globalTokenForm(array $form, FormStateInterface $form_state)
Adds elements for available core tokens to a form.
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 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.
array
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.
string
getProvider()
Returns the plugin provider.
protected array
listLanguages(int $flags = LanguageInterface::STATE_ALL, array $current_values = NULL)
Makes an array of languages, optionally including special languages.
static array
queryLanguageSubstitutions()
Returns substitutions for Views queries for languages.
This is needed so that the language options returned by PluginBase::listLanguages() are able to be used in queries. It is called by the Views module implementation of hook_views_query_substitutions() to get the language-related substitutions.
protected RendererInterface
getRenderer()
Returns the render API renderer.
adminLabel($short = FALSE)
Return a string representing this handler's name in the UI.
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)
ViewsRenderPipelineMarkup
sanitizeValue($value, $type = NULL)
Sanitize the value for output.
protected string
caseTransform($string, $option)
Transform a string by a certain method.
protected ModuleHandlerInterface
getModuleHandler()
Gets the module handler.
setModuleHandler(ModuleHandlerInterface $module_handler)
Sets the module handler.
usesGroupBy()
Provides the handler some groupby.
buildGroupByForm($form, FormStateInterface $form_state)
Provide a form for aggregation settings.
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.
hasExtraOptions()
If a handler has 'extra options' it will get a little settings widget and another form called extra_options.
defineExtraOptions($option)
Provide defaults for the handler.
buildExtraOptionsForm($form, FormStateInterface $form_state)
Provide a form for setting options.
validateExtraOptionsForm($form, FormStateInterface $form_state)
Validate the options form.
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.
canExpose()
Determine if a handler can be exposed.
defaultExposeOptions()
Set new exposed option defaults when exposed setting is flipped on.
exposedInfo()
Get information about the exposed form for the form renderer.
buildExposedForm($form, FormStateInterface $form_state)
Render our chunk of the exposed handler form when selecting.
validateExposed($form, FormStateInterface $form_state)
Validate the exposed handler form.
submitExposed($form, FormStateInterface $form_state)
Submit the exposed handler form.
buildExposeForm($form, FormStateInterface $form_state)
Form for exposed handler options.
validateExposeForm($form, FormStateInterface $form_state)
Validate the options 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.
showExposeButton($form, FormStateInterface $form_state)
Shortcut to display the expose/hide button.
showExposeForm($form, FormStateInterface $form_state)
Shortcut to display the exposed options form.
bool
access(AccountInterface $account)
Check whether given user has access to this handler.
preQuery()
Run before the view is built.
This gives all the handlers some time to set up before any handler has been fully run.
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.
protected string
placeholder()
Provides a unique placeholders for handlers.
setRelationship()
Called just prior to query(), this lets a handler set up any relationship it needs.
ensureMyTable()
Ensure the main table for this handler is in the query. This is used a lot.
adminSummary()
Provide text for the administrative summary.
bool
isExposed()
Determine if this item is 'exposed', meaning it provides form elements to let users modify the view.
isAGroup()
Returns TRUE if the exposed filter works like a grouped filter.
multipleExposedInput()
Define if the exposed input has to be submitted multiple times.
This is TRUE when exposed filters grouped are using checkboxes as widgets.
acceptExposedInput($input)
Take input from exposed handlers and assign to this handler, if necessary.
storeExposedInput($input, $status)
If set to remember exposed input in the session, store it there.
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'.
broken()
Determines if the handler is considered 'broken', meaning it's a placeholder used when a handler can't be found.
in
Date at line 64
string
getDateFormat(string $format)
Creates cross-database SQL date formatting.
in
Date at line 55
string
getDateField()
Creates cross-database SQL dates.
protected ViewsData
getViewsData()
Gets views data service.
setViewsData(ViewsData $views_data)
{@inheritdoc}
static JoinPluginBase
getTableJoin(string $table, string $base_table)
Fetches a handler to join one table to a primary table from the data cache.
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.
static object
breakString(string $str, bool $force_int = FALSE)
Breaks x,y,z and x+y+z into an array.
displayExposedForm($form, FormStateInterface $form_state)
Displays the Expose form.
submitTemporaryForm($form, FormStateInterface $form_state)
A submit handler that is used for storing temporary items when using multi-step changes, such as ajax requests.
array
submitFormCalculateOptions(array $options, array $form_state_options)
Calculates options stored on the handler.
isException($arg = NULL)
No description
exceptionTitle()
No description
bool
needsStylePlugin()
Determine if the argument needs a style plugin.
protected array
getTokenHelp()
Provide token help information for the argument.
protected
defaultActions($which = NULL)
Provide a list of default behaviors for this argument if the argument is not present.
Override this method to provide additional (or fewer) default behaviors.
in
Date at line 97
defaultArgumentForm($form, FormStateInterface $form_state)
Add an option to set the default value to the current date.
defaultSummaryForm($form, FormStateInterface $form_state)
Provide a form for selecting further summary options when the default action is set to display one.
A
defaultAction($info = NULL)
Handle the default action, which means our argument wasn't present.
Override this method only with extreme care.
validateFail()
How to act if validation fails.
defaultIgnore()
Default action: ignore.
If an argument was expected and was not given, in this case, simply ignore the argument entirely.
protected
defaultNotFound()
Default action: not found.
If an argument was expected and was not given, in this case, report the view as 'not found' or hide it.
defaultAccessDenied()
Default action: access denied.
If an argument was expected and was not given, in this case, report the view as 'access denied'.
defaultEmpty()
Default action: empty.
If an argument was expected and was not given, in this case, display the view's empty text
protected
defaultDefault()
This just returns true. The view argument builder will know where to find the argument from.
hasDefaultArgument()
Determine if the argument is set to provide a default argument.
in
Date at line 108
getDefaultArgument($raw = FALSE)
Set the empty argument value to the current date, formatted appropriately for this argument.
processSummaryArguments($args)
Process the summary arguments for display.
For example, the validation plugin may want to alter an argument for use in the URL.
protected
defaultSummary()
Default action: summary.
If an argument was expected and was not given, in this case, display a summary query.
protected The
summaryQuery()
Build the summary query based on a formula.
protected
summaryNameField()
Add the name field, which is the field displayed in summary queries.
This is often used when the argument is numeric.
summaryBasics($count_field = TRUE)
Some basic summary behavior that doesn't need to be repeated as much as code that goes into summaryQuery()
summarySort($order, string|null $by = NULL)
Sorts the summary based upon the user's selection. The base variant of this is usually adequate.
summaryArgument($data)
Provide the argument to use to link from the summary to the next level; this will be called once per row of a summary, and used as part of $view->getUrl().
summaryName($data)
Provides the name to use for the summary. By default this is just the name field.
title()
Get the title this argument will assign the view, given the argument.
This usually needs to be overridden to provide a proper title.
getTitle()
Called by the view object to get the title. This may be set by a validator so we don't necessarily call through to title().
validateArgument($arg)
Validate that this argument works. By default, all arguments are valid.
validateMenuArgument($arg)
Called by the menu system to validate an argument.
This checks to see if this is a 'soft fail', which means that if the argument fails to validate, but there is an action to take anyway, then validation cannot actually fail.
true
setArgument($arg)
Set the input for this argument.
getValue()
Get the value of this argument.
getPlugin($type = 'argument_default', $name = NULL)
Get the display or row plugin, if it exists.
in
Date at line 132
getSortName()
Return a description of how the argument would normally be sorted.
Subclasses should override this to specify what the default sort order of their argument is (e.g. alphabetical, numeric, date).
static
processContainerRadios($element)
Custom form radios process function.
Roll out a single radios element to a list of radios, using the options array as index. While doing that, create a container element underneath each option, which contains the settings related to that option.
static
preRenderMoveArgumentOptions($form)
Moves argument options into their place.
When configuring the default argument behavior, almost each of the radio buttons has its own fieldset shown below it when the radio button is clicked. That fieldset is created through a custom form process callback. Each element that has #argument_option defined and pointing to a default behavior gets moved to the appropriate fieldset. So if #argument_option is specified as 'default', the element is moved to the 'default_options' fieldset.
static string
encodeValidatorId(string $id)
Sanitize validator options including derivatives with : for js.
Reason and alternative: https://www.drupal.org/node/2035345.
static string
decodeValidatorId(string $id)
Revert sanitized validator options.
protected
unpackArgumentValue(bool $force_int = FALSE)
Splits an argument into value and operator properties on this instance.
int
getCacheMaxAge()
The maximum age for which this object may be cached.
string[]
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 @cache_contexts_manager 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.
string[]
getCacheTags()
The cache tags associated with this object.
When this object is modified, these cache tags will be invalidated.
ContextDefinitionInterface|null
getContextDefinition()
Returns a context definition for this argument.
in
Date at line 139
getFormula()
No description
protected FieldDefinitionInterface
getFieldDefinition()
Gets the field definition.
A View works on an entity type across bundles, and thus only has access to field storage definitions. In order to be able to use widgets and formatters, we create a generic field definition out of that storage definition.
protected FieldStorageConfigInterface
getFieldStorageDefinition()
Gets the field storage configuration.
protected EntityFieldManagerInterface
getEntityFieldManager()
Returns the entity field manager.