link_cat_row

Definition:
function link_cat_row( $category, $name_override = false ) {}

Parameters

  • unknown_type $category
  • unknown_type $name_override

Defined filters

  • link_cat_row_actions
    apply_filters('link_cat_row_actions', $actions, $category)
  • editable_slug
    apply_filters('editable_slug', $qe_data->slug)
  • editable_slug
    apply_filters('editable_slug', $category->slug)
  • manage_link_categories_custom_column
    apply_filters('manage_link_categories_custom_column', '', $column_name, $category->term_id)

Source code

function link_cat_row( $category, $name_override = false ) {

	static $row_class = '';



	if ( !$category = get_term( $category, 'link_category', OBJECT, 'display' ) )

		return false;

	if ( is_wp_error( $category ) )

		return $category;



	$default_cat_id = (int) get_option( 'default_link_category' );

	$name = ( $name_override ? $name_override : $category->name );

	$edit_link = "link-category.php?action=edit&cat_ID=$category->term_id";

	if ( current_user_can( 'manage_categories' ) ) {

		$edit = "<a class='row-title' href='$edit_link' title='" . esc_attr(sprintf(__('Edit “%s”'), $category->name)) . "'>$name</a><br />";

		$actions = array();

		$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';

		$actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';

		if ( $default_cat_id != $category->term_id )

			$actions['delete'] = "<a class='delete:the-list:link-cat-$category->term_id submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "'>" . __('Delete') . "</a>";

		$actions = apply_filters('link_cat_row_actions', $actions, $category);

		$action_count = count($actions);

		$i = 0;

		$edit .= '<div class="row-actions">';

		foreach ( $actions as $action => $link ) {

			++$i;

			( $i == $action_count ) ? $sep = '' : $sep = ' | ';

			$edit .= "<span class='$action'>$link$sep</span>";

		}

		$edit .= '</div>';

	} else {

		$edit = $name;

	}



	$row_class = 'alternate' == $row_class ? '' : 'alternate';

	$qe_data = get_term_to_edit($category->term_id, 'link_category');



	$category->count = number_format_i18n( $category->count );

	$count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;

	$output = "<tr id='link-cat-$category->term_id' class='iedit $row_class'>";

	$columns = get_column_headers('edit-link-categories');

	$hidden = get_hidden_columns('edit-link-categories');

	foreach ( $columns as $column_name => $column_display_name ) {

		$class = "class=\"$column_name column-$column_name\"";



		$style = '';

		if ( in_array($column_name, $hidden) )

			$style = ' style="display:none;"';



		$attributes = "$class$style";



		switch ($column_name) {

			case 'cb':

				$output .= "<th scope='row' class='check-column'>";

				if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {

					$output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";

				} else {

					$output .= "&nbsp;";

				}

				$output .= "</th>";

				break;

			case 'name':

				$output .= "<td $attributes>$edit";

				$output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';

				$output .= '<div class="name">' . $qe_data->name . '</div>';

				$output .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug) . '</div>';

				$output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';

				break;

			case 'description':

				$output .= "<td $attributes>$category->description</td>";

				break;

			case 'slug':

				$output .= "<td $attributes>" . apply_filters('editable_slug', $category->slug) . "</td>";

				break;

			case 'links':

				$attributes = 'class="links column-links num"' . $style;

				$output .= "<td $attributes>$count</td>";

				break;

			default:

				$output .= "<td $attributes>";

				$output .= apply_filters('manage_link_categories_custom_column', '', $column_name, $category->term_id);

				$output .= "</td>";

		}

	}

	$output .= '</tr>';



	return $output;

}

2255

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: