开发者

Anyone know how to add a field or column to the /ADMIN/CONTENT listing page? DRUPAL 7

开发者 https://www.devze.com 2023-04-13 04:22 出处:网络
I would like to add a field / column to the Content Administration Overview page but it appears the easiest theme overrid开发者_StackOverflow中文版e to do this has been deprecated with D7.

I would like to add a field / column to the Content Administration Overview page but it appears the easiest theme overrid开发者_StackOverflow中文版e to do this has been deprecated with D7.

In D6 I could just override the method:

theme_node_admin_nodes($form)

But this method no longer exists for D7. What's the equivalent replacement or do I actually need to hook into node_admin_nodes() now and modify the form directly?


For me it was super easy with these two modules:

  1. views bulk operations (VBO)
  2. administration views (needs VBO)

As soon as both modules are installed and activated you can go to your views (admin/structure/views) where now 3 additional views appear (Administration comments, Administration nodes, Administration users). You then just need to edit the view "Administration nodes", where you can add and arrange everything you want as usually with views.

I wanted to add a column displaying all content's nids. Worked super well!


You'll have to hook into the form, the theme element has been completely removed node_admin_nodes() in Drupal 7.

It's actually node_admin_content() that you'll need to hook into as node_admin_nodes() is no longer a form function, it just builds up elements that are used by node_admin_content().

Fortunately the elements in node_admin_nodes() and node_filter_form() (the two functions used in node_admin_content() to build up the page) are nicely structured and will be very easy to override.


I've been able to add an element to the bottom of the table. Although I am unsure how you ADD a coloumn into the body of the table?

function seven_form_alter(&$form, &$form_state, $form_id) {
        drupal_set_message("Form ID is : " . $form_id);

        //get node_admin_content
        //$nodeAdmin = drupal_get_form("node_admin_content");


          // Add a checkbox to registration form about agreeing to terms of use.
  $form['node_admin_content']['poland'] = array(
    '#type' => 'checkbox', 
    '#title' => t("I agree with the website's terms and conditions."), 
    '#required' => TRUE,
  );

}


The Administration Views module replaces a lot of admin listings with real views (as in Views module) that you can edit and configure any way you want it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号