- π³πΏNew Zealand quietone New Zealand
Further information has not been supplied. Time to close this one.
If you encounter this problem, open a new issue and refer to this one. Thanks
Having a field in a node with a given url, this code does not work anymore. It did in version 8.2.7.
namespace Drupal\mymodule\PathProcessor;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\PathProcessor;
use Drupal\Core\PathProcessor\InboundPathProcessorInterface;
use Drupal\Core\PathProcessor\OutboundPathProcessorInterface;
use Drupal\node\Entity\Node;
use Symfony\Component\HttpFoundation\Request;
class MymoduleFieldRedirectPathProcessor implements OutboundPathProcessorInterface {
public function processOutbound($path, &$options = array(), Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) {
if (isset($options['entity']) && is_object($options['entity']) && method_exists($options['entity'], 'hasField')) {
$node = $options['entity'];
if ($node->hasField('field_project_url') && !$node->field_project_url->isEmpty()) {
$project_url = $node->field_project_url->getValue();
if (preg_match("/^\/node\/[0-9]+\/(edit|translate|delete|translations)$/i", $path)) {
// dont alter operational paths
}
else {
$path = $project_url[0]['uri'];
$options['absolute'] = TRUE;
$options['external'] = TRUE;
$options['base_url'] = '';
$options['prefix'] = '';
}
if ($bubbleable_metadata) {
$bubbleable_metadata->addCacheableDependency($node);
}
}
}
return $path;
}
}
The url now looks like this:
localhost:8888/mysite/de/http%3A//www.urlfromfield.com
instead of
I wonder if this somehow relates to https://drupal.stackexchange.com/questions/234782/is-the-field-file-toke...
Closed: works as designed
9.5
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Further information has not been supplied. Time to close this one.
If you encounter this problem, open a new issue and refer to this one. Thanks