41 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			41 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * @file
							 | 
						||
| 
								 | 
							
								 * Holds datetime views field data helper for deprecation.
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use Drupal\field\FieldStorageConfigInterface;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * Provides Views integration for any datetime-based fields.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * Overrides the default Views data for datetime-based fields, adding datetime
							 | 
						||
| 
								 | 
							
								 * views plugins. Modules defining new datetime-based fields may use this
							 | 
						||
| 
								 | 
							
								 * function to simplify Views integration.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @param \Drupal\field\FieldStorageConfigInterface $field_storage
							 | 
						||
| 
								 | 
							
								 *   The field storage config entity.
							 | 
						||
| 
								 | 
							
								 * @param array $data
							 | 
						||
| 
								 | 
							
								 *   Field view data or
							 | 
						||
| 
								 | 
							
								 *   FieldViewsDataProvider::defaultFieldImplementation($field_storage) if
							 | 
						||
| 
								 | 
							
								 *   empty.
							 | 
						||
| 
								 | 
							
								 * @param string $column_name
							 | 
						||
| 
								 | 
							
								 *   The schema column name with the datetime value.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @return array
							 | 
						||
| 
								 | 
							
								 *   The array of field views data with the datetime plugin.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @see datetime_field_views_data()
							 | 
						||
| 
								 | 
							
								 * @see datetime_range_field_views_data()
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 * @deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use
							 | 
						||
| 
								 | 
							
								 * \Drupal::service('datetime.views_helper')
							 | 
						||
| 
								 | 
							
								 * ->buildViewsData($field_storage, $data, $column_name); instead.
							 | 
						||
| 
								 | 
							
								 * @see https://www.drupal.org/node/3489502
							 | 
						||
| 
								 | 
							
								 */
							 | 
						||
| 
								 | 
							
								function datetime_type_field_views_data_helper(FieldStorageConfigInterface $field_storage, array $data, $column_name) {
							 | 
						||
| 
								 | 
							
								  @trigger_error('datetime_type_field_views_data_helper() is deprecated in drupal:11.2.0 and is removed from drupal:12.0.0. Use \Drupal::service(\'datetime.views_helper\')->buildViewsData($field_storage, $data, $column_name). See https://www.drupal.org/node/3489502', E_USER_DEPRECATED);
							 | 
						||
| 
								 | 
							
								  return \Drupal::service('datetime.views_helper')->buildViewsData($field_storage, $data, $column_name);
							 | 
						||
| 
								 | 
							
								}
							 |