MDL-81047 core: Rename standard_head_html_prepend hook
This commit updates the name of the standard_head_html_prepend hook to meet coding style agreed in MDL-79077.
This commit is contained in:
+5
-6
@@ -14,7 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_mobile\local\hooks\output;
|
||||
namespace tool_mobile\local\hook\output;
|
||||
|
||||
/**
|
||||
* Allows plugins to add any elements to the page <head> html tag
|
||||
@@ -23,14 +23,13 @@ namespace tool_mobile\local\hooks\output;
|
||||
* @copyright 2023 Marina Glancy
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class standard_head_html_prepend {
|
||||
|
||||
class before_standard_head_html_generation {
|
||||
/**
|
||||
* Callback to add head elements.
|
||||
*
|
||||
* @param \core\hook\output\standard_head_html_prepend $hook
|
||||
* @param \core\hook\output\before_standard_head_html_generation $hook
|
||||
*/
|
||||
public static function callback(\core\hook\output\standard_head_html_prepend $hook): void {
|
||||
public static function callback(\core\hook\output\before_standard_head_html_generation $hook): void {
|
||||
global $CFG, $PAGE;
|
||||
// Smart App Banners meta tag is only displayed if mobile services are enabled and configured.
|
||||
if (!empty($CFG->enablemobilewebservice)) {
|
||||
@@ -45,7 +44,7 @@ class standard_head_html_prepend {
|
||||
|
||||
if (!empty($mobilesettings->androidappid)) {
|
||||
$mobilemanifesturl = "$CFG->wwwroot/$CFG->admin/tool/mobile/mobile.webmanifest.php";
|
||||
$hook->add_html('<link rel="manifest" href="'.$mobilemanifesturl.'" />');
|
||||
$hook->add_html('<link rel="manifest" href="' . $mobilemanifesturl . '" />');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$callbacks = [
|
||||
[
|
||||
'hook' => core\hook\output\standard_head_html_prepend::class,
|
||||
'callback' => 'tool_mobile\local\hooks\output\standard_head_html_prepend::callback',
|
||||
'hook' => core\hook\output\before_standard_head_html_generation::class,
|
||||
'callback' => 'tool_mobile\local\hook\output\before_standard_head_html_generation::callback',
|
||||
'priority' => 0,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
$plugin->version = 2023100900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->version = 2024022600; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2023100400; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
|
||||
$plugin->dependencies = [
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ namespace core\hook\output;
|
||||
#[\core\attribute\tags('output')]
|
||||
#[\core\attribute\label('Allows plugins to add any elements to the page <head> html tag.')]
|
||||
#[\core\attribute\hook\replaces_callbacks('before_standard_html_head')]
|
||||
class standard_head_html_prepend {
|
||||
class before_standard_head_html_generation {
|
||||
/** @var string $output Stores results from callbacks */
|
||||
private $output = '';
|
||||
|
||||
@@ -698,15 +698,13 @@ class core_renderer extends renderer_base {
|
||||
$this->page->blocks->ensure_content_created($region, $this);
|
||||
}
|
||||
|
||||
$output = '';
|
||||
|
||||
// Give plugins an opportunity to add any head elements. The callback
|
||||
// must always return a string containing valid html head content.
|
||||
|
||||
$hook = new \core\hook\output\standard_head_html_prepend();
|
||||
$hook = new \core\hook\output\before_standard_head_html_generation();
|
||||
\core\hook\manager::get_instance()->dispatch($hook);
|
||||
$hook->process_legacy_callbacks();
|
||||
$output .= $hook->get_output();
|
||||
$output = $hook->get_output();
|
||||
|
||||
// Allow a url_rewrite plugin to setup any dynamic head content.
|
||||
if (isset($CFG->urlrewriteclass) && !isset($CFG->upgraderunning)) {
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ information provided here is intended especially for developers.
|
||||
- get_attempts_available(): Used to get the number of attempts available for the task.
|
||||
* There is a new DML method $DB->get_fieldset. For some reason, this did not exist even though get_fieldset_select etc. did.
|
||||
* The following callbacks have been migrated to hooks:
|
||||
- before_standard_html_head() -> core\hook\output\standard_head_html_prepend
|
||||
- before_standard_html_head() -> core\hook\output\before_standard_head_html_generation
|
||||
* Deprecated PARAM_ types with the exception of PARAM_CLEAN now emit a deprecation exception. These were all deprecated in Moodle 2.0.
|
||||
* A new \core\deprecated attribute can be used to more clearly describe deprecated methods.
|
||||
* A new \core\deprecation class can be used to inspect for deprecated attributes:
|
||||
|
||||
Reference in New Issue
Block a user