First off, thanks for the module: In combination with spaces it is a really valuable tool!

I wanted to ask if and how it is possible to use a color value that is specified as a sitewide default in the according features menu / theme settings as a default for all spaces instead of the default value specified in the .info-file.

Basically I guess it comes down to loading the sitewide space and loading the default value specified in the info file and swapping the former if the latter is given. I just can't figure out how to get those values.

It would be great if I could allow a site admin to define the overall look for a site and allow him to override individual spaces if necessary.

Maybe someone could give me a hint? It would be greatly appreciated.

Comments

archnode’s picture

Status: Active » Fixed

After reviewing the spaces documentation I found the solution:

yourmodule_form_spaces_features_form_alter(&$form, &$form_state) {
  //Gets the original designkit color values
  $colors = $space->controllers->variable->get('designkit_color', 'original');
  //Sets the default value for the form
  $form['designkit_color']['your_color']['#default_value'] = $colors['your_color'];
  //Optionally makes the form inaccessible for Users that don't have the role "Admin"
  global $user;
  if (!in_array('Admin', $user->roles))
  {
    $form['designkit_color']['your_color']['#access'] = false;
  }
}

Naturally the "yourmodule" and "your_color" portions of the code have to be changed to your own module / variables.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.