You are here

function _themekey_properties_set in ThemeKey 6

Function _themekey_properties_set().

2 calls to _themekey_properties_set()
themekey_ui_set_node_theme in ./themekey_ui_helper.inc
Function themekey_ui_set_node_theme().
_themekey_properties_submit in ./themekey_admin.inc
Function _themekey_properties_submit().

File

./themekey_build.inc, line 329

Code

function _themekey_properties_set(&$item) {
  if (preg_match('/' . $item['property'] . '=(.*)/', $item['value'], $matches)) {
    $item['value'] = $matches[1];
  }
  $item['conditions'] = isset($item['conditions']) && !empty($item['conditions']) ? $item['conditions'] : array();
  $item['conditions'] = _themekey_properties_explode_conditions($item['conditions']);
  $item['callbacks'] = isset($item['callbacks']) && !empty($item['callbacks']) ? $item['callbacks'] : array();

  //
  $attributes = variable_get('themekey_attributes', array());
  if (isset($attributes[$item['property']]['multiple']) && $attributes[$item['property']]['multiple']) {
    _themekey_include_modules();
    $weightfn = $attributes[$item['property']]['weight'];
    $item['weight'] = function_exists($weightfn) ? $weightfn($item) : 0;
  }
  drupal_write_record('themekey_properties', $item, isset($item['id']) ? 'id' : array());
}