You are here

final class FieldUiController in CiviCRM Entity 8.3

Hierarchy

Expanded class hierarchy of FieldUiController

File

src/Controller/FieldUiController.php, line 11

Namespace

Drupal\civicrm_entity\Controller
View source
final class FieldUiController implements ContainerInjectionInterface {

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  private $entityTypeManager;

  /**
   * The entity type bundle info.
   *
   * @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface
   */
  private $entityTypeBundleInfo;
  public function __construct(EntityTypeManagerInterface $entity_type_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info) {
    $this->entityTypeManager = $entity_type_manager;
    $this->entityTypeBundleInfo = $entity_type_bundle_info;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new self($container
      ->get('entity_type.manager'), $container
      ->get('entity_type.bundle.info'));
  }

  /**
   * Shows the 'Manage fields' page for CiviCRM entities.
   *
   * @param string $entity_type_id
   *   The entity type.
   * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
   *   The current route match.
   *
   * @return array
   *   A render array as expected by
   *   \Drupal\Core\Render\RendererInterface::render().
   */
  public function fieldListing($entity_type_id) {
    $list_builder = $this->entityTypeManager
      ->getListBuilder('field_config');
    assert($list_builder instanceof FieldConfigListBuilder);
    $bundles = $this->entityTypeBundleInfo
      ->getBundleInfo($entity_type_id);

    // We replicate all field config across bundles, so take the first bundle
    // name.
    $bundle = key($bundles);

    // Field UI provides parameter overrides.
    return $list_builder
      ->render($entity_type_id, $bundle);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FieldUiController::$entityTypeBundleInfo private property The entity type bundle info.
FieldUiController::$entityTypeManager private property The entity type manager.
FieldUiController::create public static function Instantiates a new instance of this class. Overrides ContainerInjectionInterface::create
FieldUiController::fieldListing public function Shows the 'Manage fields' page for CiviCRM entities.
FieldUiController::__construct public function