Привет!
Подскажите, как доработать модуль fancy login (всплывающее окно запроса логина+пароль), чтобы туда поместить картинку?
Вот ссылка http://villagmbh.at/user/login?destination=node
Хочу чтобы над или под была еще картинка. Типа такого:
Кусок кода модуля fancy_login.module, видимо, тут где-то это надо прописать, как мне кажется:
<?php
// $Id: fancy_login.module,v 1.15 2011/01/25 06:02:54 hakulicious Exp $
/**
* Function that is displayed in the popup to allow the user to log in
*/
function fancy_login_form()
{
global $base_url;
$form_id = 'user_login';
$form = array();
$icon_position = FALSE;
if(variable_get('fancy_login_https', 0) && $icon_position = variable_get('fancy_login_icon_position', 0))
{
$icon = theme('ssl_icon', $base_url);
}
if($icon_position == 1)
{
$form['ssl_logo'] = array
(
'#value' => $icon,
);
}
$form['name'] = array
(
'#title' => t('Username'),
'#type' => 'textfield',
'#maxlength' => USERNAME_MAX_LENGTH,
'#size' => 15,
'#required' => TRUE,
'#attributes' => array('tabindex' => '1'),
);
$form['pass'] = array
(
'#title' => t('Password'),
'#type' => 'password',
'#required' => TRUE,
'#size' => 15,
'#attributes' => array('tabindex' => '2'),
);
if($icon_position == 2)
{
$form['ssl_logo'] = array
(
'#value' => $icon,
);
}
$form['submit'] = array
(
'#type' => 'submit',
'#value' => t('Log in'),
'#weight' => 2,
'#attributes' => array('tabindex' => '3')
);
$form['#validate'] = user_login_default_validators();
$form['#build_id'] = sprintf('form-%s', md5(uniqid(mt_rand(), TRUE)));
$form_state = array();
drupal_prepare_form($form_id, $form, $form_state);
drupal_process_form($form_id, $form, $form_state);
$out = new stdClass;
if(variable_get('fancy_login_https', 0))
{
$post_url = preg_replace('/^http:\/\//', 'https://', url('user/login', array('absolute' => TRUE)));
}
else
{
$post_url = url('user/login');
}
$out->form_start = sprintf('<form id="user-login" method="post" accept-charset="UTF-8" action="%s"><div>', $post_url);
if($icon_position == 1)
{
$out->form_start = str_replace('<form ', '<form class="ssl_icon_above" ', $out->form_start);
}
elseif($icon_position == 2)
{
$out->form_start = str_replace('<form ', '<form class="ssl_icon_below" ', $out->form_start);
}
$out->form_end = "</div></form>";
foreach(element_children($form) as $key)
{
if(!in_array($key, array('submit', 'form_build_id', 'form_id')))
{
$out->$key = drupal_render($form[$key]);
}
}
$items = array();
if (variable_get('user_register', 1))
{
$items[] = l(t('Create new account'), 'user/register', array('attributes' => array('title' => t('Create a new user account.'))));
}
if(!module_exists('noreqnewpass') || !variable_get('noreqnewpass_disabled', FALSE))
{
$items[] = l(t('Request new password'), 'user/password', array('attributes' => array('title' => t('Request new password via e-mail.'))));
}
$form['links'] = array('#value' => theme('item_list', $items));
$out->links = drupal_render($form['links']);
$out->submit = drupal_render($form['form_id']) . drupal_render($form['form_build_id']) . drupal_render($form['submit']);
return $out;
}
/**
* Function that is called to create the popup that allows the user to log in
*/
function fancy_login_get_form()
{
global $base_url;
$path = drupal_get_path('module', 'fancy_login');
$image_path = $base_url . '/' . $path . '/images/ajax-loader.gif';
$login_form = fancy_login_form();
$output = '<div id="fancy_login_login_box">';
$output .= '<div id="fancy_login_form_contents">';
$output .= '<a href="#" id="fancy_login_close_button">X</a>';
$output .= $login_form->form_start;
foreach($login_form as $key => $value)
{
if(!in_array($key, array('form_start', 'form_end', 'links')))
{
$output .= $login_form->$key;
}
}
$output .= $login_form->form_end;
$output .= $login_form->links;
$output .= '</div>';
$output .= '<div id="fancy_login_ajax_loader"><img src="' . $image_path . '" alt="' . t('Loading') . '" /></div>';
$output .= '</div>';
return $output;
}
/**
* Implementation of hook_block()
*/
function fancy_login_block($op = 'list', $delta = 0, $edit = array())
{
global $user;
if ($op == "list")
{
$block = array();
$block[0]['info'] = t('Fancy Login Link');
return $block;
}
elseif($op == 'view' && !$user->uid && !$user->uid && !(arg(0) == 'user' && !is_numeric(arg(1))))
{
$destination = drupal_get_destination();
$block['subject'] = t('Login');
$block['content'] = l(t('Login'), 'user/login');
return $block;
}
}
?>
Помогите, пожалуйста )
Спасибо!
Вложение | Размер |
---|---|
pict.gif | 65.3 КБ |
Комментарии
Если что, то вот в файле весь файл-модуля fancy_login.module
Код модуля не залился, кароче советую в слепую, тестить лучше на локале.
$out->form_start = sprintf('<form id="user-login" method="post" accept-charset="UTF-8" action="%s"><div>', $post_url);
Меняем на
$out->form_start = sprintf('<img src="#" alt=" /><form id="user-login" method="post" accept-charset="UTF-8" action="%s"><div>', $post_url);
По идее должен появиться перед формой. Чотбы расположить как надо, цепляем id или class к имеджу и css'ом двигаем.
Огромное спасибо! Помогло!