You are here

public function FeedsEntityProcessorPropertyEntity::getFormField in Feeds entity processor 7

Implements FeedsEntityProcessorPropertyInterface::getFormField().

Overrides FeedsEntityProcessorPropertyDefault::getFormField

File

src/Property/FeedsEntityProcessorPropertyEntity.php, line 16
Contains FeedsEntityProcessorPropertyEntity.

Class

FeedsEntityProcessorPropertyEntity
Handler for entity property.

Code

public function getFormField(array &$form, array &$form_state, $default) {
  $property_info = $this
    ->getPropertyInfo();
  $field = array(
    '#type' => 'fieldset',
    '#title' => check_plain($property_info['label']),
    '#description' => isset($property_info['description']) ? check_plain($property_info['description']) : '',
    '#required' => !empty($property_info['required']),
    '#tree' => TRUE,
  );
  $field['entity_type'] = array(
    '#title' => t('Entity type'),
    '#type' => 'select',
    '#options' => array(
      '' => t('- Select -'),
    ) + $this
      ->getEntityTypeOptions(),
    '#default_value' => isset($default['entity_type']) ? $default['entity_type'] : NULL,
    '#required' => !empty($property_info['required']),
  );
  $field['entity_id'] = array(
    '#title' => t('Entity ID'),
    '#type' => 'textfield',
    '#default_value' => isset($default['entity_id']) ? $default['entity_id'] : NULL,
    '#required' => !empty($property_info['required']),
  );
  return $field;
}