Commit a61993ea authored by Mattia Migliorini's avatar Mattia Migliorini

Add basic theme files -

Add function to test if region is empty
parent 03b66150
<?php
/**
* Conditional logic and data processing.
*
* Can be used to hold preprocessors [1] for generating variables before
* they are merged with the markup inside .tpl.php files.
*
* Custom functions, overriding theme functions [2], or any other customization
* of the raw output should be done here.
*
* NB: omit the php closing tag.
*
* [1] @see https://drupal.org/node/223430
* [2] @see https://drupal.org/node/173880#function-override
*
* @package Valencia
* @since 1.0.0
*/
/**
* Check if region is empty.
*
* Examines the block visibility setting for the current path to work out
* if the region is occupied.
*
* @param string $region required. Region name.
* @return bool. True if empty, false otherwise.
*/
function region_empty( $region ) {
$empty = 1;
$result = db_query_range( 'SELECT n.pages, n.visibility FROM {blocks} n WHERE n.region="%s" AND n.theme="%s"', $region, $GLOBALS['theme'], 0, 10 );
if ( count($result) > 0 ) {
while ( $node = db_fetch_object($result) ) {
if ( $node->visibility < 2 ) {
$path = drupal_get_path_alias($_GET['q']);
// Compare with the internal and path alias (if any)
$page_match = drupal_match_path($path, $node->pages);
if ( $path != $_GET['q'] )
$page_match = $page_match || drupal_match_path( $_GET['q'], $node->pages );
/**
* When $block->visibility has a value of 0, the block is displayed on
* all pages except those listed in $block->pages. When set to 1, it
* is displayed only on those pages listed in $block->pages.
*/
$page_match = !( $node->visibility xor $page_match );
} else {
$page_match = drupal_eval( $block->pages );
}
if ( $page_match )
$empty = 0;
}
}
return $empty;
}
\ No newline at end of file
......@@ -2,23 +2,49 @@ name = Valencia
description = A theme developed by the Ubuntu Italy community.
core = 7.x
version = 0.1
engine = phptemplate
;screenshot = screenshot.png
; STYLESHEETS
stylesheets[all][] = css/ubuntu-styles.min.css
stylesheets[all][] = css/style.css
; SCRIPTS
scripts[] = js/yui-min.js
scripts[] = js/core.js
; CORE REGIONS - REQUIRED
regions[page_top] = Page Top
regions[content] = Content
regions[page_bottom] = Page Bottom
; CORE REGIONS - ENABLED
; CORE REGIONS
regions[page_top] = Page Top ; required, hidden
regions[page_bottom] = Page Bottom ; required, hidden
regions[header] = Header
regions[content] = Content ; required
regions[footer] = Footer
; CORE REGIONS - DISABLED
;regions[highlighted] = Highlighted
;regions[help] = Help
;regions[sidebar_first] = Sidebar First
;regions[sidebar_second] = Sidebar Second
\ No newline at end of file
;regions[sidebar_second] = Sidebar Second
; FEATURES
features[] = logo
features[] = name
features[] = slogan
features[] = node_user_picture
features[] = comment_user_picture
features[] = comment_user_verification
features[] = favicon
features[] = main_menu
features[] = secondary_menu
features[] = in_page_menu
; SETTINGS
settings[toggle_logo] = 1
settings[toggle_name] = 1
settings[toggle_slogan] = 1
settings[toggle_node_user_picture] = 1
settings[toggle_comment_user_picture] = 1
settings[toggle_comment_user_verification] = 1
settings[toggle_favicon] = 1
settings[toggle_main_menu] = 1
settings[toggle_secondary_menu] = 1
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment