- 🇦🇺Australia mstrelan
This has moved to
\Drupal\media\Install\Requirements\MediaRequirements::getRequirements
. It's also not in system.module so I'm updating the component.I think now that this is in a much more isolated function we can use early returns for clarity. Something like this:
public static function getRequirements(): array { $requirements = []; $destination = 'public://media-icons/generic'; \Drupal::service('file_system')->prepareDirectory($destination, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS); $is_directory = is_dir($destination); $is_writable = is_writable($destination); if ($is_directory && $is_writable) { return $requirements; } $t_args = ['%directory' => $destination]; $error = !$is_directory ? $this->t('The directory %directory does not exist.', $t_args) : $this->t('The directory %directory is not writable.', $t_args); // The rest of the inline template / description bits here. }