configure page size for taxonomy using services

The services module limits the amount of taxonomy vocabularies and taxonomy terms it shows to 20 by default.

This is how you can configure it to serve more vocabularies/terms:

For Drupal 6 add this to the database:
for terms:
insert into variable VALUES ('services_taxonomy_term_index_page_size', 'i:200;');
for vocabularies:
insert into variable VALUES ('services_taxonomy_vocabulary_index_page_size', 'i:100;');

Get all nodes attached to a vocabulary,Get all nodes directly attached with a term id,Get all nodes belong to a term id recursively(parent-child taxonomy terms)

<?php

/**
* function to get all term ids inside a vocab in a flat array
* No matter if vocab consists of hierarichal order of terms,you will get all term ids in a flat array.
* @param
* $vocab_machine_name takes vocabulary machine name as parameter.
* @return
* $tids return array of tids in a flat array format
*/
function get_taxonomy_term_ids_inside_vocab($vocab_machine_name) {
$vocab = taxonomy_vocabulary_machine_name_load($vocab_machine_name);
if (is_object($vocab)) {
$term_tree = taxonomy_get_tree($vocab->vid);
if (is_array($term_tree) && !empty($term_tree)) {
foreach ($term_tree as $key => $value) {
$tids[] = $value->tid;
}
} if (empty($term_tree)) {
$tids = array();
}
} else
return "No Vocab Found with the given name";

return ($tids);
}

/**
* function to get all the node ids directly mapped to the given taxonomy terms.
* Returns Flat array of node ids belong to the given term ids.
* @param
* $tid takes term id can be a single term or array of terms.
* @return
* $nid/$nids returns node ids array or sinly node id directly mapped to the given taxonomy term.
*/
function get_nodes_directly_mapped_to_term($tid) {
if (is_array($tid) && !empty($tid)) {
foreach ($tid as $key => $value) {
$nids[] = taxonomy_select_nodes($value);

Migrate taxonomy images from Drupal 5

The following class was used to migrate taxonomy term images from Drupal 5's Taxonomy Image module into a proper Drupal 7 entity field. You'll want to adjust class and field names appropriately for your use case.

Note: Taxonomy Image in Drupal 5 did not make use of the files table, so you need to specify a path to your taxonomy images in the prepareRow() method.

<?php
class GWJTermImageMigration extends DrupalTerm5Migration {

public function __construct(array $arguments) {
$this->sourceFields['field_image'] = t('Constructed source image field');
$this->sourceFields['field_image:title'] = t('Constructed source image title field');
$this->sourceFields['field_image:alt'] = t('Constructed source image alt field');
$this->sourceFields['field_image:source_dir'] = t('Constructed source image source directory field');
$this->sourceFields['field_image:destination_dir'] = t('Constructed source image destination directory field');
$this->sourceFields['field_image:destination_file'] = t('Constructed source image destination file field');
parent::__construct($arguments);

$this->addFieldMapping('field_image', 'field_image');
$this->addFieldMapping('field_image:file_class')->defaultValue('MigrateFileUri');
$this->addFieldMapping('field_image:title', 'field_image:title')->defaultValue('');

Taxonomy Publisher Filter

Dependencies

It depends on the Taxonomy Publisher module (now part of the Taxonomy tools project), which
attaches a status field to the taxonomy terms of the vocabularies you select.

Versions

The current version supports select, checkbox/radio and autocomplete widgets for term reference fields.

How to use

  1. download the module and place it under 'sites/all/modules/contrib' folder
    • with Drush use: drush dl taxonomy_tools
  2. enable the module from the modules page: 'admin/build/modules' the Taxonomy Publisher & Taxonomy Publisher Filter module
  3. enable taxonomy publisher on the vocabularies you wish to limit
  4. enable/disable the terms in the above vocabularies
  5. configure roles that show see the limited list only under admin/people/permission

Custom Form

_taxonomy_publisher_filter_custom_form($vid, $settings) function is helpful to filter your select or checkbox/radio field in custom forms.
The function will expect a vocabulary id by default and will return the filtered option list.

    $option = _taxonomy_publisher_filter_custom_form($vid);

Taxonomy Tools

A package of taxonomy management tools.
Includes:

  • Taxonomy Publisher
  • Taxonomy Publisher Filter
  • Taxonomy Role Access
  • Taxonomy Redirect
  • Taxonomy Copier

Icons taken from "Crystal" and "Oxygen".

Taxonomy Tools controls global access to taxonomy terms depending on the settings provided by the enabled taxonomy management tools. Also implements node access system to control access for nodes that are associated with taxonomy terms.
Taxonomy tools provides an overview page which provides a summary for vocabularies that use any of the tools included in this module.

Taxonomy Publisher

Adds status "Published" to taxonomy terms and also provides scheduled (un)publishing of taxonomy terms.
The scheduler part is based on code from Scheduler module.
For date mainpulations used datejs library.

Taxonomy Publisher Filter

This module allows you to limit the taxonomy terms listed in a term reference form element or in a views exposed filter.
The current version supports select, checkbox/radio and autocomplete widgets for term reference fields.

Multi-step select list for nested taxonomy as a Views exposed filter

Just combined the script on: https://github.com/AndrewIngram/jquery-select-hierarchy with some custom code to have a working multi-step taxonomy select widget.

First, I added an exposed filter for the vocabulary I want. I selected "Dropdown" as the selection type and marked "Show hierarchy in dropdown". Now I have a select list like that:

Cat 1
-Subcat 11
-Subcat 12
Cat 2
-Subcat 21
-Subcat 22

Then I added custom javascript as a global text area to the header of that view with input type PHP. Things to be careful:

1. Change this:#edit-field-country-city-tid option with your select list's id.
2. Change this:.form-item-field-country-city-tid select with your select list's class.
3. This method doesnt work for 3 or more level hierarchies but it should be easy to modify the code to achieve this.
4.Hide the original select list with CSS.

(function ($) { $(document).ready(function() { var $groupedOptionList = $("#edit-field-country-city-tid option"); var groupedItemList = []; var lastParentChildIndex = 0; var lastParentIndex = 0; $groupedOptionList.each(function(index, item) { var itemText = $(item).text(); var splitterCount = itemText.match(/\-/g) === null ? 0 : itemText.match(/\-/g).length; // root item if (splitterCount === 0) {

Pages

Subscribe with RSS Subscribe to RSS - taxonomy