Permalink
Browse files

New files structure for template-php preprocesses and overrides

  • Loading branch information...
1 parent 129c26f commit f906ddfae9549ad563b3d77affbd64f267195484 Sergio Cerrutti committed Jan 3, 2012
Showing with 59 additions and 42 deletions.
  1. +2 −2 starterd7.info → drupalsiete.info
  2. +17 −0 overrides/contrib.views.inc
  3. +34 −0 overrides/core.inc
  4. +6 −40 template.php
@@ -1,5 +1,5 @@
-name = Nombre proyecto
-description = Tema personalizado para ..., creado por ideup!
+name = Project name
+description = Custom theme for ..., developed by ideup! (based on drupalsiete starter theme: https://github.com/sergiocerrutti/drupalsiete)
version = 1.0
core = 7.x
@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * Implementation hook_preprocess_views_view()
+ */
+function yourtheme_preprocess_views_view(&$variables) {
+ // Rewriting views classes array
+ $variables['classes_array'] = array();
+ $variables['classes_array'] = array(
+ 'view',
+ 'view-' . $variables['view']->name,
+ 'clearfix'
+ );
+
+ // Creating a human-readable id for the view with view name and display name
+ $variables['view_name'] = $variables['view']->name . '-' . $variables['view']->current_display;
+}
View
@@ -0,0 +1,34 @@
+<?php
+
+/**
+ * Implementation of node preprocess
+ */
+function yourtheme_preprocess_node(&$variables) {
+ // Creating new theme suggestion for node teasers (for example: node--nodetype--teaser.tpl.php)
+ $variables['theme_hook_suggestions'][] = 'node__' . $variables['node']->type . '__' . $variables['view_mode'];
+
+ // Rewriting node classes array
+ $variables['classes_array'] = array();
+ $variables['classes_array'] = array(
+ 'node',
+ 'node-' . $variables['node']->type,
+ 'node-' . $variables['node']->type . '-' . $variables['view_mode'],
+ 'clearfix'
+ );
+}
+
+/**
+ * Implementation of theme('form')
+ */
+function yourtheme_form($variables) {
+ $element = $variables['element'];
+ if (isset($element['#action'])) {
+ $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
+ }
+ element_set_attributes($element, array('method', 'id'));
+ if (empty($element['#attributes']['accept-charset'])) {
+ $element['#attributes']['accept-charset'] = "UTF-8";
+ }
+ // Removing anonymous and useless <div> wrapping inside forms
+ return '<form' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</form>';
+}
View
@@ -1,50 +1,16 @@
<?php
/**
- * Implementation of node preprocess
+ * Core preprocesses and overrides
*/
-function yourtheme_preprocess_node(&$variables) {
- // Creating new theme suggestion for node teasers (for example: node--nodetype--teaser.tpl.php)
- $variables['theme_hook_suggestions'][] = 'node__' . $variables['node']->type . '__' . $variables['view_mode'];
-
- // Rewriting node classes array
- $variables['classes_array'] = array();
- $variables['classes_array'] = array(
- 'node',
- 'node-' . $variables['node']->type,
- 'node-' . $variables['node']->type . '-' . $variables['view_mode'],
- 'clearfix'
- );
-}
+include_once "overrides/core.inc";
/**
- * Implementation of theme('form')
+ * Contrib modules preprocesses and overrides
*/
-function yourtheme_form($variables) {
- $element = $variables['element'];
- if (isset($element['#action'])) {
- $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
- }
- element_set_attributes($element, array('method', 'id'));
- if (empty($element['#attributes']['accept-charset'])) {
- $element['#attributes']['accept-charset'] = "UTF-8";
- }
- // Removing anonymous and useless <div> wrapping inside forms
- return '<form' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</form>';
-}
+include_once "overrides/contrib.views.inc";
/**
- * Implementation hook_preprocess_views_view()
+ * Custom modules preprocesses and overrides
*/
-function yourtheme_preprocess_views_view(&$variables) {
- // Rewriting views classes array
- $variables['classes_array'] = array();
- $variables['classes_array'] = array(
- 'view',
- 'view-' . $variables['view']->name,
- 'clearfix'
- );
-
- // Creating a human-readable id for the view with view name and display name
- $variables['view_name'] = $variables['view']->name . '-' . $variables['view']->current_display;
-}
+// include_once "overrides/custom.module.inc";

0 comments on commit f906ddf

Please sign in to comment.