/**
     * Renders the relationship settings.
     *
     * @return void
     */
    private function render_relationships()
    {
        $sites = (array) get_site_option('inpsyde_multilingual', []);
        foreach (array_keys($sites) as $site_id) {
            $site_id = (int) $site_id;
            $id = 'related_blog_' . $site_id;
            switch_to_blog($site_id);
            $blog_name = get_bloginfo('name');
            restore_current_blog();
            ?>
			<p>
				<label for="<?php 
            echo esc_attr($id);
            ?>
">
					<input type="checkbox" name="related_blogs[]" value="<?php 
            echo esc_attr($site_id);
            ?>
"
						id="<?php 
            echo esc_attr($id);
            ?>
">
					<?php 
            echo esc_html($blog_name);
            ?>
					-
					<?php 
            echo esc_html(\Inpsyde\MultilingualPress\get_site_language($site_id, false));
            ?>
				</label>
			</p>
			<?php 
        }
    }
    /**
     * @param array $site_option
     * @return void
     */
    private function show_blog_relationships($site_option)
    {
        if (!is_array($site_option)) {
            return;
        }
        unset($site_option[$this->blog_id]);
        if (empty($site_option)) {
            return;
        }
        ?>
		<tr class="form-field">
			<th scope="row"><?php 
        esc_html_e('Relationships', 'multilingual-press');
        ?>
</th>
			<td>
				<?php 
        foreach ($site_option as $blog_id => $meta) {
            $blog_id = (int) $blog_id;
            // Get blog display name
            switch_to_blog($blog_id);
            $blog_name = get_bloginfo('Name');
            restore_current_blog();
            // Get current settings
            $related_blogs = $this->relations->get_related_site_ids($this->blog_id);
            $checked = checked(TRUE, in_array($blog_id, $related_blogs), FALSE);
            $id = 'related_blog_' . $blog_id;
            ?>
					<p>
						<label for="<?php 
            echo esc_attr($id);
            ?>
">
							<input id="<?php 
            echo esc_attr($id);
            ?>
" <?php 
            echo esc_attr($checked);
            ?>
								type="checkbox" name="related_blogs[]" value="<?php 
            echo esc_attr($blog_id);
            ?>
" />
							<?php 
            echo esc_html($blog_name);
            ?>
							-
							<?php 
            echo esc_html(\Inpsyde\MultilingualPress\get_site_language($blog_id, false));
            ?>
						</label>
					</p>
					<?php 
        }
        ?>
				<p class="description">
					<?php 
        esc_html_e('You can connect this site only to sites with an assigned language. Other sites will not show up here.', 'multilingual-press');
        ?>
				</p>
			</td>
		</tr>
		<?php 
    }
 /**
  * Registers columns for the list table on the Sites page in the Network Admin.
  *
  * @return void
  */
 private function register_sites_list_table_columns()
 {
     (new SitesListTableColumn('multilingualpress.relationships', __('Relationships', 'multilingual-press'), function ($id, $site_id) {
         switch_to_blog($site_id);
         $sites = \Inpsyde\MultilingualPress\get_available_language_names();
         restore_current_blog();
         unset($sites[$site_id]);
         return $sites ? '<div class="mlp_interlinked_blogs">' . join('<br>', array_map('esc_html', $sites)) . '</div>' : __('none', 'multilingual-press');
     }))->register();
     (new SitesListTableColumn('multilingualpress.site_language', __('Site Language', 'multilingual-press'), function ($id, $site_id) {
         $language = \Inpsyde\MultilingualPress\get_site_language($site_id);
         return '' === $language ? __('none', 'multilingual-press') : sprintf('<div class="mlp_site_language">%s</div>', esc_html(\Inpsyde\MultilingualPress\get_language_by_http_name(str_replace('_', '-', $language))));
     }))->register();
 }