Private static $variable List


#1

Hi, i was wondering if there is a list or something with all the private static variables that we can use in our silverstripe project, something similar for what we have our .env file.

https://docs.silverstripe.org/en/4/getting_started/environment_management?_ga=2.135499318.644508592.1548401885-1930916020.1546847324

This can be very handy for new users (like me) to have a single place with all the information we might need to customize our project.

Some examples of what i mean by private static variables:
-private static $summary_fields

  • private static $singular_name
  • private static $menu_priority

#2

There’s not a complete, single list because it changes based on the type of class you’re using.

Data is available for all classes though… for example the page below shows all the properties and methods on DataObject:

https://api.silverstripe.org/4/SilverStripe/ORM/DataObject.html

This is for SiteTree (the parent to your Page classes):

https://api.silverstripe.org/4/SilverStripe/CMS/Model/SiteTree.html

Hope that helps!


#3

Mate, you don’t know how much i’ve been looking for this.
It might not be complete, but it’s definitely a good start, thanks


#4

An alternative (and admittely hackish) way is to inspect the source code for private static. Here is a oneliner that does the job:

grep -or 'private static $\w*' | awk -F'[.:]' '{ if ($1!=g) { print $1; g=$1 } print "\t" substr($3,17) }'

and here is the corresponding results inside vendor/silverstripe/framework/src.