2010-01-06 5 views

답변

0

해결책을 찾았습니다. 매우 바보 같습니다.

나는 사용자 정의 모듈이 퍼팅 결국, 모두가 라벨을 제거하고 또한 데이터베이스의 데이터를 기반으로 표시된 년의 수를 설정 결국 :

function modulename_form_views_exposed_form_alter(&$form, $form_state) { 
    if($form['#id'] == 'theformid') { 
     // Remove the label as the first element from the date select 
     $form['date_filter']['value']['#date_label_position'] = 'none'; 

     // Find the minimum year from all of the published news nodes 
     $date = db_fetch_array(
        db_query(" 
          SELECT YEAR(MIN(d.field_date_value)) as 'min' 
          FROM {content_field_date} d 
          INNER JOIN {node} n 
           ON n.nid = d.nid 
          WHERE n.type = 'news' AND n.status = 1") 
       ); 

     // Set the new year range in the filter 
     $new_min = date('Y') - $date['min']; 
     $form['date_filter']['value']['#date_year_range'] = "-$new_min:+0"; 
    } 
} 
0

날짜 필터를 구성 할 때 "절대 값"드롭 다운에서 1 년을 선택하십시오. 그 해는 -Year 대신 표시됩니다. 소스 코드를 변경하거나 추가하지 않는 한 노출 된 선택 상자에서 실제로 제거 할 수는 있지만 의심 스럽습니다.

+0

문제는 우리가 원하는 것입니다 현재 선택되는 연도 마침내 솔루션을 찾았습니다. 아래에 게시 해 드리겠습니다. – Karl

관련 문제