public __construct ( string $title, string $key, array $location, integer $menu_order = 1, array $settings = [] ) | ||
$title | string | The text to be displayed as title to the administrator. |
$key | string | This must be unique across the site. A god idea is to use the current time and then add a random character. Like so: 1509011031t for September 1st, 2015 @ 10:31. |
$location | array | Where the field group should be displayed. |
$menu_order | integer | Where the field group should be positioned. |
$settings | array | This allows us to set any setting that a field group can have. See $base_settins for available options. |
public function __construct($title, $key, $location, $menu_order = 1, $settings = [])
{
// Since the result of using this class will be an array,
// we might as well store everything in an array right away.
$base_settings = ['key' => $key, 'title' => $title, 'fields' => [], 'location' => $location, 'menu_order' => $menu_order, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => []];
$this->settings = array_merge($base_settings, $settings);
}