function LocaleTranslatableProject::createFromArray

Same name and namespace in other branches
  1. main core/modules/locale/src/LocaleTranslatableProject.php \Drupal\locale\LocaleTranslatableProject::createFromArray()

Creates a new instance from an array.

Parameters

array{name: string, type: string, core: string, version: string, server_pattern?: string|null, info?: array, langcode: string, status?: bool, weight?: int} $data: The array to create the instance from.

Return value

static

1 call to LocaleTranslatableProject::createFromArray()
LocaleProjectRepository::getAll in core/modules/locale/src/LocaleProjectRepository.php
Returns all the project records.

File

core/modules/locale/src/LocaleTranslatableProject.php, line 133

Class

LocaleTranslatableProject
Translatable project for interface translation.

Namespace

Drupal\locale

Code

public static function createFromArray(array $data) : static {
  $status = $data['status'] ?? $data['project_status'] ?? FALSE;
  return new static($data['name'], $data['type'] ?? $data['project_type'], $data['core'], $data['version'], $data['server_pattern'] ?? \Drupal::TRANSLATION_DEFAULT_SERVER_PATTERN, $data['info'] ?? [], $data['langcode'] ?? NULL, $data['weight'] ?? 0, (bool) $status);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.