Skip to content

GitRepository

Stores a Git repository as its URL, such as https://github.com/owner/name.


  • Full name: \Drupal\git_field\Plugin\Field\FieldType\GitRepository
  • Parent class: StringItem

Constants

Constant Visibility Type Value
DEFAULT_HOST public 'github.com'

Methods

parse

Splits a repository URL, or owner/name, into its host and path.

public static parse(string $value): array|null
  • This method is static. Parameters:
Parameter Type Description
$value string
A URL such as https://github.com/owner/name, or owner/name for a
repository on github.com.

Return Value:

The lowercase 'host' and the 'repository' path, such as owner/name, or NULL if the value isn't a repository.


getHost

Gets the repository's host.

public getHost(): string|null

Return Value:

The host, such as github.com, or NULL if the value isn't valid.


getRepository

Gets the repository's path on its host.

public getRepository(): string|null

Return Value:

The path, such as owner/name, or NULL if the value isn't valid.


preSave

{@inheritdoc}

public preSave(): mixed

getConstraints

{@inheritdoc}

public getConstraints(): array