2012-07-30 2 views

답변

3

... 지정된 콜백 노드 ID의 배열을

function pathauto_node_operations() { 
    $operations['pathauto_update_alias'] = array(
    'label' => t('Update URL alias'), 
    'callback' => 'pathauto_node_update_alias_multiple', 
    'callback arguments' => array('bulkupdate', array('message' => TRUE)), 
); 
    return $operations; 
} 

주의 사항, 플러스 후크 구현에서 지정한 추가 콜백 인수 (위의 예제 참조).

// The call back specified above^
function pathauto_node_update_alias_multiple(array $nids, $op, array $options = array()) { 
    $options += array('message' => FALSE); 

    $nodes = node_load_multiple($nids); 
    foreach ($nodes as $node) { 
    pathauto_node_update_alias($node, $op, $options); 
    } 

    if (!empty($options['message'])) { 
    drupal_set_message(format_plural(count($nids), 'Updated URL alias for 1 node.', 'Updated URL aliases for @count nodes.')); 
    } 
} 
+0

어떻게 보이나요?하지만 어떻게 추가 할 수 있습니까? 너에게 모범을 보였 니? –

+0

나는 [Pathauto 모듈] (http://drupal.org/project/pathauto)의 예제를 보여주기 위해 나의 대답을 편집했다. – nmc

관련 문제