Custom Attributes on Dashboard page

Permalink
Hello,

I want to create a settings page for a C5 website that gives the admins the ability to switch content and functionality on and off.

I could do this by creating a page with custom attributes and only making it viewable by admins but I was wondering if there was a better way to do this with a custom dashboard page. I know how to create dashboard pages but can't find any documentation on if you can assign attributes to dashboard pages.

Any help or advice would be appreciated on the best approach.

 
JohntheFish replied on at Permalink Reply
JohntheFish
Rather than assign attributes, the kind of global settings you are thinking could be stored as entries in the database Config table.

See
http://www.concrete5.org/documentation/how-tos/developers/use-the-c...
A3020 replied on at Permalink Reply
A3020
Creating a dashboard page etc. could be hard. Or you need a package where you can save / edit /add config values. Don't know what your level of experience is?

Otherwise you'd just assign the attributes to a normal page. In the code where you want to switch functionality you can do something like:

$page = Page::getByID(1);
if($page->getAttribute('some_checkbox')){
  // some functionality
} else {
  // other functionality
}
JohntheFish replied on at Permalink Reply
JohntheFish
If you wanted to avoid code completely, you could do the whole thing with magic data.