public function ContributorSettings::buildForm in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_entity/src/Form/ContributorSettings.php \Drupal\bibcite_entity\Form\ContributorSettings::buildForm()
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- modules/bibcite_entity/ src/ Form/ ContributorSettings.php, line 31 
Class
- ContributorSettings
- Common contributor settings.
Namespace
Drupal\bibcite_entity\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('bibcite_entity.contributor.settings');
  $form = parent::buildForm($form, $form_state);
  $form['full_name_pattern'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Full name pattern'),
    '#description' => $this
      ->t('Describe how generate full name of contributor from name parts.'),
    '#default_value' => $config
      ->get('full_name_pattern'),
  ];
  $form['description'] = [
    '#type' => 'item',
    '#markup' => $this
      ->t("Available name parts:\n@tokens", [
      '@tokens' => implode(", ", array_map(function ($part) {
        return "@{$part}";
      }, Contributor::getNameParts())),
    ]),
  ];
  return $form;
}