Problem Motivation
As the method token_replace() is removed from Drupal 8, let us remove all documentation references to it.
I did a directory search for the method and found 3 references to token_replace() in core file module.
/**
* Determines the URI for a file field.
*
* @param array $data
* An array of token objects to pass to token_replace().
*
* @return string
* An unsanitized file directory URI with tokens replaced. The result of
* the token replacement is then converted to plain text and returned.
*
* @see token_replace()
*/
public function getUploadLocation($data = array()) {
return static::doGetUploadLocation($this->getSettings(), $data);
}
**
* Determines the URI for a file field.
*
* @param array $settings
* The array of field settings.
* @param array $data
* An array of token objects to pass to token_replace().
*
* @return string
* An unsanitized file directory URI with tokens replaced. The result of
* the token replacement is then converted to plain text and returned.
*/
protected static function doGetUploadLocation(array $settings, $data = []) {
Remaining tasks
Replace token_replace() with \Drupal::token()->replace();
Link to Token API drupal 8 core.
Comments
Comment #2
ritzz commentedI am working on it.
Comment #3
ritzz commentedComment #4
vishwac9 commentedpatch works well thanks @ritzz, changing the status to RTBC
Comment #5
shashikant_chauhan commented@ritzz, small changes.
1. Remove semicolon.
2. replace semicolon from "\Drupal::token()->replace();" to "."
Comment #6
ritzz commentedComment #7
shashikant_chauhan commentedupdating status.
Comment #8
vickynandode commentedEverything looks good. Changing the status to RTBC
Comment #9
xjmIn documentation, we should reference the fully namespaced class and method for
Token::replace(), rather than\Drupaland the service. Thanks!Comment #10
ritzz commentedComment #11
jeetendrakumar commentedLook Good. Changing the status to RTBC.
Comment #12
alexpottThis needs to be a fully qualified class name. I.e.
@see \Drupal\Core\Utility\Token::replace().Can we add an @see to this method too. So api.d.o links it up. The @see should be the same as the one above and below the @return.
Comment #13
Munavijayalakshmi commentedComment #14
priyanka.attarde commentedthanks a lot @Munavijayalakshmi, patch applied good
Comment #15
alexpottCommitted and pushed 0179304 to 8.4.x and 6b54e4c to 8.3.x. Thanks!
Comment #18
vishwac9 commentedThanks a lot