Skip to content

GitRepositoryWidget

A text field for a repository on a set host, and optionally a set owner.

Editors type owner/name, or just the name when the owner is set. A full repository URL on another host is accepted too.


  • Full name: \Drupal\git_field\Plugin\Field\FieldWidget\GitRepositoryWidget
  • Parent class: WidgetBase

Properties

api

The Git API service.

protected \Drupal\git_host\GitApi $api

Methods

create

{@inheritdoc}

public static create(\Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, mixed $plugin_id, mixed $plugin_definition): static
  • This method is static. Parameters:
Parameter Type Description
$container \Symfony\Component\DependencyInjection\ContainerInterface
$configuration array
$plugin_id mixed
$plugin_definition mixed

defaultSettings

{@inheritdoc}

public static defaultSettings(): array
  • This method is static.

settingsForm

{@inheritdoc}

public settingsForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state): array

Parameters:

Parameter Type Description
$form array
$form_state \Drupal\Core\Form\FormStateInterface

settingsSummary

{@inheritdoc}

public settingsSummary(): array

getPrefix

Gets the URL prefix that short values are added to.

protected getPrefix(): string

Return Value:

The prefix, such as https://github.com/ or https://github.com/owner/.


formElement

{@inheritdoc}

public formElement(\Drupal\Core\Field\FieldItemListInterface $items, mixed $delta, array $element, array& $form, \Drupal\Core\Form\FormStateInterface $form_state): array

Parameters:

Parameter Type Description
$items \Drupal\Core\Field\FieldItemListInterface
$delta mixed
$element array
$form array
$form_state \Drupal\Core\Form\FormStateInterface

massageFormValues

{@inheritdoc}

public massageFormValues(array $values, array $form, \Drupal\Core\Form\FormStateInterface $form_state): array

Parameters:

Parameter Type Description
$values array
$form array
$form_state \Drupal\Core\Form\FormStateInterface