Commit f0e706c8 authored by Fran Garcia-Linares's avatar Fran Garcia-Linares Committed by Tim Plunkett
Browse files

Issue #3301577 by fjgarlin, bnjmnm: Have a separate field/property for logo

parent 6b4a0d1d
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -184,15 +184,14 @@ class RandomDataPlugin extends ProjectBrowserSourceBase implements ContainerFact
          'summary' => $this->randomGenerator->paragraphs(1),
          'value' => $this->randomGenerator->paragraphs(5),
        ],
        'field_project_images' => [
          [
        'logo' => [
          'file' => [
            'uri' => ($i % 3) ? $good_image : $broken_image,
            'resource' => 'image',
          ],
          'alt' => $machine_name . ' logo',
        ],
        ],
        'field_project_images' => [],
        'field_maintenance_status' => $maintenance_values[$maintenance],
        'field_module_categories' => [$categories[$category]],
        'field_security_advisory_coverage' => $security_values[$security]['id'],
@@ -204,7 +203,7 @@ class RandomDataPlugin extends ProjectBrowserSourceBase implements ContainerFact
        'flag_project_star_user_count' => rand(0, 100),
      ];

      // The first project will have a single image, the rest will have 3.
      // The first project has only a logo, all others have 2 additional images.
      if ($i !== 0) {
        $project['field_project_images'][] = [
          'file' => [
+2 −0
Original line number Diff line number Diff line
@@ -425,6 +425,8 @@ class MockDrupalDotOrg extends ProjectBrowserSourceBase implements ContainerFact
          $project['project_usage_total'] = 0;
        }

        $logo = empty($project['field_project_images']) ? [] : array_shift($project['field_project_images']);
        $project['logo'] = $logo;
        $project['body'] = $this->relativeToAbsoluteUrls($project['body'], 'https://www.drupal.org');
        $project['flag_project_star_user_count'] = 0;
        $project['is_covered'] = $this->projectIsCovered($project);
+19 −0
Original line number Diff line number Diff line
@@ -10,6 +10,13 @@ use Drupal\Component\Utility\Unicode;
 */
class Project implements \JsonSerializable {

  /**
   * Logo of the project.
   *
   * @var array
   */
  private array $logo;

  /**
   * Whether the project is compatible with the current version of Drupal.
   *
@@ -185,6 +192,7 @@ class Project implements \JsonSerializable {
      $this->setId($project['nid']);
      $this->setSummary((array) $project['body']);
      $this->setImages($project['field_project_images']);
      $this->setLogo($project['logo']);
      $this->setMaintenanceStatus($project['field_maintenance_status']);
      $this->setMachineName($project['field_project_machine_name']);
      $this->setModuleCategories($project['field_module_categories']);
@@ -307,6 +315,16 @@ class Project implements \JsonSerializable {
    $this->machineName = $machine_name;
  }

  /**
   * Set the project logo.
   *
   * @param array $logo
   *   Logo in array format.
   */
  public function setLogo(array $logo) {
    $this->logo = $logo;
  }

  /**
   * Set the composer namespace.
   *
@@ -456,6 +474,7 @@ class Project implements \JsonSerializable {
      'field_project_machine_name' => $this->machineName,
      'field_maintenance_status' => $this->maintenanceStatus,
      'field_project_images' => $this->images,
      'logo' => $this->logo,
      'body' => $this->body,
      'id' => $this->id,
      'title' => $this->title,
+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

+0 −0

File changed.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

Loading