Example #1
0
 /** 
  * Recommended. This method is called when the parent class can't find a method
  * specifically build for a given column. Generally, it's recommended to include
  * one method for each column you want to render, keeping your package class
  * neat and organized. For example, if the class needs to process a column
  * named 'title', it would first see if a method named $this->column_title() 
  * exists - if it does, that method will be used. If it doesn't, this one will
  * be used. Generally, you should try to use custom column methods as much as 
  * possible. 
  * 
  * Since we have defined a column_title() method later on, this method doesn't
  * need to concern itself with any column with a name of 'title'. Instead, it
  * needs to handle everything else.
  * 
  * For more detailed insight into how columns are handled, take a look at 
  * WP_List_Table::single_row_columns()
  * 
  * @param array $item A singular item (one full row's worth of data)
  * @param array $column_name The name/slug of the column to be processed
  * 
  * @return string Text or HTML to be placed inside the column <td>
  */
 public function column_default($item, $column_name)
 {
     if (method_exists($this->definition, 'column' . $column_name)) {
         return $this->definition->{'column' . $column_name}($item);
     }
     if ($this->definition->debug()) {
         return $column_name . ' = <pre>' . print_r($item, true) . '</pre>';
     }
     return '<em style="color:red">Definition missing `<b>column' . ucfirst($column_name) . '()</b>` method</em>';
 }