You are here

function node_patterns in Patterns 7

Same name and namespace in other branches
  1. 6.2 components/node.inc \node_patterns()
  2. 6 components/node.inc \node_patterns()
  3. 7.2 patterns_components/components/node.inc \node_patterns()

File

patterns_components/components/node.inc, line 6

Code

function node_patterns($data) {
  $files_ct = array(
    'modules/node/content_types.inc',
  );
  $files_n = array(
    'modules/node/node.pages.inc',
  );

  // Determine necessary forms for action 'node' based on the data.
  $forms = array();
  if ($data) {
    if ($data['tag'] == 'node' && isset($data['type'])) {
      $forms[] = $data['type'] . '_node_form';
    }
  }
  $actions['node'] = array(
    PATTERNS_INFO => t('Create/Modify/Delete Nodes'),
    PATTERNS_CREATE => $forms,
    PATTERNS_MODIFY => $forms,
    PATTERNS_DELETE => array(
      'node_delete_confirm',
    ),
    PATTERNS_FILES => $files_n,
    PATTERNS_EXPORT => array(
      PATTERNS_EXPORT_ALL => 'node_patterns_export_all_nodes',
    ),
  );
  $actions['content_type'] = array(
    PATTERNS_INFO => t('Create/Modify/Delete Content Types'),
    PATTERNS_CREATE => array(
      'node_type_form',
    ),
    PATTERNS_MODIFY => array(
      'node_type_form',
    ),
    PATTERNS_DELETE => array(
      'node_type_delete_confirm',
    ),
    PATTERNS_FILES => $files_ct,
    PATTERNS_EXPORT => array(
      PATTERNS_EXPORT_ALL => 'node_patterns_export_all_content_types',
    ),
  );
  $actions['content_type_extract_all'] = array(
    PATTERNS_INFO => t('Create/Modify/Delete Content Types'),
    PATTERNS_MODIFY => array(
      'node_type_form',
    ),
    PATTERNS_FILES => $files_ct,
  );
  return $actions;
}