' . theme('item_list', array(
'items' => $items,
'attributes' => array('class' => array('pager')),
));
}
}
/**
* Theme the loggedinblock that shows for logged-in users.
*/
function materiobasetheme_lt_loggedinblock($variables){
global $user;
// return theme('username', array('account' => $variables['account'], 'link_path'=>'user/'.$user->uid.'/edit')) .' | ' . l(t('Log out'), 'user/logout');
return l('' . $user->mail . ' ', 'user/'.$user->uid.'/edit', array('html'=>true))
. l('' . t('Log out') . '', 'user/logout', array('html' => true));
}
function materiobasetheme_links__locale_block(&$vars) {
global $language;
foreach ($vars['links'] as $lang => $link) {
$vars['links'][$lang]['title'] = $lang;
if($lang == $language->language)
unset($vars['link'][$lang]);
}
$content = theme_links($vars);
return $content;
}
/**
* Returns HTML for an image field formatter.
*
* @param $variables
* An associative array containing:
* - item: Associative array of image data, which may include "uri", "alt",
* "width", "height", "title" and "attributes".
* - image_style: An optional image style.
* - path: An array containing the link 'path' and link 'options'.
*
* @ingroup themeable
*/
function materiobasetheme_image_formatter($variables) {
// dsm($variables, 'image_formatter');
$item = $variables['item'];
$image = array(
'path' => $item['uri'],
);
if (array_key_exists('alt', $item)) {
$image['alt'] = $item['alt'];
}
if (isset($item['attributes'])) {
$image['attributes'] = $item['attributes'];
}
if (isset($item['width']) && isset($item['height'])) {
$image['width'] = $item['width'];
$image['height'] = $item['height'];
}
// Do not output an empty 'title' attribute.
if (isset($item['title']) && drupal_strlen($item['title']) > 0) {
$image['title'] = $item['title'];
}
#added
if(isset($item['delta'])) {
$image['delta'] = $item['delta'];
}
if ($variables['image_style']) {
$image['style_name'] = $variables['image_style'];
$output = theme('image_style', $image);
}
else {
$output = theme('image', $image);
}
// The link path and link options are both optional, but for the options to be
// processed, the link path must at least be an empty string.
if (isset($variables['path']['path'])) {
$path = $variables['path']['path'];
$options = isset($variables['path']['options']) ? $variables['path']['options'] : array();
// When displaying an image inside a link, the html option must be TRUE.
$options['html'] = TRUE;
$output = l($output, $path, $options);
}
return $output;
}
/**
* Returns HTML for an image using a specific image style.
*
* @param $variables
* An associative array containing:
* - style_name: The name of the style to be used to alter the original image.
* - path: The path of the image file relative to the Drupal files directory.
* This function does not work with images outside the files directory nor
* with remotely hosted images. This should be in a format such as
* 'images/image.jpg', or using a stream wrapper such as
* 'public://images/image.jpg'.
* - width: The width of the source image (if known).
* - height: The height of the source image (if known).
* - alt: The alternative text for text-based browsers.
* - title: The title text is displayed when the image is hovered in some
* popular browsers.
* - attributes: Associative array of attributes to be placed in the img tag.
*
* @ingroup themeable
*/
function materiobasetheme_image_style($variables) {
// dsm($variables, 'image_style');
// Determine the dimensions of the styled image.
$fig_dimensions = "";
if(isset($variables['width']) || $variables['height']){
$dimensions = array(
'width' => $variables['width'],
'height' => $variables['height'],
);
image_style_transform_dimensions($variables['style_name'], $dimensions);
$variables['width'] = $dimensions['width'];
$variables['height'] = $dimensions['height'];
$fig_dimensions = 'width:'.$dimensions['width'].'px;height:'.$dimensions['height'].'px;';
}
// Determine the url for the styled image.
$variables['path'] = image_style_url($variables['style_name'], $variables['path']);
if(!isset($variables['attributes']))
$variables['attributes'] = array();
if(!isset($variables['attributes']['class']))
$variables['attributes']['class'] = array();
# hide title and alt for non adherent users
global $user;
if(isset($user->roles[1]) || isset($user->roles[7])){
unset($variables['title']);
unset($variables['alt']);
}
$figure = '';
return $figure;
}
/**
* Returns HTML for a list or nested list of items.
*
* @param $variables
* An associative array containing:
* - items: An array of items to be displayed in the list. If an item is a
* string, then it is used as is. If an item is an array, then the "data"
* element of the array is used as the contents of the list item. If an item
* is an array with a "children" element, those children are displayed in a
* nested list. All other elements are treated as attributes of the list
* item element.
* - title: The title of the list.
* - type: The type of list to return (e.g. "ul", "ol").
* - attributes: The attributes applied to the list element.
*/
function materiobasetheme_item_list($variables) {
$items = $variables['items'];
$title = $variables['title'];
$type = $variables['type'];
$attributes = $variables['attributes'];
// Only output the list container and title, if there are any list items.
// Check to see whether the block title exists before adding a header.
// Empty headers are not semantic and present accessibility challenges.
$output = '';
if (isset($title) && $title !== '') {
$output .= '
';
}
return $output;
}
/**
* Returns HTML for a link to a file.
*
* @param $variables
* An associative array containing:
* - file: A file object to which the link will be created.
* - icon_directory: (optional) A path to a directory of icons to be used for
* files. Defaults to the value of the "file_icon_directory" variable.
*
* @ingroup themeable
*/
function materiobasetheme_file_link($variables) {
$file = $variables['file'];
$icon_directory = $variables['icon_directory'];
$url = file_create_url($file->uri);
$icon = theme('file_icon', array('file' => $file, 'icon_directory' => $icon_directory));
// Set options as per anchor format described at
// http://microformats.org/wiki/file-format-examples
$options = array(
'attributes' => array(
'type' => $file->filemime . '; length=' . $file->filesize,
'target' => '_blank',
),
);
// Use the description as the link text if available.
if (empty($file->description)) {
$link_text = $file->filename;
}
else {
$link_text = $file->description;
$options['attributes']['title'] = check_plain($file->filename);
}
return '' . $icon . ' ' . l($link_text, $url, $options) . '';
}
/**
* Implements hook_form_alter().
*/
function materiobasetheme_form_alter(&$form, &$form_state, $form_id) {
// dsm($form_id, 'form_id');
if($form_id == "user_login_block"){
// dsm($form, 'form');
unset($form['links']);
// $items = array();
$newpass = l(t('Lost my password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
$form['newpass'] = array(
'#prefix' => '
',
'#markup' => $newpass,
'#suffix' => '
',
);
// if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
// $form['actions']['#weight'] = 10;
// $register = l(t('Get a free account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
// $form['register'] = array(
// '#prefix' => '
',
// '#markup' => $register,
// '#suffix' => '
',
// '#weight' => 15,
// );
// }
}
}
/**
* Implements hook_block_view_alter().
*/
function materiobasetheme_block_view_alter(&$data, $block) {
// dsm($block, 'block');
if ($block->module == 'menu' && $block->delta == 'menu-top-menu') {
// dsm($block, 'block');
// dsm($data, 'data');
$data['subject'] = '' . $data['subject'] . '';
}
if ($block->module == 'materio_flag' && $block->delta == 'materio_flag_mylists_nav') {
// dsm($block, 'block');
// dsm($data, 'data');
$data['subject'] = '' . $data['subject'] . '';
}
}
/**
* Themes the checkout review order page.
*
* @param $variables
* An associative array containing:
* - form: A render element representing the form, that by default includes
* the 'Back' and 'Submit order' buttons at the bottom of the review page.
* - panes: An associative array for each checkout pane that has information
* to add to the review page, keyed by the pane title:
* - : The data returned for that pane or an array of returned
* data.
*
* @return
* A string of HTML for the page contents.
*
* @ingroup themeable
*/
function materiobasetheme_uc_cart_checkout_review($variables) {
$panes = $variables['panes'];
$form = $variables['form'];
drupal_add_css(drupal_get_path('module', 'uc_cart') . '/uc_cart.css');
$output = '