Hello,
I got this custom MD Official Drupal 7 theme. When I enable Them Developer, my site breaks down and gives the dreaded WSOD. Tracing the error leads to my template.php file. Anyone used this theme or do you have an idea on how to narrow down on the issue? I have read quite a number of similar problems but yet to figure it out. Thanks in advance.

The error is caused by this code on line 595. I tried to put some debug code above but no luck.

$element += array(
        '#title_display' => 'before',
    );

See entire template file here.

<?php

include_once './' . drupal_get_path('theme', 'md_official') . '/inc/front/template.process.inc';
include_once './' . drupal_get_path('theme', 'md_official') . '/inc/front/page.preprocess.inc';
include_once './' . drupal_get_path('theme', 'md_official') . '/inc/front/node.preprocess.inc';
include_once './' . drupal_get_path('theme', 'md_official') . '/inc/front/user.preprocess.inc';
include_once './' . drupal_get_path('theme', 'md_official') . '/inc/front/block.preprocess.inc';
include_once './' . drupal_get_path('theme', 'md_official') . '/inc/front/comment.preprocess.inc';
include_once './' . drupal_get_path('theme', 'md_official') . '/inc/front/forum.preprocess.inc';
include_once './' . drupal_get_path('theme', 'md_official') . '/theme_alter/superfish.theme.inc';
include_once './' . drupal_get_path('theme', 'md_official') . '/theme_alter/commerce.theme.inc';
include_once './' . drupal_get_path('theme', 'md_official') . '/theme_alter/panel.theme.inc';
/**
 * Global $base_url
 */
function base_url() {
    global $base_url;
    return $base_url;
}
/**
 * Overrides theme_menu_tree().
 */
function md_official_menu_tree(&$variables) {
    return '<ul class="sf-menu">' . $variables['tree'] . '</ul>';
}

/**
 * Bootstrap theme wrapper function for the primary menu links.
 */
function md_official_menu_tree__main_menu(&$variables) {
    return '<ul class="sf-menu">' . $variables['tree'] . '</ul>';
}

/**
 * System Theme Main Menu
 */
function md_official_links(&$variables) {
    $links = $variables['links'];
    $attributes = $variables['attributes'];
    $heading = $variables['heading'];
    global $language_url;
    $output = '';

    if (count($links) > 0) {
        $output = '';

        // Treat the heading first if it is present to prepend it to the
        // list of links.
        if (!empty($heading)) {
            if (is_string($heading)) {
                // Prepare the array that will be used when the passed heading
                // is a string.
                $heading = array(
                    'text' => $heading,

                    // Set the default level of the heading.
                    'level' => 'h2',
                );
            }
            $output .= '<' . $heading['level'];
            if (!empty($heading['class'])) {
                $output .= drupal_attributes(array('class' => $heading['class']));
            }
            $output .= '>' . check_plain($heading['text']) . '</' . $heading['level'] . '>';
        }
        $output .= '<ul' . drupal_attributes($attributes) . '>';

        $num_links = count($links);
        $i = 1;

        foreach ($links as $key => $link) {
            $class = array($key);

            // Add first, last and active classes to the list of links to help out themers.
            if ($i == 1) {
                $class[] = 'first';
            }
            if ($i == $num_links) {
                $class[] = 'last';
            }
            if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page())) && (empty($link['language']) || $link['language']->language == $language_url->language)) {
                $class[] = 'current';
            }
            $output .= '<li' . drupal_attributes(array('class' => $class)) . '>';

            if (isset($link['href'])) {
                // Pass in $link as $options, they share the same keys.
                $output .= l($link['title'], $link['href'], $link);
            }
            elseif (!empty($link['title'])) {
                // Some links are actually not links, but we wrap these in <span> for adding title and class attributes.
                if (empty($link['html'])) {
                    $link['title'] = check_plain($link['title']);
                }
                $span_attributes = '';
                if (isset($link['attributes'])) {
                    $span_attributes = drupal_attributes($link['attributes']);
                }
                $output .= '<span' . $span_attributes . '>' . $link['title'] . '</span>';
            }

            $i++;
            $output .= "</li>\n";
        }

        $output .= '</ul>';
    }

    return $output;
}
/**
 * Theme Menu Link
 */
