wp/wp-admin/includes/class-wp-links-list-table.php
changeset 19 3d72ae0968f4
parent 18 be944660c56a
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
   164 
   164 
   165 	/**
   165 	/**
   166 	 * Handles the checkbox column output.
   166 	 * Handles the checkbox column output.
   167 	 *
   167 	 *
   168 	 * @since 4.3.0
   168 	 * @since 4.3.0
   169 	 *
   169 	 * @since 5.9.0 Renamed `$link` to `$item` to match parent class for PHP 8 named parameter support.
   170 	 * @param object $link The current link object.
   170 	 *
   171 	 */
   171 	 * @param object $item The current link object.
   172 	public function column_cb( $link ) {
   172 	 */
       
   173 	public function column_cb( $item ) {
       
   174 		// Restores the more descriptive, specific name for use within this method.
       
   175 		$link = $item;
       
   176 
   173 		?>
   177 		?>
   174 		<label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>">
   178 		<label class="screen-reader-text" for="cb-select-<?php echo $link->link_id; ?>">
   175 			<?php
   179 			<?php
   176 			/* translators: %s: Link name. */
   180 			/* translators: %s: Link name. */
   177 			printf( __( 'Select %s' ), $link->link_name );
   181 			printf( __( 'Select %s' ), $link->link_name );
   277 
   281 
   278 	/**
   282 	/**
   279 	 * Handles the default column output.
   283 	 * Handles the default column output.
   280 	 *
   284 	 *
   281 	 * @since 4.3.0
   285 	 * @since 4.3.0
   282 	 *
   286 	 * @since 5.9.0 Renamed `$link` to `$item` to match parent class for PHP 8 named parameter support.
   283 	 * @param object $link        Link object.
   287 	 *
       
   288 	 * @param object $item        Link object.
   284 	 * @param string $column_name Current column name.
   289 	 * @param string $column_name Current column name.
   285 	 */
   290 	 */
   286 	public function column_default( $link, $column_name ) {
   291 	public function column_default( $item, $column_name ) {
   287 		/**
   292 		/**
   288 		 * Fires for each registered custom link column.
   293 		 * Fires for each registered custom link column.
   289 		 *
   294 		 *
   290 		 * @since 2.1.0
   295 		 * @since 2.1.0
   291 		 *
   296 		 *
   292 		 * @param string $column_name Name of the custom column.
   297 		 * @param string $column_name Name of the custom column.
   293 		 * @param int    $link_id     Link ID.
   298 		 * @param int    $link_id     Link ID.
   294 		 */
   299 		 */
   295 		do_action( 'manage_link_custom_column', $column_name, $link->link_id );
   300 		do_action( 'manage_link_custom_column', $column_name, $item->link_id );
   296 	}
   301 	}
   297 
   302 
   298 	public function display_rows() {
   303 	public function display_rows() {
   299 		foreach ( $this->items as $link ) {
   304 		foreach ( $this->items as $link ) {
   300 			$link                = sanitize_bookmark( $link );
   305 			$link                = sanitize_bookmark( $link );
   310 
   315 
   311 	/**
   316 	/**
   312 	 * Generates and displays row action links.
   317 	 * Generates and displays row action links.
   313 	 *
   318 	 *
   314 	 * @since 4.3.0
   319 	 * @since 4.3.0
   315 	 *
   320 	 * @since 5.9.0 Renamed `$link` to `$item` to match parent class for PHP 8 named parameter support.
   316 	 * @param object $link        Link being acted upon.
   321 	 *
       
   322 	 * @param object $item        Link being acted upon.
   317 	 * @param string $column_name Current column name.
   323 	 * @param string $column_name Current column name.
   318 	 * @param string $primary     Primary column name.
   324 	 * @param string $primary     Primary column name.
   319 	 * @return string Row actions output for links, or an empty string
   325 	 * @return string Row actions output for links, or an empty string
   320 	 *                if the current column is not the primary column.
   326 	 *                if the current column is not the primary column.
   321 	 */
   327 	 */
   322 	protected function handle_row_actions( $link, $column_name, $primary ) {
   328 	protected function handle_row_actions( $item, $column_name, $primary ) {
   323 		if ( $primary !== $column_name ) {
   329 		if ( $primary !== $column_name ) {
   324 			return '';
   330 			return '';
   325 		}
   331 		}
   326 
   332 
       
   333 		// Restores the more descriptive, specific name for use within this method.
       
   334 		$link      = $item;
   327 		$edit_link = get_edit_bookmark_link( $link );
   335 		$edit_link = get_edit_bookmark_link( $link );
   328 
   336 
   329 		$actions           = array();
   337 		$actions           = array();
   330 		$actions['edit']   = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
   338 		$actions['edit']   = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
   331 		$actions['delete'] = sprintf(
   339 		$actions['delete'] = sprintf(