permalinks. auto generate from 2 fields

By zaba - December 9, 2017

For example in Cms a multi record section will have 2 text fields:

client

project

i want the permalink field to automatically generate this based on the content of those fields in that order.

So the above record would auto create the permalink

http://www.domain.com/client-text/project-text/

I know its possible to define a field as the one used for the permalink but is it possible to dynamically use 2 fields in order?

By Dave - December 22, 2017

Hi Zaba, 

Hmm, it doesn't do that by default.  But it does support multiple fields like this :

$GLOBALS['PERMALINKS']['autopopulate_fromFields'] = array('client project'); 

So you could try editing the _permalink_generate_getInputText() function in permalinks.php: 

And replace ' ' with '/' in these two lines: 

    $inputText .= $recordOrRequest[$field] . ' '; // trailing space in case more fields are added
  }
  break;
}
$inputText = rtrim($inputText, ' '); // remove trailing spaces

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com