检查wordpress小部件中的isset值

How can I check isset or empty value to display or hide a tag This code does not work

<?php if ($this->get_field_name( 'name1')){ ?>
                                <li><a href="<?php echo $link1; ?>" target="_blank"><?php echo $name1; ?></a></li>
                                <?php }

this is label for widget

<p>
                <label for="<?php echo $this->get_field_id( 'name1' ); ?>"><?php _e( 'عنوان تبلیغ متنی اول' ); ?></label>
                <input class="widefat" id="<?php echo $this->get_field_id( 'name1' ); ?>" name="<?php echo $this->get_field_name( 'name1' ); ?>" type="text" value="<?php echo esc_attr( $name1 ); ?>" />
            </p>

ok i found out

<?php if (esc_attr( $name1 )){ ?>
                                <li><a href="<?php echo $link1; ?>" target="_blank"><?php echo $name1; ?></a></li>