function md_official_menu_link($variables) {
    global $language_url;
    $frontpage = variable_get('site_frontpage','node');
    $element = $variables['element'];
    $sub_menu = '';
    if ($element['#below']) {
        unset($element['#below']['#theme_wrappers']);
        $sub_menu = '<ul>' . drupal_render($element['#below']) . '</ul>';
    }
    if (($element['#href'] == $_GET['q'] || ($element['#href'] == '<front>' && drupal_is_front_page() == true)) && (empty($element['#localized_options']['language']))) {
        $element['#attributes']['class'][] = 'current';
    }
    $output = l($element['#title'], $element['#href'], $element['#localized_options']);
    return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}
/**
 * Update breadcrumbs
 */
function md_official_breadcrumb($variables) {
    $breadcrumb = $variables['breadcrumb'];
    if (!empty($breadcrumb)) {
        if (!drupal_is_front_page() && !empty($breadcrumb)) {
            $node_title = filter_xss(menu_get_active_title(), array());
            $breadcrumb[] = $node_title;
        }
        if (count($breadcrumb) == 1) {
            $breadcrumb = array();
        }
        return strip_tags(theme('item_list', array('items' => $breadcrumb, 'attributes' => array('class' => array('breadcrumb')))), '<ul><li><a>');
    }
}
/**
 * @param $variables
 * @return string
 * Theme textfield
 */
function md_official_textfield($variables) {
    $element = $variables['element'];
    $element['#attributes']['type'] = 'text';
    element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
    _form_set_class($element, array('form-text'));

    $extra = '';
    if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
        drupal_add_library('system', 'drupal.autocomplete');
        $element['#attributes']['class'][] = 'form-autocomplete';

        $attributes = array();
        $attributes['type'] = 'hidden';
        $attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
        $attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE));
        $attributes['disabled'] = 'disabled';
        $attributes['class'][] = 'autocomplete';
        $extra = '<input' . drupal_attributes($attributes) . ' />';
    }
    $element['#attributes']['class'][] = 'input-style';

    $output = '<input' . drupal_attributes($element['#attributes']) . ' />';

    return $output . $extra;
}

/**
 * @param $variables
 * @return string
 * Theme textarea
 */
function md_official_textarea($variables) {
    $element = $variables['element'];
    element_set_attributes($element, array('id', 'name', 'cols', 'rows'));
    _form_set_class($element, array('form-textarea'));

    $wrapper_attributes = array(
        'class' => array('form-textarea-wrapper'),
    );

    // Add resizable behavior.
    if (!empty($element['#resizable'])) {
        drupal_add_library('system', 'drupal.textarea');
        $wrapper_attributes['class'][] = 'resizable';
    }
    $element['#attributes']['class'] = 'input-style';
    $output = '<div' . drupal_attributes($wrapper_attributes) . '>';
    $output .= '<textarea' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
    $output .= '</div>';
    return $output;
}

/**
 * @param $variables
 * @return string
 * Theme form element label
 */
function md_official_form_element_label($variables) {
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();

    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
        return '';
    }

    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';

    $title = filter_xss_admin($element['#title']);

    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element['#title_display'] == 'after') {
        $attributes['class'] = 'option';
    }
    // Show label only to screen readers to avoid disruption in visual flows.
    elseif ($element['#title_display'] == 'invisible') {
        $attributes['class'] = 'element-invisible';
    }

    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }

    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $t('!title !required', array('!title' => $title, '!required' => $required)) . "</label>\n";
}

/**
 * @param $variables
 * @return string
 * Theme fieldset
 */
