2013-09-24 3 views
0

Я установил модуль модальных форм в drupal 7 (https://drupal.org/project/modal_forms), чтобы создать форму входа в модальное окно. Но теперь, я пытаюсь изменить его appereance с css, но я не знаю, как это сделать.Изменение формы модуля модуляции входа в систему drupal 7

Кто-нибудь знает, как изменить, например, кнопку ввода ввода, применяющую один класс css?

Это мой код:

function get_output_ajax(){ 
       $output = array(); 
        ctools_add_js('ajax-responder'); 
        $output[] = ctools_modal_command_dismiss(t('Login success')); 
        if (isset($_GET['destination'])) { 
        $output[] = ctools_ajax_command_redirect($_GET['destination']); 
        } 
        elseif(module_exists('login_destination')) { 
        $destination = login_destination_get_destination('login'); 
        $output[] = ctools_ajax_command_redirect($destination['path']); 
        } 
        else { 
        $output[] = ctools_ajax_command_reload(); 
        } 
       return $output; 

} 

function modal_forms_login($js = NULL) { 

       // Fall back if $js is not set. 
       if (!$js) { 
       return drupal_get_form('user_login'); 
       } 
        $output = get_output_ajax(); 

       } 
       } 
       else{ 
        $output = get_output_ajax(); 
       } 



       print ajax_render($output); 
      }   global $user; 
       if ($user->uid == 0) { 
       $output = ctools_modal_form_wrapper('user_login', $form_state); 
       if (!empty($form_state['executed'])) { 
        $output = get_output_ajax(); 

       } 
       } 
       else{ 
        $output = get_output_ajax(); 
       } 



       print ajax_render($output); 
} 

Спасибо заранее.

ответ

0

Вот мое решение, это работает для меня:

function modal_forms_login($js = NULL) { 
    // Fall back if $js is not set. 
    if (!$js) { 
     return drupal_get_form('user_login'); 
    } 

    ctools_include('modal'); 
    ctools_include('ajax'); 
    $form_state = array(
      // 'title' => t('Log in'), 
      'ajax' => TRUE, 
    ); 
    global $user; 
    if ($user->uid == 0) { 
     $output = ctools_modal_form_wrapper('user_login', $form_state); 

     //Necesario para editar el boton del login 
     $cadena = $output[0]['output']; 
     $patrón = '/class="form-submit"/'; 
     $sustitución = 'class="form-submit btn btn-primary"'; 
     $output[0]['output'] = preg_replace($patrón, $sustitución, $cadena); 

     if (!empty($form_state['executed'])) { 
      $output = get_output_ajax(); 

     } 
    } 
    else{ 
     $output = get_output_ajax(); 
    } 



    print ajax_render($output); 
} 
Смежные вопросы