From 953a3794daa9a307cf2d3b35f6797e47644c8dd4 Mon Sep 17 00:00:00 2001 From: Amaia Anabitarte Date: Mon, 25 Nov 2024 13:04:12 +0100 Subject: [PATCH] MDL-83765 core_output: deprecated functions have been removed from action_menu class. --- .upgradenotes/MDL-83765-2024112512031796.yml | 7 +++ lib/classes/output/action_menu.php | 49 +++++--------------- 2 files changed, 19 insertions(+), 37 deletions(-) create mode 100644 .upgradenotes/MDL-83765-2024112512031796.yml diff --git a/.upgradenotes/MDL-83765-2024112512031796.yml b/.upgradenotes/MDL-83765-2024112512031796.yml new file mode 100644 index 0000000000000..26302f0b37c74 --- /dev/null +++ b/.upgradenotes/MDL-83765-2024112512031796.yml @@ -0,0 +1,7 @@ +issueNumber: MDL-83765 +notes: + core: + - message: >- + set_alignment(), set_constraint() and do_not_enhance() functions have + been fully removed from action_menu class. + type: removed diff --git a/lib/classes/output/action_menu.php b/lib/classes/output/action_menu.php index 261054f1f9665..38040171d1924 100644 --- a/lib/classes/output/action_menu.php +++ b/lib/classes/output/action_menu.php @@ -386,24 +386,11 @@ public function set_owner_selector($selector) { } /** - * Sets the alignment of the dialogue in relation to button used to toggle it. - * - * @deprecated since Moodle 4.0 - * - * @param int $dialogue One of action_menu::TL, action_menu::TR, action_menu::BL, action_menu::BR. - * @param int $button One of action_menu::TL, action_menu::TR, action_menu::BL, action_menu::BR. - */ - public function set_alignment($dialogue, $button) { - debugging('The method action_menu::set_alignment() is deprecated, use action_menu::set_menu_left()', DEBUG_DEVELOPER); - if (isset($this->attributessecondary['data-align'])) { - // We've already got one set, lets remove the old class so as to avoid troubles. - $class = $this->attributessecondary['class']; - $search = 'align-' . $this->attributessecondary['data-align']; - $this->attributessecondary['class'] = str_replace($search, '', $class); - } - $align = $this->get_align_string($dialogue) . '-' . $this->get_align_string($button); - $this->attributessecondary['data-align'] = $align; - $this->attributessecondary['class'] .= ' align-' . $align; + * @deprecated since Moodle 4.0, use action_menu::set_menu_left(). + */ + #[\core\attribute\deprecated('action_menu::set_menu_left', since: '4.0', mdl: 'MDL-72466', final: true)] + public function set_alignment(): void { + \core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]); } /** @@ -436,20 +423,11 @@ public function set_menu_left() { } /** - * Sets a constraint for the dialogue. - * - * The constraint is applied when the dialogue is shown and limits the display of the dialogue to within the - * element the constraint identifies. - * - * This is required whenever the action menu is displayed inside any CSS element with the .no-overflow class - * (flexible_table and any of it's child classes are a likely candidate). - * - * @deprecated since Moodle 4.3 - * @param string $ancestorselector A snippet of CSS used to identify the ancestor to contrain the dialogue to. + * @deprecated since Moodle 4.3, use set_boundary() method instead. */ - public function set_constraint($ancestorselector) { - debugging('The method set_constraint() is deprecated. Please use the set_boundary() method instead.', DEBUG_DEVELOPER); - $this->set_boundary('window'); + #[\core\attribute\deprecated('action_menu::set_boundary', since: '4.3', mdl: 'MDL-77375', final: true)] + public function set_constraint(): void { + \core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]); } /** @@ -469,14 +447,11 @@ public function set_boundary(string $boundary) { } /** - * If you call this method the action menu will be displayed but will not be enhanced. - * - * By not displaying the menu enhanced all items will be displayed in a single row. - * - * @deprecated since Moodle 3.2 + * @deprecated since Moodle 3.2, use a list of action_icon instead. */ + #[\core\attribute\deprecated('Use a list of action_icons instead', since: '4.3', mdl: 'MDL-55904', final: true)] public function do_not_enhance() { - debugging('The method action_menu::do_not_enhance() is deprecated, use a list of action_icon instead.', DEBUG_DEVELOPER); + \core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]); } /**