You are here

public function BlockFieldForm::getProperties in Display Suite 8.4

Same name and namespace in other branches
  1. 8.2 src/Form/BlockFieldForm.php \Drupal\ds\Form\BlockFieldForm::getProperties()
  2. 8.3 src/Form/BlockFieldForm.php \Drupal\ds\Form\BlockFieldForm::getProperties()

Returns the properties for the custom field.

Overrides FieldFormBase::getProperties

File

src/Form/BlockFieldForm.php, line 73

Class

BlockFieldForm
Configure block fields.

Namespace

Drupal\ds\Form

Code

public function getProperties(FormStateInterface $form_state) {
  $properties['block'] = $form_state
    ->getValue('block');

  // Preserve existing block config.
  $field_key = $form_state
    ->getValue('id');
  $field = $this
    ->config('ds.field.' . $field_key)
    ->get();
  if (isset($field['properties']) && $field['properties']['block'] == $properties['block']) {
    $properties = $field['properties'];
  }

  // Save configuration.
  $properties['use_block_title'] = $form_state
    ->getValue('use_block_title');
  $properties['add_block_wrappers'] = $form_state
    ->getValue('add_block_wrappers');
  return $properties;
}