The `spaceless` filter in Twig was deprecated as of version 3.12. To address this deprecation, you should remove the `spaceless` filter from your Twig templates. Instead, rely on HTML minification tools, like AdvAgg or HTML Minifier, or front-end build tools to minimize whitespace in your output. Additionally, CSS can be used to manage whitespace rendering. Removing the filter ensures compatibility with future Twig versions.
Yes, the warning is generated because of an issue in the image file itself. Specifically, it indicates that the PNG image contains invalid or multiple ICC color profiles.
This worked for me!
It would be safer to keep the method and just remove the condition, turning it into a getter. This way, you avoid the risk of breaking contrib or custom modules that might rely on it. By keeping it as a getter, you ensure backward compatibility.
/**
* Returns the typed config manager service.
*
* @return \Drupal\Core\Config\TypedConfigManagerInterface
* The typed config manager service.
*/
protected function typedConfigManager(): TypedConfigManagerInterface {
return $this->typedConfigManager;
}
This will make sure your modules continue to work seamlessly without any unexpected breaks. Does this give you a bit more confidence in your change?
Using scrollIntoView() could be a better option here, especially if you have fixed headers or other elements that might obscure the view. It allows you to specify options for more control, like:
element.scrollIntoView({
behavior: 'smooth',
block: 'start',
inline: 'nearest'
});
Your CSS can define the scroll offset like you mentioned:
[data-once="ajax-pager"] {
scroll-margin-top: 5rem;
}
That JavaScript block recursing up the DOM to find the scrollable object seems to be a workaround that might no longer be necessary with scrollIntoView()
You can use pngcrush to remove unwanted metadata from PNG images
- Install pngcrush
- Run command -
pngcrush -rem allb -out output.png input.png
This patch will allow null values for $message and replace them with a default message ('An error occurred.') if null is encountered, ensuring the method behaves as expected.
This should prevent the error you're facing and provide a safe fallback when the field definition isn't available.
mdsohaib4242 โ made their first commit to this issueโs fork.
You can use the null coalescing operator (??) to set a default empty string in case getValue('name') returns null
Instead of:
$mock = $this->getMockForAbstractClass(EntityLink::class);
You can use PHPUnit's mocking framework like this:
$mock = $this->createMock(EntityLink::class);
This creates a mock object of EntityLink without relying on getMockForAbstractClass().
A more efficient approach would be to proceed with the migration from Drupal 7 to Drupal 10 as it is. Once the migration is complete, you can create a new "telephone" field in Drupal 10 and then transfer the data from the old field to the new one.
For example, if your content type is "article," and your existing field is `field_old` while the new telephone field is `field_new`, you can use a script to copy all the data.
$batch_size = 50;
$nids = \Drupal::entityQuery('node')
->condition('type', 'article')
->execute();
$nids_batches = array_chunk($nids, $batch_size);
foreach ($nids_batches as $batch) {
$article_nodes = \Drupal\node\Entity\Node::loadMultiple($batch);
foreach ($article_nodes as $article_node) {
if (!$article_node->get('field_old')->isEmpty()) {
$article_node->set('field_new', $article_node->get('field_old')->getValue());
$article_node->save();
}
}
}
This worked for me.
// Check if $languages is an array before using array_values()
$languages = $settings->get('languages');
if (is_array($languages)) {
$languages = array_filter(array_values($languages), function($l) {
return !empty($l);
});
} else {
$languages = [];
}
My error :-
Drupal\Core\File\Exception\FileWriteException: Temporary file 'temporary://fil29E3.tmp' could not be created. in Drupal\Core\File\FileSystem->saveData() (line 521 of core\lib\Drupal\Core\File\FileSystem.php).
My solution :-
1. Created a "temporary" folder in \sites\default\files.
2. Attached the path in settings.php $settings['file_temp_path'] = 'sites/default/files/temporary';