Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
having the invoices in the admin/content overview with invoice numbers as the titles, I had the need to see the client name ( company name ) in the overview.
While I can create a new module for this and I've done this now locally it might be nice to integrate this in the invoice module.
<?php
/**
* Implements hook_form_node_admin_content_alter()
* adding company name to the overview
*/
function click_invoice_admin_content_form_node_admin_content_alter(&$form, &$form_state, $form_id) {
// Add another column to the table header
$form['admin']['nodes']['#header']['company_name'] = array('data' => t('Company name'));
// Loop through the rows in the table and add the company_name column
foreach ($form['admin']['nodes']['#options'] as $nid => $row) {
$node = node_load($nid);
if(isset($node->customer['company_name'])) {
$form['admin']['nodes']['#options'][$nid]['company_name'] = $node->customer['company_name'];
}
else {
$form['admin']['nodes']['#options'][$nid]['company_name'] = '';
}
}
}
?>
If needed I will find out how and create a patch against the dev version.
Let me know if there is any interest for this.
Comments
Comment #0.0
scuba_flycorrected a minor comment mistake
Comment #1
scuba_fly