August 29th, 2021  |  Victor Paredes

Statamic Setup Extra Credit Tasks

This is a quick list of some extra credit things that you can do when you set up your Statamic app. Not every app needs each of these changes, so pick and choose based on your particular needs.

Disable Control Panel access in Your Production Environment

Some sites don’t require control panel access on Production because all changes are made locally and then pushed to production through some kind of DevOps process. In these cases I like to completely disable the control panel in the production environment. This accomplishes two things: creates a level of security in which your control panel is simply not accessible and also prevents a developer from accidentally making changes on production when they may think they are in their development environment. I’ve never done that, I swear...

Anyhow, in order to disable the cp on production, we will add a simple conditional at the top of the config/statamic/cp.php file.

 
config
statamic
cp.php
 
config
statamic
lazy_logo.php

Add Custom CSS to the Control Panel

Often times, there are little things that you will want to change about the Control Panel that will increase usability. One of the things that I like to do is force minimum sizes for input fields within the Grid Fieldtype. This helps when I need to add more than a couple columns within a Grid field. Here's how it looks before and after:

After: Ahh! now we can see all of our data. πŸ₯³
Before: A little crowded before CSS Updates.

In order to accomplish this, we will need to create a new css file and then tell Statamic where to look for it. Statamic ships with the necessary code for this, so we will only need to uncomment a line in app/Providers/AppServiceProvider.php.

Click on each file to see diffs.
app
Providers
AppServiceProvider.php
public
vendor
app
css
cp.css

Feel free to pick and choose from my default control panel css overrides (below) or write your own! I keep this updated as additional edge cases present themselves.

Meet the Author
 

Victor Paredes is a web and print designer. When not hard at work, you can find him tinkering around with code, music, artwork, and archaic poetic structures. He is based in Portland, Oregon.
 
Close