function md_official_fieldset($variables) {
    $element = $variables['element'];
    element_set_attributes($element, array('id'));
    _form_set_class($element, array('form-wrapper'));

    $output = '<fieldset' . drupal_attributes($element['#attributes']) . '>';
    if (!empty($element['#title'])) {
        // Always wrap fieldset legends in a SPAN for CSS positioning.
        $output .= '<legend><span class="fieldset-legend col-title">' . $element['#title'] . '</span></legend><span class="liner mbt"></span>';
    }
    $output .= '<div class="fieldset-wrapper">';
    if (!empty($element['#description'])) {
        $output .= '<div class="fieldset-description">' . $element['#description'] . '</div>';
    }
    $output .= $element['#children'];
    if (isset($element['#value'])) {
        $output .= $element['#value'];
    }
    $output .= '</div>';
    $output .= "</fieldset>\n";
    return $output;
}
/**
 * @param $variables
 * @return string
 * Theme select
 */
function md_official_select($variables) {
    $element = $variables['element'];
    element_set_attributes($element, array('id', 'name', 'size'));
    _form_set_class($element, array('form-select'));

    return '<div class="customlist"><select' . drupal_attributes($element['#attributes']) . '>' . form_select_options($element) . '</select></div>';
}

/**
 * @param $variables
 * @return string
 * Theme radio
 */
function md_official_radio($variables) {
    $element = $variables['element'];
    $element['#attributes']['type'] = 'radio';
    element_set_attributes($element, array('id', 'name','#return_value' => 'value'));

    if (isset($element['#return_value']) && $element['#value'] !== FALSE && $element['#value'] == $element['#return_value']) {
        $element['#attributes']['checked'] = 'checked';
    }
    _form_set_class($element, array('form-radio'));
    $element['#attributes']['class'][] = 'styled';
    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}
/**
 * Update status messages
 */
function md_official_status_messages($variables) {
    $display = $variables['display'];
    $output = '';

    $status_heading = array(
        'status' => t('Status message'),
        'error' => t('Error message'),
        'warning' => t('Warning message'),
        'info' => t('Informative message'),
    );

    // Map Drupal message types to their corresponding Bootstrap classes.
    // @see http://twitter.github.com/bootstrap/components.html#alerts
    $status_class = array(
        'status' => 'success',
        'error' => 'error',
        'warning' => 'warning',
        // Not supported, but in theory a module could send any type of message.
        // @see drupal_set_message()
        // @see theme_status_messages()
        'info' => 'info',
    );

    foreach (drupal_get_messages($display) as $type => $messages) {
        $class = (isset($status_class[$type])) ? $status_class[$type] : '';
        $output .= "<div class=\"notification-box notification-box-$class\">\n";


        if (!empty($status_heading[$type])) {
            $output .= '<h4 class="element-invisible">' . $status_heading[$type] . "</h4>\n";
        }
        $output .= '<div class="message-body">';
        if($status_class[$type] == 'success') {
            $output .= '<i class="icon-ok"></i>';
        }
        if($status_class[$type] == 'error') {
            $output .= '<i class="icon-remove-sign"></i>';
        }
        if($status_class[$type] == 'warning') {
            $output .= '<i class="icon-warning-sign"></i>';
        }
        if($status_class[$type] == 'info') {
            $output .= '<i class="icon-info-sign"></i>';
        }
        if (count($messages) > 1) {
            $output .= " \n";
            foreach ($messages as $message) {
                $output .= '  <p>' . $message . "</p>\n";
            }
            $output .= " \n";
        }
        else {
            $output .= $messages[0];
        }
        $output .= '</div>';
        $output .= "  <a class=\"notification-close notification-close-$class\" data-dismiss=\"alert\" href=\"#\"><i class=\"icon-remove\"></i></a>\n";
        $output .= "</div>\n";
    }
    return $output;
}
/**
 * @param $form
 * @param $form_state
 * @param $form_id
 */
