Skip to content

Commit

Permalink
Issue #215: Restore Rules Schedule view if needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
bugfolder committed Apr 8, 2024
1 parent 9b54440 commit a2a191c
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 0 deletions.
162 changes: 162 additions & 0 deletions rules_scheduler/config/views.view.rules_scheduler.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
{
"_config_name": "views.view.rules_scheduler",
"name": "rules_scheduler",
"description": "Scheduled Rules components",
"tag": "admin, rules_scheduler",
"base_table": "rules_scheduler",
"core": "0",
"human_name": "Rules Schedule",
"display": {
"default": {
"display_title": "Defaults",
"display_plugin": "default",
"display_options": {
"query": {
"type": "views_query",
"options": []
},
"use_more_always": false,
"access": {
"type": "perm",
"perm": "administer rules"
},
"cache": {
"type": "none"
},
"exposed_form": {
"type": "basic"
},
"pager": {
"type": "full",
"options": {
"items_per_page": "30",
"offset": "0",
"id": "0"
}
},
"style_plugin": "table",
"style_options": {
"columns": {
"tid": "tid",
"config": "config",
"date": "date",
"identifier": "identifier",
"nothing": "nothing"
},
"default": "date",
"info": {
"tid": {
"sortable": 0,
"default_sort_order": "asc",
"align": "",
"separator": ""
},
"config": {
"sortable": 1,
"default_sort_order": "asc",
"align": "",
"separator": ""
},
"date": {
"sortable": 1,
"default_sort_order": "asc",
"align": "",
"separator": ""
},
"identifier": {
"sortable": 1,
"default_sort_order": "asc",
"align": "",
"separator": ""
},
"nothing": {
"align": "",
"separator": ""
}
}
},
"empty": {
"area": {
"id": "area",
"table": "views",
"field": "area",
"content": "No tasks have been scheduled.",
"format": "plain_text"
}
},
"fields": {
"tid": {
"id": "tid",
"table": "rules_scheduler",
"field": "tid"
},
"config": {
"id": "config",
"table": "rules_scheduler",
"field": "config",
"alter": {
"make_link": true,
"path": "admin/config/workflow/rules/components/manage/[config]"
}
},
"date": {
"id": "date",
"table": "rules_scheduler",
"field": "date"
},
"identifier": {
"id": "identifier",
"table": "rules_scheduler",
"field": "identifier"
},
"nothing": {
"id": "nothing",
"table": "views",
"field": "nothing",
"label": "Operations",
"alter": {
"text": "delete",
"make_link": true,
"path": "admin/config/workflow/rules/schedule/[tid]/delete",
"alt": "Delete this scheduled task"
}
}
},
"sorts": {
"date": {
"id": "date",
"table": "rules_scheduler",
"field": "date"
}
},
"arguments": {
"config": {
"id": "config",
"table": "rules_scheduler",
"field": "config",
"default_argument_type": "fixed",
"summary": {
"format": "default_summary"
},
"limit": "0"
}
},
"filters": {
"config": {
"id": "config",
"table": "rules_scheduler",
"field": "config",
"exposed": true,
"expose": {
"operator_id": "config_op",
"label": "Component filter",
"operator": "config_op",
"identifier": "config",
"remember": true
}
}
}
}
}
}
}
15 changes: 15 additions & 0 deletions rules_scheduler/rules_scheduler.install
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,18 @@ function rules_scheduler_update_1200() {
));
}
}

/**
* Install Rules Schedule view if missing.
*/
function rules_scheduler_update_1201() {
$view = views_get_view('rules_scheduler');
if (!$view) {
global $base_url;
$filename = $base_url . '/' . backdrop_get_path('module', 'rules_scheduler') . '/config/views.view.rules_scheduler.json';
$data = backdrop_json_decode(file_get_contents($filename));
module_load_include('inc', 'config', 'config.sync');
config_sync_file('views.view.rules_scheduler', 'create', $data);
views_invalidate_cache();
}
}
11 changes: 11 additions & 0 deletions rules_scheduler/rules_scheduler.module
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,17 @@ function rules_scheduler_rules_config_delete($rules_config) {
}
}

/**
* Implements hook_config_info().
*/
function rules_scheduler_config_info() {
$prefixes['views.view.rules_scheduler'] = array(
'label' => t('Rules Schedule view'),
'group' => t('Views'),
);
return $prefixes;
}

/**
* Implements hook_views_api().
*/
Expand Down

0 comments on commit a2a191c

Please sign in to comment.