I'm recieving the following error: You are using the token [nid] which is not valid within the scope of tokens where you are using it. I have created a custom node called "linkbutton" and have implemented the hook below for pathauto. If i have included [nid] in the list, why would I get an error? Thanks!

function linkbutton_pathauto($op) {
 switch ($op) {
     case 'settings':
       $settings = array();
       $settings['module'] = 'linkbutton';
       $settings['groupheader'] = t('Linkbutton path settings');
       $settings['patterndescr'] = t('Pattern for all Linkbutton paths');
       $settings['patterndefault'] = 'linkbutton/[nid]';
       $settings['placeholders'] = array(
        t('[title]') => t('The title of the node, with spaces and punctuation replaced by the separator.'),
        t('[nid]') => t('The id number of the node.'),
        t('[user]') => t('The name of the user who created the node.'),
        t('[type]') => t('The node type (e.g., "page", "story", etc.).'),
        t('[yyyy]') => t('The year the node was created.'),
        t('[mm]') => t('The two-digit month (01-12) the node was created.'),
        t('[mon]') => t('The three-letter month (jan-dec) the node was created.'),
        t('[dd]') => t('The two-digit day of the month (00-31) the node was created.'),
        t('[day]') => t('The three-letter day of the week (sun-sat) that the node was created.'),
        t('[hour]') => t('The two-digit hour (00-23) the node was created.'),
        t('[min]') => t('The two-digit minute (00-59) the node was created.'),
        t('[sec]') => t('The two-digit second (00-59) the node was created.'),
        t('[week]') => t('The week number (1-52) of the year the node was created.')
      );

       //$settings['supportsfeeds'] = '0/feed';
       //$settings['bulkname'] = t('Bulk generate aliases for link that are not aliased');
       //$settings['bulkdescr'] = t('Generate aliases for all existing image galleries which do not already have aliases.');
       return (object) $settings;
     default:
       break;
   }
}

Currently using the latest development version of pathauto. 5.x-2.1

Comments

greggles’s picture

Status: Active » Fixed

Pathauto no longer uses the _pathauto hookes, but the "tokens" for replacement are provided via the token module. I believe that the API.txt explains how this works and should redirect you to the token module's API.txt which explains better how to implement these.

Basically, all of the things like [sec] and [week] are no longer provided by the hook_pathauto but now are provided by hook_token_list and hook_token_values.

I've marked this fixed because I believe this will answer your question but please respond to let me know how things go and, if you still have problems, definitely re-open the issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.