I found some issues in the code of \Drupal\entity_reference_layout\Plugin\Field\FieldWidget\EntityReferenceLayoutWidget that should be fixable easily.

  /**
   * Layouts available to this widget.
   *
   * @var array
   */
  protected $availableLayouts;

This is never used and could be removed.

   * @param Drupal\Core\Render\Renderer $renderer
   *   Core renderer service.
   * @param Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
   *   Core entity type manager service.

The namespaces of this comments should be prefixed with a "\" to make them absolute (like the comments below).

    $this->entityTypeBundleInfo = $entity_type_bundle_info;
    // <snip>
    $this->currentUser = $current_user;

Both fields are declared dynamically - they should be declared in the class before they are accessed.

CommentFileSizeAuthor
#2 3087793_erl_code-improvements-2.patch1.69 KBdermario

Comments

dermario created an issue. See original summary.

dermario’s picture

Status: Active » Needs review
StatusFileSize
new1.69 KB

Here is my patch, addressing the issues in the ticket description.

justin2pin’s picture

Status: Needs review » Fixed

Applied and pushed to dev. Thanks @dermario!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.