You are here

function mediafront_field_settings in MediaFront 6.2

Same name and namespace in other branches
  1. 6 mediafront_field.inc \mediafront_field_settings()

Implementation of hook_field_settings().

File

./mediafront_field.inc, line 12
Provides CCK integration for the mediafront module

Code

function mediafront_field_settings($op, $field) {
  switch ($op) {
    case 'form':

      // Multiple is not supported with MediaFront.
      $form['multiple'] = array(
        '#type' => 'value',
        '#value' => 0,
      );
      if (user_access('use PHP for mediafront parameters')) {
        $form['params'] = array(
          '#type' => 'fieldset',
          '#title' => t('Additional Parameters'),
          '#collapsible' => TRUE,
          '#collapsed' => empty($field['php_params']),
        );
        $form['params']['params'] = array(
          '#title' => t('Code'),
          '#type' => 'textarea',
          '#default_value' => $field['php_params'] ? $field['php_target'] : '',
          '#description' => t('Advanced usage only: PHP code that returns an array of additional parameters to override the preset. Should not include <?php ?> delimiters. If this field is filled out, the value returned by this code will override any value specified above. Note that executing incorrect PHP-code can break your Drupal site.'),
        );
      }
      else {
        $form['params'] = array(
          '#type' => 'value',
          '#value' => $field['params'] ? $field['params'] : '',
        );
      }
      return $form;
    case 'save':
      return array(
        'params',
      );
    case 'database columns':
      return array(
        'params' => array(
          'type' => 'text',
          'size' => 'medium',
          'default' => '',
          'sortable' => FALSE,
        ),
      );
  }
}