Valid URL from Link field into a Twig template
{# it will work either external or internal link #}
{{ node.field_image_link.get(0).getUrl().toString() }}
{# it will work either external or internal link #}
{{ node.field_image_link.get(0).getUrl().toString() }}
There are different ways to configure your local environment. Then you should use the option is more suitable for you, of course.
There are moments when you need to update several entities at once reason why you need to avoid a timeout.
drush sql-query "DELETE FROM key_value WHERE collection='system.schema' AND name='module_name';"
/** @var array $countries */
$countries = \Drupal::service('country_manager')
->getList();
// Transform TranslatableMarkup object into a string.
array_walk($countries, function (&$translation) {
/** @var Drupal\Core\StringTranslation\TranslatableMarkup $translation */
$translation = $translation->render();
});
var_dump($countries);
Drupal 8 ships with a service to easily retrieve all countries by code. Be sure to use dependency injection.
drush ev "\Drupal::configFactory()->getEditable('configuration.name')->delete();"
drush sqlq "DELETE FROM cache_config"
drush sqlq "DELETE FROM config WHERE name = 'field.storage.<module_name>.<field_machine_name>' OR data LIKE '%field.storage.<module_name>.<field_machine_name>%'"
drush sqlq "DELETE FROM config_snapshot WHERE name = 'field.storage.<module_name>.<field_machine_name>' OR data LIKE '%field.storage.<module_name>.<field_machine_name>%'"
On my case It was happening with "taxonomy_term" module and field named "field_location".
/* @var \Drupal\file\FileInterface[] $files */
$files = \Drupal::entityTypeManager()
->getStorage('file')
->loadByProperties(['uri' => $uri]);
Script: