function field_drush_command

8.0.x field.drush.inc field_drush_command()
6.x field.drush.inc field_drush_command()
7.x field.drush.inc field_drush_command()
4.x field.drush.inc field_drush_command()
5.x field.drush.inc field_drush_command()

Implementation of hook_drush_command().

File

commands/core/field.drush.inc, line 23
Field API's drush integration

Code

function field_drush_command() {
  $items['field-create'] = array(
    'description' => 'Create fields and instances. Returns urls for field editing.',
    'core' => array('7+'),
    'drupal_dependencies' => array('field_ui'),
    'arguments' => array(
      'bundle' => 'Content type (for nodes). Name of bundle to attach fields to. Required.',
      'field_spec' => 'Comma delimited triple in the form: field_name,field_type,widget_name. If widget_name is omitted, the default widget will be used. Separate multiple fields by space. If omitted, a wizard will prompt you.',
    ),
    'options' => array(
      'entity_type' => 'Type of entity (e.g. node, user, comment). Defaults to node.',
    ),
    'examples' => array(
      'drush field-create article' => 'Define new article fields via interactive prompts.',
      'open `drush field-create article`' => 'Define new article fields and then open field edit form for refinement.',
      'drush field-create article city,text,text_textfield subtitle,text,text_textfield' => 'Create two new fields.',
    ),
  );
  $items['field-update'] = array(
    'description' => 'Return URL for field editing web page.',
    'core' => array('7+'),
    'drupal_dependencies' => array('field_ui'),
    'arguments' => array(
      'field_name' => 'Name of field that needs updating.',
    ),
    'examples' => array(
      'field-update comment_body' => 'Quickly navigate to a field edit web page.',
    ),
  );
  $items['field-delete'] = array(
    'description' => 'Delete a field and its instances.',
    'core' => array('7+'),
    'arguments' => array(
      'field_name' => 'Name of field to delete.',
    ),
    'options' => array(
      'bundle' => 'Only delete the instance attached to this bundle. If omitted, admin can choose to delete one instance or whole field.',
      'entity_type' => 'Disambiguate a particular bundle from identically named bundles. Usually not needed.',
    ),
    'examples' => array(
      'field-delete city' => 'Delete the city field and any instances it might have.',
      'field-delete city --bundle=article' => 'Delete the city instance on the article bundle',
    ),
  );
  $items['field-clone'] = array(
    'description' => 'Clone a field and all its instances.',
    'core' => array('7+'),
    'arguments' => array(
      'source_field_name' => 'Name of field that will be cloned',
      'target_field_name' => 'Name of new, cloned field.',
    ),
    'examples' => array(
      'field-clone tags labels' => 'Copy \'tags\' field into a new field \'labels\' field which has same instances.',
      'open `field-clone tags labels`' => 'Clone field and then open field edit forms for refinement.',
    ),
  );
  $items['field-info'] = array(
    'description' => 'View information about fields, field_types, and widgets.',
    'drupal_dependencies' => array('field_ui'),
    'core' => array('7+'),
    'arguments' => array(
      'type' => 'Recognized values: fields, types. If omitted, a choice list appears.',
    ),
    'options' => array(
      'pipe' => 'Return field information table as CSV.',
    ),
    'examples' => array(
      'field-info types' => 'Show a table which lists all field types and their available widgets',
    ),
  );
  return $items;
}