/** * @param string $hook * * @return void */ public function load_script($hook) { if ('nav-menus.php' !== $hook) { return; } $this->asset_manager->add_script_data('multilingualpress-admin', 'mlpNavMenusSettings', ['action' => $this->handle, 'metaBoxId' => $this->handle, 'nonce' => (string) $this->nonce, 'nonceName' => $this->nonce->action()]); }
/** * Returns the HTML string for the hidden nonce field according to the given nonce object. * * @since 3.0.0 * * @param Nonce $nonce Nonce object. * @param bool $with_referer Optional. Render a referer field as well? Defaults to true. * * @return string The HTML string for the hidden nonce field according to the given nonce object. */ function nonce_field(Nonce $nonce, $with_referer = true) { return sprintf('<input type="hidden" name="%s" value="%s">%s', esc_attr($nonce->action()), esc_attr((string) $nonce), $with_referer ? wp_referer_field(false) : ''); }