You are here

public function DefaultMatchingEngine::buildRow in CRM Core 8.2

Same name and namespace in other branches
  1. 8.3 modules/crm_core_match/src/Plugin/crm_core_match/engine/DefaultMatchingEngine.php \Drupal\crm_core_match\Plugin\crm_core_match\engine\DefaultMatchingEngine::buildRow()
  2. 8 modules/crm_core_match/src/Plugin/crm_core_match/engine/DefaultMatchingEngine.php \Drupal\crm_core_match\Plugin\crm_core_match\engine\DefaultMatchingEngine::buildRow()

Builds a row for an rule in the rule listing.

Parameters

\Drupal\crm_core_match\Plugin\crm_core_match\field\FieldHandlerInterface $field: The match field of this rule.

string $name: The property name of this rule.

bool $disabled: Disables the form elements.

Return value

array A render array structure of fields for this rule.

1 call to DefaultMatchingEngine::buildRow()
DefaultMatchingEngine::buildConfigurationForm in modules/crm_core_match/src/Plugin/crm_core_match/engine/DefaultMatchingEngine.php
Form constructor.

File

modules/crm_core_match/src/Plugin/crm_core_match/engine/DefaultMatchingEngine.php, line 274

Class

DefaultMatchingEngine
DefaultMatchingEngine class.

Namespace

Drupal\crm_core_match\Plugin\crm_core_match\engine

Code

public function buildRow(FieldHandlerInterface $field, $name, $disabled) {
  $row = [];
  $row['#attributes']['class'][] = 'draggable';
  $row['#weight'] = $field
    ->getWeight($name);
  $row['status'] = [
    '#type' => 'checkbox',
    '#default_value' => $field
      ->getStatus($name),
    '#disabled' => $disabled,
  ];
  $row['label'] = [
    '#markup' => $field
      ->getLabel($name),
  ];
  $row['type'] = [
    '#markup' => $field
      ->getType(),
  ];
  $row['operator'] = [
    '#type' => 'select',
    '#default_value' => $field
      ->getOperator($name),
    '#empty_option' => !$disabled ? NULL : $this
      ->t('- Please Select -'),
    '#options' => $field
      ->getOperators($name),
    '#disabled' => $disabled,
  ];
  $row['options'] = [
    '#type' => 'textfield',
    '#maxlength' => 28,
    '#size' => 28,
    '#default_value' => $field
      ->getOptions($name),
    '#disabled' => $disabled,
  ];
  $row['score'] = [
    '#type' => 'textfield',
    '#maxlength' => 4,
    '#size' => 3,
    '#default_value' => $field
      ->getScore($name),
    '#disabled' => $disabled,
  ];
  $row['weight'] = [
    '#type' => 'weight',
    '#title' => $this
      ->t('Weight for @field', [
      '@field' => $field
        ->getLabel(),
    ]),
    '#title_display' => 'invisible',
    '#default_value' => $field
      ->getWeight($name),
    '#attributes' => [
      'class' => [
        'weight',
      ],
    ],
  ];
  return $row;
}