public function widget($args, $instance)
    {
        $this->parent_page_id = View_Utils::get_top_level_parent_id();

        // We are on a 404 or search route.
        if ($this->parent_page_id === null) {
            return;
        }

        $this->args = wp_parse_args(
            $instance,
            /**
             * Edit the default Related_Pages default arguments.
             *
             * @since  1.0.0
             *
             * @param  array $defaults {
             *     The default arguments.
             *
             *     @type string $container_start   Container start HTML. Default '<ul role="navigation">'.
             *     @type string $container_end     Container end HTML. Default '</ul>'.
             *     @type string $li_class          Classes to be applied to all <li> tags. Default ''.
             *     @type string $li_active_class   Classes to be applied to the active <li> tag. Default ''.
             *     @type string $link_class        Classes to be applied to all <a> tags. Default ''.
             *     @type string $link_active_class Classes to be applied to the active <a> tag. Default 'active'.
             *     @type string $before_link       Additional content before each <a> tag. Default ''.
             *     @type string $after_link        Additional content after each <a> tag. Default ''.
             *     @type string $before_text       Additional content before each <a> tag's content. Default ''.
             *     @type string $after_text        Additional content after each <a> tag's content. Default ''.
             *     @type bool   $show_parent       Whether to show the top level page in the output. Default true.
             * }
             * @return array
             */
            apply_filters('snap_related_pages_widget_defaults', $this->get_defaults())
        );

        // Populate $pages array.
        $this->get_pages();

        if (\count($this->pages) > 0) {
            $title = apply_filters('widget_title', $instance['title']);
     
            echo $args['before_widget'];

            if (! empty($title)) {
                echo $args['before_title'] . $title . $args['after_title'];
            }
             
            $this->render();

            echo $args['after_widget'];
        }
    }