'90%', ); // check if it is liquid (%) or fixed width (px) if(preg_match("/(\d+)\s*%/", $width, $match)) { $liquid = 1; $num = intval($match[0]); if(50 <= $num && $num <= 100) { return $num . "%"; // OK! } } else if(preg_match("/(\d+)\s*px/", $width, $match)) { $fixed = 1; $num = intval($match[0]); if(800 <= $num && $num < 1600) { return $num . "px"; // OK } } // reset to default value variable_set( str_replace('/', '_', 'theme_'. $theme_key .'_settings'), array_merge($defaults, theme_get_settings($theme_key)) ); // Force refresh of Drupal internals theme_get_setting('', TRUE); return $defaults['twilight_width']; } /** * Override or insert PHPTemplate variables into the templates. */ function _phptemplate_variables($hook, $vars) { if ($hook == 'page') { // Hook into color.module if (module_exists('color')) { _color_page_alter($vars); } return $vars; } return array(); } function phptemplate_field(&$node, &$field, &$items, $teaser, $page) { $field_empty = TRUE; foreach ($items as $delta => $item) { if (!empty($item['view']) || $item['view'] === "0") { $field_empty = FALSE; break; } } $variables = array( 'node' => $node, 'field' => $field, 'field_type' => $field['type'], 'field_name' => $field['field_name'], 'field_type_css' => strtr($field['type'], '_', '-'), 'field_name_css' => strtr($field['field_name'], '_', '-'), 'label' => t($field['widget']['label']), 'label_display' => 'hidden', // 'label_display' => isset($field['display_settings']['label']['format']) ? $field['display_settings']['label']['format'] : 'above', 'field_empty' => $field_empty, 'items' => $items, 'teaser' => $teaser, 'page' => $page, ); return _phptemplate_callback('field', $variables, array('field-'. $field['field_name'])); }