You are here

public function ProfileViewsRelationship::buildOptionsForm in Profile 8

Provide a form to edit options for this plugin.

Overrides RelationshipPluginBase::buildOptionsForm

File

src/Plugin/views/relationship/ProfileViewsRelationship.php, line 52

Class

ProfileViewsRelationship
Provides a views relationship to select profile content by a profile_type.

Namespace

Drupal\profile\Plugin\views\relationship

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $form['admin_label']['#description'] = $this
    ->t('The name of the selected profile type makes a good label.');
  $form['profile_type'] = [
    '#type' => 'radios',
    '#title' => $this
      ->t('Profile Type'),
    '#default_value' => $this->options['profile_type'],
    '#required' => TRUE,
  ];
  foreach (ProfileType::loadMultiple() as $profile_id => $profile_type) {
    $form['profile_type']['#options'][$profile_id] = $profile_type
      ->label();
  }
  $form['required']['#description'] .= '<div class="color-warning"><strong>' . $this
    ->t('You must require this relationship to use the Rendered Entity field type for this relationship') . '</strong></div>';
}