Fix for Code

  1. <?php
  2.  
  3. $plugin = array(
  4.   'schema' => 'riat_definition',
  5.   'access' => 'administer riat relationships',
  6.   'menu' => array(
  7.     'menu prefix' => 'admin/build',
  8.     'menu item' => 'relationships',
  9.     'menu title' => 'Relationships',
  10.     'menu description' => 'Provides a mechanism for building relationship templates for future use.',
  11.     'items' => array(
  12.       'manage' => array(
  13.         'path' => 'manage',
  14.         'title' => 'Manage',
  15.         'page callback' => 'riat_ui_manage_relationship',
  16.        
  17.       ),
  18.     ),
  19.   ),
  20.   'title singular' => t('relationship'),
  21.   'title singular proper' => t('Relationship'),
  22.   'title plural' => t('relationships'),
  23.   'title plural proper' => t('Relationships'),
  24.   'form' => array(
  25.     'settings' => 'riat_ui_ctools_export_ui_form',
  26.     'validate' => 'riat_ui_ctools_export_ui_form_validate',
  27.     'submit' => 'riat_ui_ctools_export_ui_form_submit',
  28.   ),
  29.   'handler' => array(
  30.      'class' => 'riat_export_ui',
  31.      'parent' => 'ctools_export_ui',
  32.    ),
  33.   'allowed operations' => array(
  34.     'manage' => array(
  35.       'title' => t('Manage'),
  36.     )
  37.   ),
  38. );
  39.  
  40. function riat_ui_ctools_export_ui_form(&$form, &$form_state) {
  41.   ctools_include('plugins');
  42.   $relationship_types = ctools_get_plugins('riat', 'relationships');
  43.   $form['info']['name']['#title'] = t('Type');
  44.   $form['info']['name']['#description'] = t('The machine-readable name of this relationship template. This text will be used for constructing the URL of the create content  page for this relationship template. This name must contain only lowercase letters, numbers, and underscores. Underscores will be converted into hyphens when constructing the URL of the create content page. This name must be unique and cannot conflict with any existing content type.');
  45.   $form['title'] = array(
  46.     '#title' => t('Name'),
  47.     '#type' => 'textfield',
  48.     '#required' => TRUE,
  49.     '#weight' => -10,
  50.     '#description' => t('The human-readable name of this relationship template. This text will be displayed as part of the list on the create content page. It is recommended that this name begin with a capital letter and contain only letters, numbers, and spaces. This name must be unique and cannot conflict with any existing content type.'),
  51.     '#default_value' => $form_state['item']->title,
  52.   );
  53.   $form['description'] = array(
  54.     '#title' => t('Description'),
  55.     '#type' => 'textarea',
  56.     '#description' => t('A brief description of this relationship template. This text will be displayed as part of the list on the create content page.'),
  57.     '#default_value' => $form_state['item']->description,
  58.   );
  59.   $options = array();
  60.   foreach ($relationship_types as $key => $relationship) {
  61.     if ($relationship['base']) {
  62.       $options[$key] = $relationship['name'];
  63.     }
  64.   }
  65.   $form['item']['object'] = array(
  66.     '#type' => 'select',
  67.     '#title' => t('Object'),
  68.     '#description' => t('Base objects are relationship definitions that are allowed to start a relationship template.'),
  69.     '#options' => $options,
  70.     '#default_value' => $form_state['item']->object,
  71.   );
  72.   ctools_include('dependent');
  73.   foreach ($options as $key => $option) {
  74.     $form['item']['type'][$key] = array(
  75.       '#type' => 'select',
  76.       '#title' => t($option .' Type'),
  77.       '#description' => t('The '. $option .' type to create'),
  78.       '#options' => $relationship_types[$key]['allowed types'](),
  79.       '#process' => array('ctools_dependent_process'),
  80.       '#dependency' => array('edit-object' => array($key)),
  81.       '#default_value' => $form_state['item']->object_type,
  82.     );
  83.   }
  84. }
  85.  
  86. function riat_ui_ctools_export_ui_form_validate(&$form, &$form_state) {
  87.   $form_state['values']['object_type'] = $form_state['values'][$form_state['values']['object']];
  88. }
  89.  
  90. function riat_ui_ctools_export_ui_form_submit(&$form, &$form_state) {
  91.  
  92. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.