Pink-Crab / Perique-Framework

The Perqiue Plugin Framework for WordPress
5 stars 0 forks source link

Default Values in App_Config #30

Closed gin0115 closed 3 years ago

gin0115 commented 3 years ago

It would be nice to have a default/fallback if a value is not set.

This could either be

$config->additional('key', 'The key wasnt set');

or with a custom method

$config->maybe_additional('key', 'The key wasnt set');

gin0115 commented 3 years ago

example of the current process for none set values.

IDEALLY these should be set, but you cant be certain unless its a custom config class for the plugin or theme. The drawback to magic methods!!!!!


register_nav_menus(
  [
    ( $this->config->additional( 'main_nav' ) ?? 'main' ) => $this->translations->global()->primary_nav_label()
  ]
);