Commit 8e957f2e authored by Pol's avatar Pol

Initial prototype.

parents
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="131"
height="120">
<path
d="M 103.96875,29.43727 C 106.08143,18.684552 104.89996,10.523975 99.90625,7.2810201 98.241679,6.2000351 96.24602,5.7270015 94,5.8122701 81.871494,6.2727205 62.301679,22.972344 46.3125,47.59352 27.362362,76.774173 20.627996,106.01897 31.28125,112.93727 c 5.056946,3.28402 13.115147,0.95604 22.21875,-5.53125"
style="fill:none;stroke:#66595c;stroke-width:5;stroke-linecap:round" />
<path
d="m 113.6875,77.15602 c 8.99437,-3.489189 14.52504,-8.265012 14.8125,-13.75 0.6648,-12.685141 -26.94124,-24.429026 -61.6875,-26.25 -3.257461,-0.170716 -6.460588,-0.260544 -9.59375,-0.25 -30.287234,0.101927 -53.9287749,8.410341 -54.53125,19.90625 -0.286892,5.474225 4.7004836,10.782383 13.25,15.1875"
style="fill:none;stroke:#66595c;stroke-width:5;stroke-linecap:round" />
<path
d="M 57,10.53102 C 50.846125,5.4251295 45.074552,2.683237 40.4375,3.0310201 39.20289,3.123617 38.061068,3.4278792 37,3.9685201 25.681946,9.7353567 29.297632,39.560643 45.09375,70.56227 c 15.796118,31.00163 37.775696,51.45434 49.09375,45.6875 10.8844,-5.54588 7.94666,-33.337754 -6.34375,-63.03125"
style="fill:none;stroke:#66595c;stroke-width:5;stroke-linecap:round" />
<path
d="m 73.5,61 a 7.5,7.5 0 0 1 -15,0 7.5,7.5 0 1 1 15,0 z"
style="fill:#66595c" />
</svg>
\ No newline at end of file
name = Atomium
description = The NextEuropa base theme
screenshot = assets/images/screenshot.png
engine = phptemplate
core = 7.x
php = 5.2
;-------------- F E A T U R E S -------------
features[] = logo
features[] = name
features[] = slogan
features[] = favicon
;-------------- R E G I O N S -------------
regions[header] = "Header"
regions[highlighted] = "Highlighted"
regions[help] = "Help"
regions[content] = "Content"
regions[sidebar_first] = "Sidebar first"
regions[sidebar_second] = "Sidebar second"
regions[footer] = "Footer"
;-------------- P A N E L S -------------
;-------------- C S S -------------
;-------------- JS -------------
;-------------- Default Settings for theme-settings.php -------------
settings[toggle_logo] = 0
{
"name": "drupal/atomium",
"description": "The NextEuropa clean base theme.",
"type": "drupal-theme",
"license": "GPL-2.0",
"homepage": "https://drupal.org/project/atomium",
"authors": [
{
"name": "Pol Dellaiera (Pol)",
"homepage": "https://www.drupal.org/u/pol",
"role": "Author"
}
],
"support": {
"docs": "https://drupal.org/project/atomium",
"issues": "https://drupal.org/project/issues/atomium",
"source": "https://drupal.org/project/atomium"
},
"require-dev": {
"drupal/coder": "^8.2"
},
"scripts": {
"post-install-cmd": [
"./vendor/bin/phpcs --config-set installed_paths ../../drupal/coder/coder_sniffer",
"./vendor/bin/phpcs --config-set show_progress 1",
"cp ./tests/scripts/pre-push.sh .git/hooks/pre-push && chmod +x .git/hooks/pre-push"
],
"post-update-cmd": [
"./vendor/bin/phpcs --config-set installed_paths ../../drupal/coder/coder_sniffer",
"./vendor/bin/phpcs --config-set show_progress 1",
"cp ./tests/scripts/pre-push.sh .git/hooks/pre-push && chmod +x .git/hooks/pre-push"
],
"phpcs": "./vendor/bin/phpcs --standard=Drupal,DrupalPractice ./includes ./themes ./templates ./assets",
"phpcbf": "./vendor/bin/phpcbf --standard=Drupal,DrupalPractice ./includes ./themes ./templates ./assets"
}
}
<?php
/**
* @file
* css.inc
*/
/**
* Implements hook_css_alter().
*/
function atomium_css_alter(&$css) {
$exclude = array(
// 'misc/vertical-tabs.css' => FALSE,.
'modules/aggregator/aggregator.css' => FALSE,
'modules/block/block.css' => FALSE,
'modules/book/book.css' => FALSE,
'modules/comment/comment.css' => FALSE,
// 'modules/dblog/dblog.css' => FALSE,
// 'modules/file/file.css' => FALSE,.
'modules/filter/filter.css' => FALSE,
// 'modules/forum/forum.css' => FALSE,
// 'modules/help/help.css' => FALSE,.
'modules/menu/menu.css' => FALSE,
'modules/node/node.css' => FALSE,
// 'modules/openid/openid.css' => FALSE,.
'modules/poll/poll.css' => FALSE,
'modules/profile/profile.css' => FALSE,
'modules/search/search.css' => FALSE,
// 'modules/statistics/statistics.css' => FALSE,
// 'modules/syslog/syslog.css' => FALSE,
// 'modules/system/admin.css' => FALSE,
// 'modules/system/maintenance.css' => FALSE,
// 'modules/system/system.css' => FALSE,
// 'modules/system/system.admin.css' => FALSE,
// 'modules/system/system.base.css' => FALSE,
// 'modules/system/system.maintenance.css' => FALSE,.
'modules/system/system.menus.css' => FALSE,
'modules/system/system.messages.css' => FALSE,
'modules/system/system.theme.css' => FALSE,
'modules/taxonomy/taxonomy.css' => FALSE,
'modules/tracker/tracker.css' => FALSE,
// 'modules/update/update.css' => FALSE,.
'modules/user/user.css' => FALSE,
);
$css = array_diff_key($css, $exclude);
}
<?php
/**
* @file
* field_widget_form.inc
*/
/**
* Implements hook_field_widget_form_alter().
*/
function atomium_field_widget_form_alter(&$element, &$form_state, $context) {
$element['#description'] = '';
if (isset($element['#description'])) {
$description = array(
'#type' => 'html_tag',
'#tag' => 'p',
'#attributes' => array(
'class' => array(
'help-text',
),
),
'text' => array(
'#type' => 'markup',
'#markup' => $element['#description'],
),
);
$element['#description'] = render($description);
}
}
<?php
/**
* @file
* form.inc
*/
/**
* Implements hook_form_alter().
*/
function atomium_form_alter(&$form, &$form_state, $form_id) {
// This could be removed.
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function atomium_form_search_block_form_alter(&$form, &$form_state, $form_id) {
$form['search_block_form']['#attributes']['placeholder'] = t('Search');
$form['search_block_form']['#attributes']['type'] = 'search';
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function atomium_form_user_login_block_alter(&$form, &$form_state, $form_id) {
$form['name']['#attributes']['placeholder'] = $form['name']['#title'];
$form['pass']['#attributes']['placeholder'] = $form['pass']['#title'];
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function atomium_form_user_register_form_alter(&$form, &$form_state, $form_id) {
$form['account']['name']['#attributes']['placeholder'] = $form['account']['name']['#title'];
$form['account']['mail']['#attributes']['placeholder'] = $form['account']['mail']['#title'];
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function atomium_form_user_login_alter(&$form, &$form_state, $form_id) {
$form['name']['#attributes']['placeholder'] = $form['name']['#title'];
$form['pass']['#attributes']['placeholder'] = $form['pass']['#title'];
}
/**
* Implements hook_form_FORM_ID_alter().
*/
function atomium_form_user_pass_alter(&$form, &$form_state, $form_id) {
$form['name']['#attributes']['placeholder'] = $form['name']['#title'];
}
<?php
/**
* @file
* html_head.inc
*/
/**
* Implements hook_html_head_alter().
*/
function atomium_html_head_alter(&$head_elements) {
// Remove the generator meta.
unset($head_elements['system_meta_generator']);
if (isset($head_elements['system_meta_content_type']['#attributes']['content'])) {
$head_elements['system_meta_content_type']['#attributes'] = array(
'charset' => str_replace(
'text/html; charset=',
'',
$head_elements['system_meta_content_type']['#attributes']['content']
),
);
}
}
<?php
/**
* @file
* js.inc
*/
/**
* Implements hook_js_alter().
*/
function atomium_js_alter(&$js) {
// This could be removed.
}
<?php
/**
* @file
* page.inc
*/
/**
* Implements hook_page_alter().
*/
function atomium_page_alter(&$page) {
foreach (system_region_list($GLOBALS['theme'], REGIONS_VISIBLE) as $region => $name) {
if (empty($page[$region])) {
continue;
}
$count = 0;
$blocks = element_children($page[$region]);
$block_count = count($blocks);
foreach ($blocks as $block) {
if ($count == 0) {
$page[$region][$block]['#block']->classes[] = 'first';
}
if (isset($page[$region][$block]['#block']) && is_object($page[$region][$block]['#block'])) {
$page[$region][$block]['#block']->order = $count++;
}
if ($count == $block_count) {
$page[$region][$block]['#block']->classes[] = 'last';
}
}
}
}
<?php
/**
* @file
* common.inc
*/
/**
* Includes a theme file.
*
* @param string $theme
* Name of the theme to use for base path.
* @param string $path
* Path relative to $theme.
*
* @return bool
* TRUE if file has been included, FALSE otherwise.
*/
function atomium_include($theme, $path) {
static $themes = array();
if (!isset($themes[$theme])) {
$themes[$theme] = drupal_get_path('theme', $theme);
}
if ($themes[$theme] && ($file = DRUPAL_ROOT . '/' . $themes[$theme] . '/' . $path) && file_exists($file)) {
if (is_dir($file)) {
foreach (glob($file . '/*.{inc}', GLOB_BRACE) as $file_to_include) {
include_once $file_to_include;
}
}
if (is_file($file)) {
include_once $file;
}
return TRUE;
}
return FALSE;
}
/**
* Returns a list of base themes for active or provided theme.
*
* @param string $theme_key
* The machine name of the theme to check, if not set the active theme name
* will be used.
* @param bool $include_theme_key
* Whether to append the returned list with $theme_key.
*
* @return array
* An indexed array of base themes.
*/
function _atomium_get_base_themes($theme_key = NULL, $include_theme_key = FALSE) {
static $themes;
if (!isset($theme_key)) {
$theme_key = $GLOBALS['theme_key'];
}
if (!isset($themes[$theme_key])) {
$themes[$theme_key] = array_unique(array_filter((array) atomium_get_theme_info($theme_key, 'base theme')));
}
if ($include_theme_key) {
$themes[$theme_key][] = $theme_key;
}
return $themes[$theme_key];
}
/**
* Return information from the .info file of a theme (and possible base themes).
*
* @param string $theme_key
* The machine name of the theme.
* @param string $key
* The key name of the item to return from the .info file. This value can
* include "][" to automatically attempt to traverse any arrays.
* @param bool $base_themes
* Recursively search base themes, defaults to TRUE.
*
* @return string|array|false
* A string or array depending on the type of value and if a base theme also
* contains the same $key, FALSE if no $key is found.
*/
function atomium_get_theme_info($theme_key = NULL, $key = NULL, $base_themes = TRUE) {
// If no $theme_key is given, use the current theme if we can determine it.
if (!isset($theme_key)) {
$theme_key = !empty($GLOBALS['theme_key']) ? $GLOBALS['theme_key'] : FALSE;
}
if ($theme_key) {
$themes = list_themes();
if (!empty($themes[$theme_key])) {
$theme = $themes[$theme_key];
// If a key name was specified, return just that array.
if ($key) {
$value = FALSE;
// Recursively add base theme values.
if ($base_themes && isset($theme->base_themes)) {
foreach (array_keys($theme->base_themes) as $base_theme) {
$value = atomium_get_theme_info($base_theme, $key);
}
}
if (!empty($themes[$theme_key])) {
$info = $themes[$theme_key]->info;
// Allow array traversal.
$keys = explode('][', $key);
foreach ($keys as $parent) {
if (isset($info[$parent])) {
$info = $info[$parent];
}
else {
$info = FALSE;
}
}
if (is_array($value)) {
if (!empty($info)) {
if (!is_array($info)) {
$info = array($info);
}
$value = drupal_array_merge_deep($value, $info);
}
}
else {
if (!empty($info)) {
if (empty($value)) {
$value = $info;
}
else {
if (!is_array($value)) {
$value = array($value);
}
if (!is_array($info)) {
$info = array($info);
}
$value = drupal_array_merge_deep($value, $info);
}
}
}
}
return $value;
}
// If no info $key was specified, just return the entire info array.
return $theme->info;
}
}
return FALSE;
}
/**
* Retrieves an element's "attributes" array.
*
* @param array $element
* The individual renderable array element. It is possible to also pass the
* $variables parameter in [pre]process functions and it will logically
* determine the correct path to that particular theme hook's attribute array.
* Passed by reference.
* @param string $property
* Determines which attributes array to retrieve. By default, this is the
* normal attributes, but can be "wrapper_attributes" or
* "input_group_attributes".
*
* @return array
* The attributes array. Passed by reference.
*/
function &_atomium_get_attributes(array &$element, $property = 'attributes') {
// Attempt to retrieve a renderable element attributes first.
if (
isset($element['#type']) ||
isset($element['#theme']) ||
isset($element['#pre_render']) ||
isset($element['#markup']) ||
isset($element['#theme_wrappers']) ||
isset($element["#$property"])
) {
if (!isset($element["#$property"])) {
$element["#$property"] = array();
}
return $element["#$property"];
}
// Treat $element as if it were a [pre]process function $variables parameter
// and look for a renderable "element".
elseif (isset($element['element'])) {
if (!isset($element['element']["#$property"])) {
$element['element']["#$property"] = array();
}
return $element['element']["#$property"];
}
// If all else fails, create (if needed) a default "attributes" array. This
// will, at the very least, either work or cause an error that can be tracked.
if (!isset($element[$property])) {
$element[$property] = array();
}
return $element[$property];
}
<?php
/**
* @file
* preprocess.inc
*/
/**
* Implements hook_preprocess().
*/
function atomium_preprocess(&$variables, $hook) {
// See how we can extend this properly.
if ($suggestions = theme_get_suggestions(arg(), $hook)) {
$variables['theme_hook_suggestions'] = $suggestions;
}
}
<?php
/**
* @file
* admin_block.inc
*/
/**
* Implements hook_preprocess_admin_block().
*/
function atomium_preprocess_admin_block(&$variables) {
$variables['attributes_array']['class'][] = 'admin-panel';
$variables['attributes_array']['class'][] = $variables['block']['title'];
if (isset($variables['block']['title'])) {
$variables['theme_hook_suggestions'][] = 'admin_block__' . drupal_html_class($variables['block']['title']);
}
}
<?php
/**
* @file
* bean.inc
*/
/**
* Implements hook_preprocess_bean().
*/
function atomium_preprocess_bean(&$variables) {
// Add a theme hook suggestion to the bean so its combinated with its region.
if ($variables['elements']['#block']->module == "bean" and $variables['elements']['bean']) {
$variables['theme_hook_suggestions'][] = 'block__bean_' . $variables['elements']['#block']->region;
}
}
<?php
/**
* @file
* block.inc
*/
/**
* Implements hook_preprocess_block().
*/
function atomium_preprocess_block(&$variables) {
$variables['classes_array'] = array_values(array_diff($variables['classes_array'], array('block')));
$variables['classes_array'] = preg_grep('/^block-/', $variables['classes_array'], PREG_GREP_INVERT);
$variables['id_block'] = ' id="' . $variables['block_html_id'] . '"';
$variables['classes_array'][] = $variables['block_html_id'];
$variables['classes_array'][] = $variables['block_zebra'];
$variables['classes_array'][] = 'order-' . $variables['block']->order;
if (isset($variables['block']->classes) && is_array($variables['block']->classes)) {
$variables['classes_array'] = array_merge($variables['classes_array'], (array) $variables['block']->classes);
}
$variables['title_attributes_array']['class'][] = 'title';
$variables['content_attributes_array']['class'][] = 'block-content';
if (
($variables['elements']['#block']->module == "system" and $variables['elements']['#block']->delta == "navigation") or
($variables['elements']['#block']->module == "system" and $variables['elements']['#block']->delta == "main-menu") or
($variables['elements']['#block']->module == "system" and $variables['elements']['#block']->delta == "user-menu") or
($variables['elements']['#block']->module == "admin" and $variables['elements']['#block']->delta == "menu") or
$variables['elements']['#block']->module == "menu_block"
) {
$variables['theme_hook_suggestions'][] = 'block__menu';
}
$variables['attributes_array']['class'] = $variables['classes_array'];
$variables['attributes_array']['id'] = $variables['block_html_id'];
// Add Aria Roles via attributes.
switch ($variables['block']->module) {
case 'system':
switch ($variables['block']->delta) {
case 'main':
// Note: the "main" role goes in the page.tpl, not here.
break;
case 'help':
case 'powered-by':
$variables['attributes_array']['role'] = 'complementary';
break;
default:
// Any other "system" block is a menu block.
$variables['attributes_array']['role'] = 'navigation';
break;
}
break;
case 'menu':
case 'menu_block':
case 'blog':
case 'book':
case 'comment':
case 'forum':
case 'shortcut':
case 'statistics':
$variables['attributes_array']['role'] = 'navigation';
break;
case 'search':
$variables['attributes_array']['role'] = 'search';
break;
case 'help':
case 'aggregator':
case 'locale':
case 'poll':
case 'profile':
$variables['attributes_array']['role'] = 'complementary';
break;
case 'node':
switch ($variables['block']->delta) {
case 'syndicate':
$variables['attributes_array']['role'] = 'complementary';
break;
case 'recent':
$variables['attributes_array']['role'] = 'navigation';
break;
}
break;
case 'user':
switch ($variables['block']->delta) {
case 'login':
$variables['attributes_array']['role'] = 'form';
break;
case 'new':
case 'online':
$variables['attributes_array']['role'] = 'complementary';
break;
}
break;
}
$variables['classes_array'][] = drupal_html_class('block-' . $variables['block']->module);
$variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->region;
$variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->module;
$variables['theme_hook_suggestions'][] = 'block__' . $variables['block']->module . '__' . strtr($variables['block']->delta, '-', '_');
// Create a valid HTML ID and make sure it is unique.
$variables['block_html_id'] = drupal_html_id('block-' . $variables['block']->module . '-' . $variables['block']->delta);
}
<?php
/**
* @file
* breadcrumb.inc
*/
/**
* Implements hook_preprocess_breadcrumb().