German Cigala

Corrige bug: renombra hooks

<?php
function esNodo(){
return arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2));
}
function esArea(){
return (esNodo() && es('area', node_load(arg(1))));
}
function esTramite(){
return (esNodo() && es('tramite', node_load(arg(1))));
}
function esServicio(){
return esTramite();
}
function esNoticia(){
return (esNodo() && es('noticia', node_load(arg(1))));
}
function es($tipo, $nodo){
return ($nodo->type == $tipo);
}
function esPaginaRelacionadaDeNodo(){
return arg(0) == 'node' && is_numeric(arg(1)) && arg(2) != '';
}
function argentinagobarIconos() {
return array(
'glyphicon-home' => t('Casa'),
'glyphicon-paperclip' => t('Clip'),
'glyphicon-star' => t('Estrella'),
'glyphicon-heart' => t('Corazón'),
'glyphicon-music' => t('Música'),
'glyphicon-info-sign' => t('Información'),
'glyphicon-fire' => t('Fuego'),
'glyphicon-tree-deciduous' => t('Árbol'),
'glyphicon-gift' => t('Regalo'),
'glyphicon-ok-sign' => t('OK'),
'glyphicon-remove-sign' => t('Error'),
'glyphicon-search' => t('Buscar'),
'glyphicon-lock' => t('Candado'),
'glyphicon-cog' => t('Configuración'),
'glyphicon-plus' => t('Más'),
'glyphicon-minus' => t('Menos'),
'glyphicon-envelope' => t('Correo'),
'glyphicon-share-alt' => t('Compartir'),
'glyphicon-chevron-right' => t('Flecha Derecha'),
'glyphicon-chevron-left' => t('Flecha Izquierda'),
'glyphicon-question-sign' => t('Signo de interrogación'),
'glyphicon-calendar' => t('Calendario'),
'glyphicon-certificate' => t('Certificado'),
'glyphicon-link' => t('Link'),
'glyphicon-briefcase' => t('Maletín'),
'glyphicon-send' => t('Enviar'),
'glyphicon-earphone' => t('Teléfono'),
'glyphicon-alert' => t('Alerta'),
'glyphicon-piggy-bank' => t('Ahorro'),
'glyphicon-education' => t('Educación'),
'glyphicon-grain' => t('Campo'),
'glyphicon-globe' => t('Planeta'),
'glyphicon-shopping-cart' => t('Carrito de compra'),
'glyphicon-comment' => t('Diálogo'),
'glyphicon-gift' => t('Regalo'),
'glyphicon-map-marker' => t('Marcador'),
'glyphicon-flag' => t('Bandera'),
'glyphicon-list-alt' => t('Listado'),
'glyphicon-cloud' => t('Nube'),
'glyphicon-time' => t('Reloj'),
'glyphicon-camera' => t('Cámara'),
'glyphicon-leaf' => t('Hoja'),
'glyphicon-warning-sign' => t('Peligro'),
'glyphicon-usd' => t('Dinero'),
'glyphicon-flash' => t('Rayo'),
'glyphicon-transfer' => t('Transferencia'),
'glyphicon glyphicon-book' => t('Libro'),
);
}
function obtenerCampo($nodo, $tipo_campo) {
switch ($tipo_campo) {
case 'costo':
$campo = field_get_items('node', $nodo, 'field_tramite_costo', NULL);
$campo = isset($campo) && !empty($campo) ? $campo[0]['safe_value'] : NULL;
break;
case 'audio':
$campo = field_get_items('node', $nodo, 'field_audio', NULL);
$campo = isset($campo) && !empty($campo) ? file_create_url($campo[0]['uri']) : NULL;
break;
case 'requisitos':
$campo = field_get_items('node', $nodo, 'field_requisitos', NULL);
$campo = isset($campo) && !empty($campo) ? $campo[0]['safe_value'] : NULL;
break;
case 'creditos':
$campo = field_get_items('node', $nodo, 'field_creditos', NULL);
$campo = isset($campo) && !empty($campo) ? $campo[0]['safe_value'] : NULL;
break;
case 'siglas_area':
$campo = field_get_items('node', $nodo, 'field_siglas', NULL);
$campo = isset($campo) && !empty($campo) ? $campo[0]['safe_value'] : NULL;
break;
case 'links_relacionados':
$campo = field_get_items('node', $nodo, 'field_links_relacionados', NULL);
$campo = isset($campo) && !empty($campo) ? obtener($tipo_campo, $campo) : '';
break;
case 'paginas_relacionadas':
$campo = field_get_items('node', $nodo, 'field_paginas_relacionadas', NULL);
$campo = isset($campo) && !empty($campo) ? obtener($tipo_campo, $campo) : '';
break;
case 'tipo_tramite':
$campo = field_get_items('node', $nodo, 'field_tramite_tipo', NULL);
$campo = isset($campo) ? taxonomy_term_load($campo[0]["target_id"]) : NULL;
$campo = isset($campo) ? $campo->name : NULL;
break;
case 'categoria_noticia':
$campo = field_get_items('node', $nodo, 'field_categoria', NULL);
$campo = isset($campo) ? taxonomy_term_load($campo[0]["target_id"]) : NULL;
$campo = isset($campo) ? $campo->name : NULL;
break;
case 'tags':
$campo = field_get_items('node', $nodo, 'field_tags', NULL);
$campo = isset($campo) && !empty($campo) ? obtener($tipo_campo, $campo) : NULL;
break;
case 'download':
$campo = field_get_items('node', $nodo, 'field_download', NULL);
$campo = isset($campo) && !empty($campo) ? obtener($tipo_campo, $campo) : NULL;
break;
case 'store':
$campo['android'] = field_get_items('node', $nodo, 'field_link_android', NULL);
$campo['iphone'] = field_get_items('node', $nodo, 'field_link_iphone', NULL);
$campo['windows'] = field_get_items('node', $nodo, 'field_link_windows', NULL);
$campo['blackberry'] = field_get_items('node', $nodo, 'field_link_blackberry', NULL);
$campo = isset($campo) && !empty($campo) ? obtener($tipo_campo, $campo) : NULL;
break;
default:
# code...
break;
}
return $campo;
}
function obtener($nombreCampo, $campo){
$items = array();
switch ($nombreCampo) {
case 'tags':
foreach ($campo as $item) {
$items[] = $item['taxonomy_term']->name;
}
break;
case 'paginas_relacionadas':
foreach ($campo as $item) {
$items[] = $item;
}
break;
case 'links_relacionados':
foreach ($campo as $item) {
$items[] = $item;
}
break;
case 'download':
foreach ($campo as $item) {
$items[] = $item;
}
break;
case 'store':
foreach ($campo as $key => $item) {
if ($item <> null){
$items[$key] = $item;
}
}
break;
default:
# code...
break;
}
return $items;
}
\ No newline at end of file
... ...
<?php
include_once 'argentinagobar_theme.inc';
include_once 'poncho.inc';
/**
* @file
* template.php
*/
function argentinagobar_theme_preprocess_html(&$variables) {
function poncho_preprocess_html(&$variables) {
drupal_add_css('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css', array('type' => 'external'));
drupal_add_css('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css', array('type' => 'external'));
... ... @@ -18,15 +18,15 @@ function argentinagobar_theme_preprocess_html(&$variables) {
/**
* Implements hook_preprocess_page().
*/
function argentinagobar_theme_preprocess_page(&$variables){
$variables['logo'] = base_path() . drupal_get_path('theme', 'argentinagobar_theme') . '/logo.svg';
function poncho_preprocess_page(&$variables){
$variables['logo'] = base_path() . drupal_get_path('theme', 'poncho') . '/logo.svg';
}
/**
* Implements hook_wysiwyg_editor_settings_alter().
*/
function argentinagobar_theme_wysiwyg_editor_settings_alter(&$settings, $context) {
function poncho_wysiwyg_editor_settings_alter(&$settings, $context) {
if ($context['profile']->editor == 'ckeditor') {
$path = drupal_get_path('theme', 'argentinagobar_theme');
$path = drupal_get_path('theme', 'poncho');
$settings['stylesSet'] = "drupal:/$path/ckeditor.styles.js";
}
}
... ... @@ -34,10 +34,10 @@ function argentinagobar_theme_wysiwyg_editor_settings_alter(&$settings, $context
/**
* Agrega clases para el título del bloque
*/
function argentinagobar_theme_preprocess_block(&$variables) {
function poncho_preprocess_block(&$variables) {
$variables['title_attributes_array']['class'][] = 'h3 section-title';
}
function argentinagobar_theme_preprocess_breadcrumb(&$variables) {
function poncho_preprocess_breadcrumb(&$variables) {
if(esPaginaRelacionadaDeNodo() || esNodo()) {
$breadcrumb = &$variables['breadcrumb'];
$breadcrumb = crearBreadcrumb(node_load(arg(1)));
... ... @@ -117,7 +117,7 @@ function obtenerGrupo($node){
/**
* Implementa theme_breadcrumb()
*/
function argentinagobar_theme_breadcrumb($variables) {
function poncho_breadcrumb($variables) {
return theme('item_list', array(
'attributes' => array(
'class' => array(
... ... @@ -131,7 +131,7 @@ function argentinagobar_theme_breadcrumb($variables) {
);
}
function argentinagobar_theme_facetapi_link_inactive($variables) {
function poncho_facetapi_link_inactive($variables) {
// Builds accessible markup.
// @see http://drupal.org/node/1316580
$accessible_vars = array(
... ... @@ -156,7 +156,7 @@ function argentinagobar_theme_facetapi_link_inactive($variables) {
return theme_link($variables);
}
function argentinagobar_theme_facetapi_link_active($variables) {
function poncho_facetapi_link_active($variables) {
// Sanitizes the link text if necessary.
$sanitize = empty($variables['options']['html']);
$link_text = ($sanitize) ? check_plain($variables['text']) : $variables['text'];
... ... @@ -181,11 +181,11 @@ function argentinagobar_theme_facetapi_link_active($variables) {
}
function argentinagobar_theme_facetapi_count($variables) {
function poncho_facetapi_count($variables) {
return '<span class="badge pull-right">' . (int) $variables['count'] . '</span>';
}
function argentinagobar_theme_menu_link__main_menu($variables) {
function poncho_menu_link__main_menu($variables) {
$element = $variables['element'];
$element['#localized_options']['html'] = TRUE;
... ... @@ -197,19 +197,19 @@ function argentinagobar_theme_menu_link__main_menu($variables) {
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . "</li>\n";
}
function argentinagobar_theme_menu_tree__primary($variables) {
function poncho_menu_tree__primary($variables) {
return '' . $variables['tree'] . '';
}
function argentinagobar_theme_menu_tree__main_menu($variables) {
function poncho_menu_tree__main_menu($variables) {
return '<ul class="nav navbar-nav">' . $variables['tree'] . '</ul>';
}
function argentinagobar_theme_menu_tree__og_menu_single(&$variables) {
function poncho_menu_tree__og_menu_single(&$variables) {
return '<ul class="list-inline pull-right">' . $variables['tree'] . '</ul>';
}
function argentinagobar_theme_pager($variables) {
function poncho_pager($variables) {
$output = "";
$items = array();
$tags = $variables['tags'];
... ... @@ -367,7 +367,7 @@ function argentinagobar_theme_pager($variables) {
/**
* Default theme function for spelling suggestions.
*/
function argentinagobar_theme_apachesolr_search_suggestions($variables) {
function poncho_apachesolr_search_suggestions($variables) {
//Por ahora se comentan las sugerencias de solr porque no son precisas y no están en el modelo
... ... @@ -390,7 +390,7 @@ function argentinagobar_theme_apachesolr_search_suggestions($variables) {
*
* @see search_help()
*/
function argentinagobar_theme_apachesolr_search_noresults() {
function poncho_apachesolr_search_noresults() {
/*drupal_add_js('jQuery(document).ready(function () {
jQuery("#search-form").prepend("<h1 class=text-center>¿Qué estás buscando?</h1>");
... ... @@ -411,7 +411,7 @@ function argentinagobar_theme_apachesolr_search_noresults() {
* Altero los snippets para mostrar el summary en caso de existir de lo contrario
* Utiliza el comportamiento natural de mostrar los lugares donde lo encontró
*/
function argentinagobar_theme_preprocess_apachesolr_search_snippets(&$vars) {
function poncho_preprocess_apachesolr_search_snippets(&$vars) {
// Flatten the multidimensional array of snippets into a one-dimensional,
// ordered array.
$vars['flattened_snippets'] = array();
... ... @@ -444,11 +444,11 @@ function argentinagobar_theme_preprocess_apachesolr_search_snippets(&$vars) {
*/
function argentinagobar_theme_html_head_alter(&$head_elements) {
function poncho_html_head_alter(&$head_elements) {
unset($head_elements['metatag_generator_0']);
}
function argentinagobar_theme_form_alter(&$form, &$form_state, $form_id){
function poncho_form_alter(&$form, &$form_state, $form_id){
if ($form_id == 'user_login_block' || $form_id == 'user_login') {
$form['#attributes']['autocomplete'] = 'off';
... ... @@ -463,7 +463,7 @@ function argentinagobar_theme_form_alter(&$form, &$form_state, $form_id){
}
function argentinagobar_theme_custom_page_search_form_alter($form, &$form_state, $search_page, $keys = ''){
function poncho_custom_page_search_form_alter($form, &$form_state, $search_page, $keys = ''){
// Loads the core Search CSS file, use the core search module's classes.
drupal_add_css(drupal_get_path('module', 'search') . '/search.css');
... ... @@ -511,7 +511,7 @@ function argentinagobar_theme_custom_page_search_form_alter($form, &$form_state,
return $form;
}
function argentinagobar_theme_menu_link__og_menu_single(array $variables) {
function poncho_menu_link__og_menu_single(array $variables) {
$element = $variables['element'];
$sub_menu = '';
... ...