Inpsyde\MultilingualPress\Relations\Post\RelationshipControlView::localize_script PHP Method

localize_script() private method

Makes the relationship control settings available for JavaScript.
private localize_script ( ) : void
return void
    private function localize_script()
    {
        if (self::$is_script_localized) {
            return;
        }
        $this->asset_manager->add_script_data('multilingualpress-admin', 'mlpRelationshipControlSettings', ['actionConnectExisting' => RelationshipController::ACTION_CONNECT_EXISTING, 'actionConnectNew' => RelationshipController::ACTION_CONNECT_NEW, 'actionDisconnect' => RelationshipController::ACTION_DISCONNECT, 'l10n' => ['noPostSelected' => __('Please select a post.', 'multilingual-press'), 'unsavedRelationships' => __('You have unsaved changes in your post relationships. The changes you made will be lost if you navigate away from this page.', 'multilingual-press')]]);
        /**
         * Filters the minimum number of characters required to fire the live search.
         *
         * @param int $threshold Minimum number of characters required to fire the live search.
         */
        $threshold = (int) apply_filters('multilingualpress.relationship_control_search_threshold', 3);
        $this->asset_manager->add_script_data('multilingualpress-admin', 'mlpLiveSearchSettings', ['action' => SearchController::ACTION, 'argName' => Search::ARG_NAME, 'threshold' => max(1, $threshold)]);
        self::$is_script_localized = true;
    }