에 나는 API를 사용하여 새로운 포럼을 만들 때마다 "만든 새 포럼 XXX"라는 메시지 숨기기 메시지 :드루팔
만든 새 포럼 ㅋ ㅋ ㅋ ㅋ
나타납니다 (상태 메시지) .
표시하지 않을 수 있습니까? 어쩌면 후크로?
에 나는 API를 사용하여 새로운 포럼을 만들 때마다 "만든 새 포럼 XXX"라는 메시지 숨기기 메시지 :드루팔
만든 새 포럼 ㅋ ㅋ ㅋ ㅋ
나타납니다 (상태 메시지) .
표시하지 않을 수 있습니까? 어쩌면 후크로?
메시지를 변경하는 데 사용할 수있는 후크를 만드는 모듈이 있습니다. http://drupal.org/project/messages_alter
나는 그것이 당신의 유스 케이스에서 효과가있을 것이라고 생각하지만, 당신이 뭔가를 필요로하거나 자신의 옵션을 선보이고 싶다면 : 모듈을 간략히보고 어떻게하면 만들 수 있는지에 대한 아이디어를 줄 것이다. 필요한 경우 구현하십시오.
솔직히 왜 우리가 모듈을 사용하지 않고 직접했는지 기억하지 못합니다.하지만 여기에 몇 가지 간단한 예제 코드가 있습니다.
/**
* function to check the messages for certian things and alter or remove thme.
* @param $messages - array containing the messages.
*/
function itrader_check_messages(&$messages){
global $user;
foreach($messages as &$display){
foreach($display as $key => &$message){
// this is where you'd put any logic for messages.
if ($message == 'A validation e-mail has been sent to your e-mail address. In order to gain full access to the site, you will need to follow the instructions in that message.'){
unset($display[$key]);
}
if (stristr($message, 'processed in about')){
unset($display[$key]);
}
}
}
// we are unsetting any messages that have had all their members removed.
// also we are making sure that the messages are indexed starting from 0
foreach($messages as $key => &$display){
$display = array_values($display);
if (count($display) == 0){
unset($messages[$key]);
}
}
return $messages;
}
테마 기능 :
/**
* Theme function to intercept messages and replace some with our own.
*/
function mytheme_status_messages($display = NULL) {
$output = '';
$all_messages = drupal_get_messages($display);
itrader_check_messages($all_messages);
foreach ($all_messages as $type => $messages) {
$output .= "<div class=\"messages $type\">\n";
if (count($messages) > 1) {
$output .= " <ul>\n";
foreach ($messages as $message) {
$output .= ' <li>'. $message ."</li>\n";
}
$output .= " </ul>\n";
}
else {
$output .= $messages[0];
}
$output .= "</div>\n";
}
return $output;
}
재고 메시지를 억제하는 것은 고통이지만 할 수 있습니다. 나는 좋은 방법이 'template_preprocess_page function (& $ variables)'을 만드는 것이라고 확신한다.
$ theme에 print_r을 설정한다. 페이지에 렌더링하려고하는 모든 메시지가 해당 배열의 어딘가에서 사용 가능할 것이라고 확신하고 페이지 템플리트의 모든 부분에 표시하지 않으려는 메시지의 설정을 해제 할 수 있습니다.
당신은 Disable Messages 모듈
를 사용하여이 아닌 프로그래밍 할 수