Skip to content

Commit

Permalink
MDL-80676 core: Deprecate \action_menu_link::$instance
Browse files Browse the repository at this point in the history
\action_menu_link::$instance is only being used to provide unique IDs
for the <span> tag that contains the text within the action menu link's
<a> tag. This <span> tag's ID is then being used for the action menu
link's <a> tag's aria-labelledby attribute which is totally unnecessary
given that the <span> tag is already within the action menu link and
already serves as the default label for the <a> tag.
  • Loading branch information
junpataleta committed Jan 19, 2024
1 parent 1764718 commit beadadd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/outputcomponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -4954,6 +4954,8 @@ class action_menu_link extends action_link implements renderable {

/**
* The number of instances of this action menu link (and its subclasses).
*
* @deprecated since Moodle 4.4.
* @var int
*/
protected static $instance = 1;
Expand Down Expand Up @@ -4982,7 +4984,6 @@ public function __construct(moodle_url $url, ?pix_icon $icon, $text, $primary =
*/
public function export_for_template(renderer_base $output) {
$data = parent::export_for_template($output);
$data->instance = self::$instance++;

// Ignore what the parent did with the attributes, except for ID and class.
$data->attributes = [];
Expand Down
1 change: 1 addition & 0 deletions lib/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ information provided here is intended especially for developers.
- `\core\deprecation::is_deprecated(example::class);`
- `\core\deprecation::emit_deprecation_if_present([self::class, 'some_method']);`
* Added missing deprecation for PARAM_CLEANFILE which was deprecated in Moodle 2.0.
* \action_menu_link::$instance has been deprecated as it is no longer used.

=== 4.3 ===

Expand Down

0 comments on commit beadadd

Please sign in to comment.