Skip to content
Snippets Groups Projects
Commit 42217163 authored by John Voskuilen's avatar John Voskuilen
Browse files

Issue #3499896: Error: Call to undefined function --> move views.inc file into .module file

parent 26b0115d
No related branches found
No related tags found
No related merge requests found
Pipeline #396904 passed with warnings
......@@ -7,7 +7,12 @@
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\office_hours\Plugin\Field\FieldType\OfficeHoursItemBase;
use Drupal\office_hours\Plugin\views\field\FieldBase;
use Drupal\office_hours\Plugin\views\filter\OfficeHoursStatusFilter;
use Drupal\views\Plugin\views\cache\CachePluginBase;
use Drupal\views\ViewExecutable;
// Include file, avoiding container error during upgrade.
if (\Drupal::hasContainer()) {
......@@ -15,8 +20,6 @@ if (\Drupal::hasContainer()) {
\Drupal::moduleHandler()->loadInclude('office_hours', 'inc', 'office_hours.theme');
// Add ExceptionItem field formatter theming/preprocessing.
\Drupal::moduleHandler()->loadInclude('office_hours', 'inc', 'office_hours.theme.exceptions');
// Add views hooks.
\Drupal::moduleHandler()->loadInclude('office_hours', 'inc', 'office_hours.views');
}
/**
......@@ -68,6 +71,45 @@ function office_hours_form_field_storage_config_edit_form_alter(&$form, FormStat
}
}
/**
* Implements hook_field_views_data().
*/
function office_hours_field_views_data(FieldStorageConfigInterface $field_storage) {
$data = views_field_default_views_data($field_storage);
$data = OfficeHoursStatusFilter::viewsFieldData($field_storage, $data);
$data = FieldBase::viewsFieldData($field_storage, $data);
return $data;
}
/**
* Implements hook_views_query_substitutions().
*/
function office_hours_views_query_substitutions(ViewExecutable $view) {
return OfficeHoursStatusFilter::viewsQuerySubstitutions($view);
}
/**
* Implements hook_views_post_execute().
*/
function office_hours_views_post_execute(ViewExecutable $view) {
return OfficeHoursStatusFilter::viewsPostExecute($view);
}
/**
* Implements hook_views_pre_render().
*/
function office_hours_views_pre_render(ViewExecutable $view) {
return OfficeHoursStatusFilter::viewsPreRender($view);
}
/**
* Implements hook_views_post_render().
*/
function office_hours_views_post_render(ViewExecutable $view, array &$output, CachePluginBase $cache) {
return OfficeHoursStatusFilter::viewsPostRender($view, $output, $cache);
}
/**
* Implements hook_office_hours_time_format_alter().
*/
......
<?php
/**
* @file
* Provides views data for the office_hours module.
*
* @ingroup views_module_handlers
*/
use Drupal\field\FieldStorageConfigInterface;
use Drupal\office_hours\Plugin\views\field\FieldBase;
use Drupal\office_hours\Plugin\views\filter\OfficeHoursStatusFilter;
use Drupal\views\Plugin\views\cache\CachePluginBase;
use Drupal\views\ViewExecutable;
/**
* Implements hook_field_views_data().
*/
function office_hours_field_views_data(FieldStorageConfigInterface $field_storage) {
$data = views_field_default_views_data($field_storage);
$data = OfficeHoursStatusFilter::viewsFieldData($field_storage, $data);
$data = FieldBase::viewsFieldData($field_storage, $data);
return $data;
}
/**
* Implements hook_views_query_substitutions().
*/
function office_hours_views_query_substitutions(ViewExecutable $view) {
return OfficeHoursStatusFilter::viewsQuerySubstitutions($view);
}
/**
* Implements hook_views_post_execute().
*/
function office_hours_views_post_execute(ViewExecutable $view) {
return OfficeHoursStatusFilter::viewsPostExecute($view);
}
/**
* Implements hook_views_pre_render().
*/
function office_hours_views_pre_render(ViewExecutable $view) {
return OfficeHoursStatusFilter::viewsPreRender($view);
}
/**
* Implements hook_views_post_render().
*/
function office_hours_views_post_render(ViewExecutable $view, array &$output, CachePluginBase $cache) {
return OfficeHoursStatusFilter::viewsPostRender($view, $output, $cache);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment