3

is there a way in Drupal-7 to add form search in the content page filter or add text box in the filter form for filter the nodes by node title beside the type of node and publishing property

3

The Admin menu module has a nice sub-module called 'Administration views" which replaces Drupal core content management page with a view. It also adds extra filters and a search function.

| improve this answer | |
  • 1
    The Admin Views module has been moved to it's own project. Had a conflict with some other modules, including Relation when I tried it (active bug report). Also, was kind of hoping for something that filters the setting pages instead of just the content pages, but that's not the OP's question anyway :-p – thirdender Sep 21 '12 at 17:27
1

I was looking for something similar to this.. I ended up just putting a JS hack into the template file. It's pretty dodgy, but it works well and I don't know how to "compile" the code into a module (I could never get my head around that stuff). Anyway, here is the code that I dropped into the bottom of page.tpl.php of my admin theme.

<?php ///THIS IS A HACKY SOLUTION TO PROVIDE SEARCH FUNCTIONALITY
    if(implode('/',arg())=='admin/content'):
?>
<script type="text/javascript">
jQuery(document).ready(function($){
    $("#edit-filters").append('<div id="hacky-search"><legend><span class="fieldset-legend">Search</span></legend><input type="text" /></div>');

    var titlesArray = new Array();
    var wordsArray = new Array();

    $("#node-admin-content tbody tr").each(function (e) {
        titlesArray[e] = $(this).find('td:eq(1)').text().replace(/^\s+|\s+$/g, "");
    });
    /**/    
    $("#hacky-search input").bind('keyup blur change', function () {
        var theSearch = $(this).val().replace(/^\s+|\s+$/g, "");
        if (theSearch > "") {
            $("#node-admin-content tbody tr").addClass('hidden');
            for (i = 0; i < titlesArray.length; i++) {
                theItem = titlesArray[i].toLowerCase();
                if (theItem.search(theSearch.toLowerCase()) > -1) {
                    $('#node-admin-content tbody tr:eq(' + i + ')').removeClass('hidden');
                }
            }
        } else {
            $("#node-admin-content tbody tr").removeClass('hidden');
        }
        $("#node-admin-content tbody tr").removeClass('even').removeClass('odd');
        $("#node-admin-content tbody tr:not(.hidden)").each(function(e){
            if(e%2==0){
                $(this).addClass('odd');    
            }else{
                $(this).addClass('even');   
            }
        });
        //$('h2').text(theSearch);
    });
});
</script>
<style type="text/css">
    #hacky-search{
        position: absolute;
        right: 15px;
        top: 0; 
        text-align:right;
    }
    #hacky-search legend{
        position:relative;  
    }
    #hacky-search legend span{
        right:0;
    }
    #hacky-search input{
        border: 1px solid #CCCCCC;
        margin-top: 33px;
        padding: 2px 4px;
        width: 200px;
    }
    #node-admin-content tr{

    }
    #node-admin-content tr.hidden{
        display:none;
    }
</style>
<?php
    endif;
?>
| improve this answer | |
  • Does this only search on nodes currently exist on the list? – cherouvim Aug 30 '12 at 8:07
  • Yes it only searches on the list, so to make it search all nodes, you'd also have to change /modules/node/node.admin.inc to increase the limit in function node_admin_nodes(): $nids = $query ->fields('n',array('nid')) ->limit(9999) ///Increased Limit/// ->orderByHeader($header) ->addTag('node_access') ->execute() ->fetchCol(); – Nic Peck Oct 25 '12 at 0:31
0

Drupal 6 had a "content management filter" module but it's not ported to 7. You can always build your own with a view and some exposed filters.

If you like the "bulk operation" option you can do that too with the VBO module.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.