Problem/Motivation

eprecated function: Creation of dynamic property Drupal\block_field\Plugin\Field\FieldFormatter\BlockFieldLabelFormatter::$currentUser is deprecated in Drupal\block_field\Plugin\Field\FieldFormatter\BlockFieldLabelFormatter->__construct() (line 45 of modules/contrib/block_field/src/Plugin/Field/FieldFormatter/BlockFieldLabelFormatter.php).
Drupal\block_field\Plugin\Field\FieldFormatter\BlockFieldLabelFormatter->__construct('block_field_label', 

Steps to reproduce

Use the block field label formatter for viewing the block and press save

Proposed resolution

Add the property to the class.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

yobottehg created an issue. See original summary.

chetan 11 made their first commit to this issue’s fork.

chetan 11’s picture

Status: Active » Needs review

Hi
I have fixed the error on my local setup, please check the raised MR for the solution.
Thanks.

yobottehg’s picture

Status: Needs review » Needs work

Fix is good but the variable is on the wrong place as it moves the doc block away from the place where it belongs.

Variable could also use some documentation.

chetan 11’s picture

Status: Needs work » Needs review

Hi,
I have updated the code with some fixes, please check the raised MR once.

yobottehg’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

daniel_j made their first commit to this issue’s fork.

rossb89’s picture

Looks like this ticket and #3371085: Fix deprecation notices are the same issue, we should close one of them and aim to get one merged in.

anybody’s picture

Priority: Normal » Major
Issue tags: +PHP 8.2

Closing #3371085: Fix deprecation notices as duplicate in favor of this.
Please credit @Grevil for the fix over there.

Could we please get this merged, now that PHP 8.3 is official and PHP 8.1 has no more active support?
https://www.php.net/supported-versions.php

visios’s picture

Please merge, thanks @Grevil.

handkerchief’s picture

+1 please merge, thank you all.

handkerchief’s picture

Because it is not yet merged, a patch may still be needed for many, which is integrated with updates, here it is.

anybody’s picture

@handkerchief perhaps contact a maintainer to merge this?

Berdir made their first commit to this issue’s fork.

  • Berdir committed cf54292a on 8.x-1.x authored by chetan 11
    Issue #3403040: PHP 8.2 deprecation warning when using block label...
berdir’s picture

Status: Reviewed & tested by the community » Fixed

Merged.

Status: Fixed » Closed (fixed)

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

anybody’s picture

@Berdir could you maybe tag a new release? The notices still appear and PHP 8.2 is used frequently :)

anybody’s picture

PS: I think @Grevil should be credited here based on #3371085: Fix deprecation notices, which I closed in favor of this one.