Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
office_hours
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
office_hours
Commits
42217163
Commit
42217163
authored
4 months ago
by
John Voskuilen
Browse files
Options
Downloads
Patches
Plain Diff
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
4 months ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
office_hours.module
+44
-2
44 additions, 2 deletions
office_hours.module
office_hours.views.inc
+0
-53
0 additions, 53 deletions
office_hours.views.inc
with
44 additions
and
55 deletions
office_hours.module
+
44
−
2
View file @
42217163
...
...
@@ -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().
*/
...
...
This diff is collapsed.
Click to expand it.
office_hours.views.inc
deleted
100644 → 0
+
0
−
53
View file @
26b0115d
<?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
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment