You are here

class PhoneNumberFieldHandler in CRM Core 8.3

Same name and namespace in other branches
  1. 8 modules/crm_core_match/src/Plugin/crm_core_match/field/PhoneNumberFieldHandler.php \Drupal\crm_core_match\Plugin\crm_core_match\field\PhoneNumberFieldHandler
  2. 8.2 modules/crm_core_match/src/Plugin/crm_core_match/field/PhoneNumberFieldHandler.php \Drupal\crm_core_match\Plugin\crm_core_match\field\PhoneNumberFieldHandler

Class for evaluating phone_number fields.

Hierarchy

Expanded class hierarchy of PhoneNumberFieldHandler

File

modules/crm_core_match/src/Plugin/crm_core_match/field/PhoneNumberFieldHandler.php, line 10

Namespace

Drupal\crm_core_match\Plugin\crm_core_match\field
View source
class PhoneNumberFieldHandler extends FieldHandlerBase {
  use StringTranslationTrait;

  /**
   * Render the field.
   *
   * @param array $field
   *   Field.
   * @param array $field_info
   *   Field info.
   * @param mixed $form
   *   Form.
   *
   * @see DefaultMatchingEngineFieldType::fieldRender()
   */
  public function fieldRender(array $field, array $field_info, &$form) {
    foreach ($field_info['columns'] as $item => $info) {
      $description = '';
      switch ($item) {
        case 'number':
          $description = $this
            ->t('Number');
          break;
        case 'country_codes':
          $description = $this
            ->t('Country code');
          break;
        case 'extension':
          $description = $this
            ->t('Extension');
          break;
      }
      $field_item['field_name'] = $field['field_name'];
      $field_item['label'] = $field['label'] . ': ' . $description;
      $field_item['bundle'] = $field['bundle'];
      $field_item['field_item'] = $item;

      // TODO: Missing parameter.
      $item = new SelectFieldHandler();
      $item
        ->fieldRender($field_item, $field_info, $form);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function getOperators($property = 'value') {
    return [
      'equals' => $this
        ->t('Equals'),
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FieldHandlerBase::$configuration protected property The settings. 1
FieldHandlerBase::$definition protected property The plugin definition.
FieldHandlerBase::$entityTypeManager protected property Entity type manager.
FieldHandlerBase::$field protected property The field.
FieldHandlerBase::$id protected property The plugin id.
FieldHandlerBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
FieldHandlerBase::getLabel public function Gets the property label. Overrides FieldHandlerInterface::getLabel
FieldHandlerBase::getOperator public function Gets the current selected operator. Overrides FieldHandlerInterface::getOperator
FieldHandlerBase::getOptions public function Gets the operator options. Overrides FieldHandlerInterface::getOptions
FieldHandlerBase::getPropertyNames public function Returns the names of the field's subproperties. Overrides FieldHandlerInterface::getPropertyNames 1
FieldHandlerBase::getScore public function Gets the score. Overrides FieldHandlerInterface::getScore
FieldHandlerBase::getStatus public function Gets the property status. Overrides FieldHandlerInterface::getStatus
FieldHandlerBase::getType public function Gets the field type. Overrides FieldHandlerInterface::getType
FieldHandlerBase::getWeight public function Gets the weight. Overrides FieldHandlerInterface::getWeight
FieldHandlerBase::match public function Executes the match query. Overrides FieldHandlerInterface::match 2
FieldHandlerBase::WEIGHT_DELTA constant The weight.
FieldHandlerBase::__construct public function Constructs an plugin instance.
PhoneNumberFieldHandler::fieldRender public function Render the field.
PhoneNumberFieldHandler::getOperators public function Gets the operators. Overrides FieldHandlerInterface::getOperators
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.