function md_official_form_alter(&$form, &$form_state, $form_id) {
    if (stristr($form_id, "simplenews_block_form")) {
        $form['submit']['#attributes']['class'] = array('theme_btn');
        $form['mail']['#attributes']['placeholder'] = t('Type Your Email');
    }
    if (strpos((string)($form_id),"webform_client_form") === false) {
        switch ($form_id) {
            case 'user_login':
                $form['#attributes']['class'][] = 'form';
                $form['name']['#attributes']['class'][] = 'contact-form';
                $form['name']['#prefix'] = '<div class="input-wrapper">';
                $form['name']['#suffix'] = '</div>';
                $form['pass']['#attributes']['class'][] = 'contact-form';
                $form['pass']['#prefix'] = '<div class="input-wrapper">';
                $form['pass']['#suffix'] = '</div>';
                $form['actions']['submit']['#value'] = t('Login');
                $form['actions']['submit']['#attributes']['class'][] = 'btn btn-default pull-left';
                $form['actions']['submit']['#prefix'] = '<div class="clearfix">';
                $form['actions']['submit']['#suffix'] = '</div>';
                break;
            case 'user_register_form':
                $form['#attributes']['class'][] = 'form';
                $form['account']['name']['#attributes']['class'][] = 'contact-form';
                $form['account']['name']['#prefix'] = '<div class="input-wrapper">';
                $form['account']['name']['#suffix'] = '</div>';
                $form['account']['mail']['#attributes']['class'][] = 'contact-form';
                $form['account']['mail']['#prefix'] = '<div class="input-wrapper">';
                $form['account']['mail']['#suffix'] = '</div>';
                $form['actions']['submit']['#value'] = t('Create new account');
                $form['actions']['submit']['#attributes']['class'][] = 'btn btn-default pull-left';
                $form['actions']['submit']['#prefix'] = '<div class="clearfix">';
                $form['actions']['submit']['#suffix'] = '</div>';
                break;
            case 'user_login_block':
                $form['#attributes']['class'][] = 'form';
                $form['name']['#attributes']['class'][] = 'contact-form';
                $form['name']['#prefix'] = '<div class="input-wrapper">';
                $form['name']['#suffix'] = '</div>';
                $form['pass']['#attributes']['class'][] = 'contact-form';
                $form['pass']['#prefix'] = '<div class="input-wrapper">';
                $form['pass']['#suffix'] = '</div>';
                $form['actions']['submit']['#value'] = t('Login');
                $form['actions']['submit']['#attributes']['class'][] = 'btn btn-default pull-left';
                $form['actions']['submit']['#prefix'] = '<div class="clearfix">';
                $form['actions']['submit']['#suffix'] = '</div>';
                break;
            case 'user_pass':
                $form['name']['#attributes']['class'][] = 'contact-form';
                $form['name']['#prefix'] = '<div class="input-wrapper">';
                $form['name']['#suffix'] = '</div>';
                $form['pass']['#attributes']['class'][] = 'contact-form';
                $form['pass']['#prefix'] = '';
                $form['pass']['#suffix'] = '';
                $form['actions']['submit']['#value'] = t('Request new password');
                $form['actions']['submit']['#attributes']['class'][] = 'btn btn-default pull-left';
                $form['actions']['submit']['#prefix'] = '';
                $form['actions']['submit']['#suffix'] = '';
                break;
            case 'search_block_form':

                $form['search_block_form']['#field_suffix'] = '';
                $form['search_block_form']['#attributes']['placeholder'] = t('Start Searching..');

                //$form['actions']['submit'] = array('#markup' => '<button type="submit"><i class="icon-search"></i></button>');

                //$form['actions']['submit']['#value'] = t('');

                $form['search_block_form']['#title_display'] = 'invisible'; // Toggle label visibilty

                $form['actions']['submit'] = array('#type' => 'image_button', '#src' => base_path() . path_to_theme() . '/img/s11.png');

                // Add extra attributes to the text box
                $form['search_block_form']['#attributes']['onblur'] = "if (this.value == '') {this.value = 'Start Searching...';}";
                $form['search_block_form']['#attributes']['onfocus'] = "if (this.value == 'Search') {this.value = '';}";

                break;
            case 'search_form':
                $form['basic']['submit']['#prefix'] = '<div class="form-submit"><div class="form-controls">';
                $form['basic']['submit']['#suffix'] = '</div></div>';
                $form['basic']['submit']['#attributes'] = array(
                    'class' => array('transition button'),
                );
                $form['advance']['#prefix'] = '<div class="row"><div class="container">';
                $form['advance']['#suffix'] = '</div></div>';
                $form['advance']['submit']['#prefix'] = '<div class="form-submit"><div class="form-controls">';
                $form['advance']['submit']['#suffix'] = '</div></div>';
                $form['advance']['submit']['#attributes'] = array(
                    'class' => array('transition button'),
                );
                break;
        }
    } else {
        $form['#prefix'] = '';
        $form['#suffix'] = '';
        if(!empty($form['submitted'])) {
            foreach($form['submitted'] as $key => $component) {
                if(is_array($component) == TRUE) {
                    if($component['#type'] == 'textarea') {
                        $component['#attributes']['class'][] = 'col-md-12';
                        $component['#resizable'] = FALSE;
                    } else {
                        $component['#prefix'] = '<div class="col-md-6">';
                        $component['#suffix'] = '</div>';
                        $component['#attributes']['class'][] = '';
                    }
                }
            }
        }
        $form['actions']['submit']['#attributes']['class'][] = '';
        $form['actions']['submit']['#prefix'] = '<div class="col-md-12">';
        $form['actions']['submit']['#suffix'] = '</div>';
    }


}

