Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
306
Merge Requests
306
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
3edf19ce
Commit
3edf19ce
authored
Aug 27, 2012
by
dawehner
Committed by
tim.plunkett
Oct 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the status of a view in the UI
parent
74e8a3db
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
plugins/export_ui/views_ui.class.php
plugins/export_ui/views_ui.class.php
+7
-1
views.install
views.install
+1
-0
views.module
views.module
+26
-1
No files found.
plugins/export_ui/views_ui.class.php
View file @
3edf19ce
...
...
@@ -361,7 +361,13 @@ function add_template_page($js, $input, $name, $step = NULL) {
}
function
set_item_state
(
$state
,
$js
,
$input
,
$item
)
{
ctools_export_set_object_status
(
$item
,
$state
);
if
(
!
$state
)
{
$item
->
enable
();
}
else
{
$item
->
disable
();
}
$item
->
save
();
menu_router_rebuild
();
if
(
!
$js
)
{
...
...
views.install
View file @
3edf19ce
...
...
@@ -38,6 +38,7 @@ function views_schema() {
'load all callback'
=>
'views_get_all_views'
,
'load callback'
=>
'views_storage_load'
,
'save callback'
=>
'views_storage_save'
,
'status callback'
=>
'views_storage_status'
,
'subrecords callback'
=>
'views_load_display_records'
,
// the variable that holds enabled/disabled status
'status'
=>
'views_defaults'
,
...
...
views.module
View file @
3edf19ce
...
...
@@ -1575,7 +1575,7 @@ function views_get_all_views($reset = FALSE) {
}
/**
* Load
s
a view with the storage controller.
* Load a view with the storage controller.
*
* @param string $id
* The view name to load.
...
...
@@ -1589,11 +1589,36 @@ function views_storage_load($id) {
return
reset
(
$result
);
}
/**
* Save a view with the storage controller.
*
* @param Drupal\views\View $view
* The view which is saved.
*
* @return
* SAVED_NEW or SAVED_UPDATED is returned depending on the operation
* performed.
*/
function
views_storage_save
(
View
$view
)
{
$controller
=
entity_get_controller
(
'view'
);
return
$controller
->
save
(
$view
);
}
/**
* Change the status of a view.
*
* @param Drupal\views\View $view
* The view which gets a different status.
*/
function
views_storage_status
(
View
$view
,
$status
)
{
if
(
!
$status
)
{
$view
->
enable
();
}
else
{
$view
->
disable
();
}
}
/**
* Returns an array of all enabled views, as fully loaded $view objects.
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment