Loading src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php +21 −0 Changes for src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Drupal\project_browser\Plugin\ProjectBrowserSource; use Composer\Semver\Semver; use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\Html; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Database\Connection; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; Loading Loading @@ -424,6 +425,7 @@ class MockDrupalDotOrg extends ProjectBrowserSourceBase implements ContainerFact $project['project_usage_total'] = 0; } $project['body'] = $this->relativeToAbsoluteUrls($project['body'], 'https://www.drupal.org'); $project['flag_project_star_user_count'] = 0; $project['is_covered'] = $this->projectIsCovered($project); $project['is_active'] = $this->projectIsActive($project); Loading Loading @@ -858,4 +860,23 @@ class MockDrupalDotOrg extends ProjectBrowserSourceBase implements ContainerFact return $warnings; } /** * Convert relative URLs found in the body to absolute URLs. * * @param array $body * Body array field containing summary and value properties. * @param string $base_url * Base URL to prepend to relative links. * * @return array * Body array with relative URLs converted to absolute ones. */ protected function relativeToAbsoluteUrls(array $body, string $base_url) { if (empty($body['value'])) { $body['value'] = $body['summary'] ?? ''; } $body['value'] = Html::transformRootRelativeUrlsToAbsolute($body['value'], $base_url); return $body; } } Loading
src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php +21 −0 Changes for src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php: 21 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Drupal\project_browser\Plugin\ProjectBrowserSource; use Composer\Semver\Semver; use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\Html; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Database\Connection; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; Loading Loading @@ -424,6 +425,7 @@ class MockDrupalDotOrg extends ProjectBrowserSourceBase implements ContainerFact $project['project_usage_total'] = 0; } $project['body'] = $this->relativeToAbsoluteUrls($project['body'], 'https://www.drupal.org'); $project['flag_project_star_user_count'] = 0; $project['is_covered'] = $this->projectIsCovered($project); $project['is_active'] = $this->projectIsActive($project); Loading Loading @@ -858,4 +860,23 @@ class MockDrupalDotOrg extends ProjectBrowserSourceBase implements ContainerFact return $warnings; } /** * Convert relative URLs found in the body to absolute URLs. * * @param array $body * Body array field containing summary and value properties. * @param string $base_url * Base URL to prepend to relative links. * * @return array * Body array with relative URLs converted to absolute ones. */ protected function relativeToAbsoluteUrls(array $body, string $base_url) { if (empty($body['value'])) { $body['value'] = $body['summary'] ?? ''; } $body['value'] = Html::transformRootRelativeUrlsToAbsolute($body['value'], $base_url); return $body; } }