getDefaultThumbnailUri example


  protected function loadThumbnail($thumbnail_uri = NULL) {
    $values = [
      'uri' => $thumbnail_uri ?: $this->getDefaultThumbnailUri(),
    ];

    $file_storage = $this->entityTypeManager()->getStorage('file');

    $existing = $file_storage->loadByProperties($values);
    if ($existing) {
      $file = reset($existing);
    }
    else {
      /** @var \Drupal\file\FileInterface $file */
      $file = $file_storage->create($values);
      
Home | Imprint | This part of the site doesn't use cookies.