Get revisions data for Drupal 7
Submitted by system on Wed, 11/23/2022 - 10:50SELECT nid, COUNT(vid) AS count FROM node_revision GROUP BY nid ORDER BY count DESC LIMIT 20;
SELECT nid, COUNT(vid) AS count FROM node_revision GROUP BY nid ORDER BY count DESC LIMIT 20;
<?php
/*
* Utility to change the max length of a text field
*/
function change_text_field_max_length($field_name, $new_length) {
$field_table = 'field_data_' . $field_name;
$field_revision_table = 'field_revision_' . $field_name;
$field_column = $field_name . '_value';
// Alter value field length in fields table
db_query("ALTER TABLE `{$field_table}` CHANGE `{$field_column}` `{$field_column}` VARCHAR( {$new_length} )");
// Alter value field length in fields revision table
Views Bulk Operations come handy when doing bulk operations over a selected list. This is great because it combines the power of views to filter the selection and specific actions to do on each selected entity. For Ex: Updating some field in the record, deleting selected entity and so on.
Views also provide an easier way to define your own set of custom functions to perform on each selected row of entities.
First, we need to define an action :
Drupal provides nice theming options for table display. However, various options available using tabular display are not documented well. This article will try to list various options to use when creating tables using drupal theme functions.
Creating a table display:
Search for drupal_set_time_limit in Drupal directory and modify the line as below. Ensure that it is restored later once the required operation is over:
For example: Modify the following line in locale.inc file in includes/locale.inc.
<?php
drupal_set_time_limit(240);
?>
and set to 1800.
Displaying data for any entity fields with formatting can be achieved with 2 simple drupal api.
field_get_items: Returns the field items in the language they currently would be displayed.
field_view_value: Returns a renderable array for a single field value.
Example:
Disqus is a networked community platform used by hundreds of thousands of sites all over the web. With Disqus, your website gains a feature-rich comment system complete with social network integration, advanced administration and moderation options, and other extensive community functions.
It becomes very frustrating when one had to try various options but not be able to create drop down list of groups for selection via an exposed filter option in a view.
There is a very simple solution to it. In the Group Audience field settings, select "Render Views filters as select list" option under ADDITIONAL BEHAVIORS. This selection would make the Group Audience field selected as an exposed filter display drop down options of all the groups available.
This can be achieved using hook_node_view
We may want to get the options available for a field in content type. This can be achieved using Field API.