You are here

public function MergeableEntityReferenceHandler::getHandlerSettings in CMS Content Sync 2.1.x

Same name and namespace in other branches
  1. 8 src/Plugin/cms_content_sync/field_handler/MergeableEntityReferenceHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler\MergeableEntityReferenceHandler::getHandlerSettings()
  2. 2.0.x src/Plugin/cms_content_sync/field_handler/MergeableEntityReferenceHandler.php \Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler\MergeableEntityReferenceHandler::getHandlerSettings()

Get the handler settings.

Return the actual form elements for any additional settings for this handler.

Parameters

array $current_values: The current values that the user set, if any

string $type:: One of 'pull', 'push', 'both'

Return value

array

Overrides EntityReferenceHandlerBase::getHandlerSettings

File

src/Plugin/cms_content_sync/field_handler/MergeableEntityReferenceHandler.php, line 33

Class

MergeableEntityReferenceHandler
Providing a minimalistic implementation for any field type.

Namespace

Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler

Code

public function getHandlerSettings($current_values, $type = 'both') {
  $options = [];
  if ($this->fieldDefinition
    ->getFieldStorageDefinition()
    ->isMultiple() && 'push' !== $type) {
    $options['merge_local_changes'] = [
      '#type' => 'checkbox',
      '#title' => 'Merge local changes',
      '#default_value' => isset($current_values['merge_local_changes']) ? $current_values['merge_local_changes'] : false,
    ];
  }
  return array_merge(parent::getHandlerSettings($current_values, $type), $options);
}