/**
 * template_preprocess_user_picture()
 */
function md_official_preprocess_user_picture(&$variables) {
    $variables['user_picture'] = '';
    if (variable_get('user_pictures', 0)) {
        $account = $variables['account'];
        if (!empty($account->picture)) {
            // @TODO: Ideally this function would only be passed file objects, but
            // since there's a lot of legacy code that JOINs the {users} table to
            // {node} or {comments} and passes the results into this function if we
            // a numeric value in the picture field we'll assume it's a file id
            // and load it for them. Once we've got user_load_multiple() and
            // comment_load_multiple() functions the user module will be able to load
            // the picture files in mass during the object's load process.
            if (is_numeric($account->picture)) {
                $account->picture = file_load($account->picture);
            }
            if (!empty($account->picture->uri)) {
                $filepath = $account->picture->uri;
            }
        }
        elseif (variable_get('user_picture_default', '')) {
            $filepath = variable_get('user_picture_default', '');
        }
        if (isset($filepath)) {
            $alt = t("@user's picture", array('@user' => format_username($account)));
            // If the image does not have a valid Drupal scheme (for eg. HTTP),
            // don't load image styles.
            if (module_exists('image') && file_valid_uri($filepath) && $style = variable_get('user_picture_style', '')) {
                $variables['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt, 'attributes' => array('class' => array('image-author profile-image'))));
            }
            else {
                $variables['user_picture'] = theme('image', array('path' => $filepath, 'alt' => $alt, 'title' => $alt, 'class' => array('profile-image')));
            }
            if (!empty($account->uid) && user_access('access user profiles')) {
                $attributes = array(
                    'attributes' => array('title' => t('View user profile.'),'class' => array('profile-image-link')),
                    'html' => TRUE,
                );
                $variables['user_picture'] = l($variables['user_picture'], "user/$account->uid", $attributes);
            }
        }
    }

}
/**
 *
 */

/**
 * @param $theme_registry
 * An implementation of hook_theme_registry_alter() Substitute our own custom version of the standard 'theme_form_element' function. If the theme has overridden it, we'll be bypassed, but in most cases this will work nicely..
 */
function md_official_theme_registry_alter(&$theme_registry) {
    if (!empty($theme_registry['form_element'])) {
        $theme_registry['form_element']['function'] = 'md_official_form_element';
    }
}
/**
 * Returns HTML for a form element.
 *
 * Each form element is wrapped in a DIV container having the following CSS
 * classes:
 * - form-item: Generic for all form elements.
 * - form-type-#type: The internal element #type.
 * - form-item-#name: The internal form element #name (usually derived from the
 *   $form structure and set via form_builder()).
 * - form-disabled: Only set if the form element is #disabled.
 *
 * In addition to the element itself, the DIV contains a label for the element
 * based on the optional #title_display property, and an optional #description.
 *
 * The optional #title_display property can have these values:
 * - before: The label is output before the element. This is the default.
 *   The label includes the #title and the required marker, if #required.
 * - after: The label is output after the element. For example, this is used
 *   for radio and checkbox #type elements as set in system_element_info().
 *   If the #title is empty but the field is #required, the label will
 *   contain only the required marker.
 * - invisible: Labels are critical for screen readers to enable them to
 *   properly navigate through forms but can be visually distracting. This
 *   property hides the label for everyone except screen readers.
 * - attribute: Set the title attribute on the element to create a tooltip
 *   but output no label element. This is supported only for checkboxes
 *   and radios in form_pre_render_conditional_form_element(). It is used
 *   where a visual label is not needed, such as a table of checkboxes where
 *   the row and column provide the context. The tooltip will include the
 *   title and required marker.
 *
 * If the #title property is not set, then the label and any required marker
 * will not be output, regardless of the #title_display or #required values.
 * This can be useful in cases such as the password_confirm element, which
 * creates children elements that have their own labels and required markers,
 * but the parent element should have neither. Use this carefully because a
 * field without an associated label can cause accessibility challenges.
 *
 * @param $variables
 *   An associative array containing:
 *   - element: An associative array containing the properties of the element.
 *     Properties used: #title, #title_display, #description, #id, #required,
 *     #children, #type, #name.
 *
 * @ingroup themeable
 */
function md_official_form_element($variables) {
    $element = &$variables['element'];

    // This function is invoked as theme wrapper, but the rendered form element
    // may not necessarily have been processed by form_builder().
    $element += array(
        '#title_display' => 'before',
    );

    // Add element #id for #type 'item'.
    if (isset($element['#markup']) && !empty($element['#id'])) {
        $attributes['id'] = $element['#id'];
    }
    // Add element's #type and #name as class to aid with JS/CSS selectors.
    $attributes['class'] = array('form-item');
    if (!empty($element['#type'])) {
        $attributes['class'][] = 'form-type-' . strtr($element['#type'], '_', '-');
    }
    if (!empty($element['#name'])) {
        $attributes['class'][] = 'form-item-' . strtr($element['#name'], array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
    }
    // Add a class for disabled elements to facilitate cross-browser styling.
    if (!empty($element['#attributes']['disabled'])) {
        $attributes['class'][] = 'form-disabled';
    }
    $output = '<div' . drupal_attributes($attributes) . '>' . "\n";

    // If #title is not set, we don't display any label or required marker.
    if (!isset($element['#title'])) {
        $element['#title_display'] = 'none';
    }
    $prefix = isset($element['#field_prefix']) ? '' . $element['#field_prefix'] . '' : '';
    $suffix = isset($element['#field_suffix']) ? '' . $element['#field_suffix'] . '' : '';

    switch ($element['#title_display']) {
        case 'before':
        case 'invisible':
            $output .= ' ' . theme('form_element_label', $variables);
            $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
            break;

        case 'after':
            $output .= ' ' . $prefix . $element['#children'] . $suffix;
            $output .= ' ' . theme('form_element_label', $variables) . "\n";
            break;

        case 'none':
        case 'attribute':
            // Output no label and no required marker, only the children.
            $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
            break;
    }

    if (!empty($element['#description'])) {
        $output .= '<div class="description">' . $element['#description'] . "</div>\n";
    }

    $output .= "</div>\n";

    return $output;
}
/**
 * Theme_button
 */
function md_official_button($variables) {
    $element = $variables['element'];
    $element['#attributes']['type'] = 'submit';
    element_set_attributes($element, array('id', 'name', 'value'));

    $element['#attributes']['class'][] = 'form-' . $element['#button_type'] . ' transition button';
    if (!empty($element['#attributes']['disabled'])) {
        $element['#attributes']['class'][] = 'form-button-disabled';
    }

    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}

/**
 * Get frontpage url
 */
function front_page() {
    $front_page = variable_get('site_frontpage', 'node');
    return $front_page;
}
function md_official_preprocess_file_entity(&$variables) {
    if ($variables['type'] == 'image') {
        // Alt Text
        if (!empty($variables['field_media_alt_text'])) {
            $variables['content']['file']['#alt'] = $variables['field_media_alt_text']['und'][0]['safe_value'] ? $variables['field_media_alt_text']['und'][0]['safe_value'] : '';
        }
        // Title
        if (!empty($variables['field_media_title'])) {
            $variables['content']['file']['#title'] = $variables['field_media_title']['und'][0]['safe_value'] ? $variables['field_media_title']['und'][0]['safe_value'] : '';
        }
    }
}
function md_official_get_user_posts_count($uid) {
    $query = db_select('node', 'n');
    $query->condition('uid',$uid,'=');
    $query->condition('type','forum','=');
    $query->addExpression('COUNT(nid)', 'posts_count');
    $result = $query->execute();
    if ($record = $result->fetchAssoc())
        return $record['posts_count'];
    return 0;
}
function md_official_blog_multimedia_render($multimedia) {
    $output = array('icon','content');
    $media_content = '';
    $icon = '';
    $count = count($multimedia);
    if($multimedia != null) {
        if(count($multimedia) > 1) {
            $icon = '<i class="icon-picture"></i>';
            $media_content = '<div class="projectslider clearfix flexslider"><ul class="slides">';
        } else {
            if(isset($multimedia[0]) && !empty($multimedia[0])) {
                $file_type = $multimedia[0]['rendered']['#file']->type;
                if($file_type == 'image') {
                    $icon = '<i class="icon-picture"></i>';
                } elseif ($file_type == 'audio') {
                    $icon = '<i class="icons-music"></i>';
                } elseif ($file_type == 'video') {
                    $icon =  '<i class="icon-film"></i>';
                }
            }
        }

        foreach($multimedia as $key => $value){
            $file_type = $value['rendered']['#file']->type;
            if(count($multimedia) > 1) {
                $media_content .= '<li>';
            }
            $media_content .= render($multimedia[$key]['rendered']);
            if(count($multimedia) > 1) {
                $media_content .= '</li>';
            }
        }
        if(count($multimedia) > 1) {
            $media_content .= '</ul></div>';
        }
    }

    $output['icon'] = $icon;
    $output['content'] = $media_content;
    return $output;
}
function md_official_portfolio_multimedia_render($multimedia) {
    $output = '';
    if(count($multimedia) > 1) {
        foreach($multimedia as $key => $value) {
            if($value['file']->type == 'image') {
                $output .= '<div class="item"><img alt="" class="four-radius mbf" src="'.file_create_url($value['file']->uri).'"></div>';
            } else {
                $output .= drupal_render($multimedia[$key]);
            }
        }
    } else {
        $output .= render($multimedia[0]);
    }
    
    return $output;
}

Comments

miltondiaz’s picture

Your concat operand is wrong, should be

$element .= array(
        '#title_display' => 'before',
    );

http://php.net/manual/es/internals2.opcodes.concat.php

Jaypan’s picture

Maybe what you have will work, but using the plus signs as operators with arrays is not incorrect: http://stackoverflow.com/questions/2140090/operator-for-array-in-php