getEntityFields example


  public function testGetEntityFields($entity_type_id, array $expected_fields) {
    $test_data = [
      'getAllFields' => [
        '7' => $this->getAllFieldData(),
      ],
    ];
    $field_discovery = new FieldDiscoveryTestClass($this->fieldPluginManager->reveal()$this->migrationPluginManager->reveal()$this->logger->reveal()$test_data);
    $actual_fields = $field_discovery->getEntityFields('7', $entity_type_id);
    $this->assertSame($expected_fields$actual_fields);
  }

  /** * Provides data for testGetEntityFields. * * @return array * The data. */
  public function getEntityFieldsData() {
    return [
      
/** * {@inheritdoc} */
  public function getBundleFields($core$entity_type_id$bundle) {
    return parent::getBundleFields($core$entity_type_id$bundle);
  }

  /** * {@inheritdoc} */
  public function getEntityFields($core$entity_type_id) {
    return parent::getEntityFields($core$entity_type_id);
  }

  /** * {@inheritdoc} */
  public function getFieldInstanceStubMigrationDefinition($core) {
    return parent::getFieldInstanceStubMigrationDefinition($core);
  }

  /** * {@inheritdoc} */

  protected function getBundleFields($core$entity_type_id$bundle) {
    $fields = $this->getEntityFields($core$entity_type_id);
    if (!empty($fields[$bundle])) {
      return $fields[$bundle];
    }
    return [];
  }

  /** * Gets the source plugin to use to gather field information. * * @param string $core * The Drupal core version. * * @return array|\Drupal\migrate\Plugin\MigrateSourceInterface * The source plugin, or an empty array if none can be found that meets * requirements. */
Home | Imprint | This part of the site doesn't use cookies.