четверг, 6 августа 2015 г.

Drupal Dump Field Declaration

include_once DRUPAL_ROOT . '/includes/utility.inc';
$field_data = field_info_field('field_testimonial_portrait');
unset($field_data['id']);
pre(drupal_var_export($field_data));


$instance_data = field_info_instance('node', 'field_testimonial_portrait', 'testimonial');
unset($instance_data['id'], $instance_data['field_id']);
pre(drupal_var_export($instance_data));

Inspired by http://www.thecarneyeffect.co.uk/creating-custom-content-type-adding-fields-programmatically-drupal-7


include_once DRUPAL_ROOT . '/includes/utility.inc';
$field_data = field_info_field('field_specialty');
unset($field_data['id']);
echo "
" . (drupal_var_export($field_data)) . '
';


$instance_data = field_info_instance('node', 'field_specialty', 'doctor_cv');
unset($instance_data['id'], $instance_data['field_id']);
echo "
" . (drupal_var_export($instance_data)) . '
';

среда, 5 августа 2015 г.

Drupal Mudule Translation

  1. To generate the .pot file, install the module Translation template extractor
  2. Go to the "Extract strings" tab on the Locale administration interface, select your module and submit the form. You will get one single template file generated.
  3. Then you can translate the strings with a tool like Poedit (http://www.poedit.net).
  4. When you are done, files should be copied to a "translations" sub-folder in the module folder, so they are automatically imported by Drupal when installing your game module.

drush command to force translations loading: drush php-eval "locale_system_update(array('yourmodule_name'));drush_backend_batch_process();"