2013-08-14 3 views
0

안녕하세요, 나는 어떤 이유에서 스팬이나 레이블 (내가 < 스팬 > 선호)를 추가하려면 원하는 어떤 이유로 입력 검색 필드 전에 드루팔 (Drupal)드루팔 (Drupal 7 검색 입력 필드 전에 스팬을 추가하십시오.

달성 방법이 있습니까? 코어 파일을 수정하는 것이 행복하지 않습니다.

도움을 주시면 감사하겠습니다.

드루팔 버전 : 7

+0

나는이 대답을 발견, 기존 마크 업에 HTML을 추가 후크) hook_form_BASE_FORM_ID_alter을 (사용할 수 있습니다 http://stackoverflow.com/questions/15121231/drupal-7-add-html-inside -link-form-type-entry? rq = 1 모두에게 감사드립니다. –

답변

1

당신은

/** 
* Implements hook_form_BASE_FORM_ID_alter(); 
*/ 
function <MODULE_NAME>_search_block_form_alter(&$form, &$form_state, $form_id) { 
    //Reffer prefix from the api to add <span> or <label> 
    // https://api.drupal.org/api/drupal/developer%21topics%21forms_api_reference.html/7#prefix 

    // Reffer prefix from the api to add </span> or </label> 
//https://api.drupal.org/api/drupal/developer%21topics%21forms_api_reference.html/7#suffix 

} 

+0

감사합니다. 솔루션을 이미 찾았습니다. –

1

당신은 일반적으로 당신은 테마 폴더에 같은 기능을 사용할 수있는 preprocess 기능

와이를 달성. 테마는 "예"의 내용을 식별하는 변수 목록에서

 
// template_preprocess(&$variables, $hook), replace template 
//with the name of your theme 
function example_preprocess(&$variables, $hook) 
{ 
    dsm($hook); // You need the Devel module in order to use dsm()... 
} 
// this should output a list of hooks used on your page, 
//look for search_form or similar...then you could do 
function example_preprocess(&$variables, $hook) 
{ 
    if($hook == 'search_form') 
     dsm($variables); 
} 

봐 편집 할라고 가정하면, 다음은 함수의 콘텐츠를 편집 단지 질문입니다.

몇 가지 조사를 수행하면 많은 예제를 발견 할 수 있습니다!