Backdrop needs a system to enable modules to easily and safely add views and layouts to a sites config folder. Then modules can add "Features" with a combination of views and layouts config files.
This can be done now by having the views and layouts in the modules /config folder which are automatically added to the sites config folder. An example of a WP blog "features" modules that will do this is here https://github.com/behindthepage/blog But the danger with this approach is that these files may over write files with the same name or create views and layouts with duplicate paths and the views and layouts are not removed when the module is disabled and uninstalled.
I envisage a system where a module can declare it's "addon" views and layouts and when enabled Backdrop checks that there are no naming or path issues and when disabled Backdrop disabled the views and layouts and deletes them when uninstalled maybe asking the user to confirm the deletion.
To make this work I suggest adding a hook_register_addons() function to the module's install file and having an extra folder in the module folder for the addon views and layouts.
So to modify my blog example The views and layout files would be in blog/addons
blog/addons/layout.layout.news.json blog/addons/views.view.archives.json blog/addons/views.view.news.json blog/addons/views.view.tags.json
and the function in the install file would be
function blog_register_addons() {
$addons['blog'] = array(
'description' => 'Provides a blog and archive pages.',
'config_files' => array(
'views.view.blog_news' => array(
'description' => 'Provides a blog view.',
),
'views.view.blog_archives' => array(
'description' => 'Provides an archive page and archive navigation block.',
),
'views.view.blog_tags' => array(
'description' => 'Provides a tags block.',
),
'layout.layout.blog_news' => array(
'description' => 'Provides a loyout for the blog page at /news.',
),
),
);
return $addons;
}
When the module is enables backdrop would check that there is no naming issues, warn of any path issues and copy these files into the sites config folder.
When the module is disabled or uninstalled a information pane would appear explaining what the views and layouts did and asking for confirmation that thay can be deleted. It could also explain to get them back you can just enable the module again.
I have used the name "addons" but it could be blog_register_feature() blog_register_package() or something else.
Related discussions: https://github.com/backdrop/backdrop-issues/issues/1045 https://github.com/backdrop/backdrop-issues/issues/881
What does everyone think?
Regards Geoff
Recent comments
Glad it works for you! Regarding selecting options, I've just tested the Views Autocomplete Filters module and got it working after I had a look at the README and made sure to use the same...
Can't filter content in a View
You are right, that was it... Now my problem is I would like users being able to select from pre-established options, like a drop down or maybe an autocomplete. For that I would the Autocomplete...
Can't filter content in a View
Here goes the screenshot for the exposed filter config I will try the module you are telling me about. thanks again!
Can't filter content in a View