You are here

function panels_admin_custom in Panels 5

Callback to perform administrative functions on the content block

1 string reference to 'panels_admin_custom'
panels_custom_panels_content_types in content_types/custom.inc
Callback function to supply a list of content types.

File

content_types/custom.inc, line 43

Code

function panels_admin_custom($op, &$arg, $arg2 = NULL) {
  switch ($op) {
    case 'list':
      $conf = $arg;
      return '<strong>Custom</strong>: ' . filter_xss_admin($conf['title']);
    case 'add button':
      $form['title'] = array(
        '#title' => t('Enter an optional title for custom content you define'),
        '#type' => 'textfield',
        '#maxlength' => 512,
        '#weight' => -10,
      );
      $form['submit'] = array(
        '#type' => 'button',
        '#value' => t('Add custom'),
      );
      $form['#prefix'] = '<div class="container-inline">';
      $form['#suffix'] = '</div>';
      return $form;
    case 'add':
      if ($_POST['op'] != t('Add custom')) {
        return;
      }
      return $arg;
    case 'edit':
      $conf =& $arg;
      $form['title'] = array(
        '#type' => 'textfield',
        '#default_value' => $conf['title'],
        '#title' => t('Title'),
        '#description' => t('Title'),
        '#size' => 15,
      );
      $form['body'] = array(
        '#title' => t('Body'),
        '#type' => 'textarea',
        '#default_value' => $conf['body'],
        '#rows' => 10,
        '#cols' => 20,
      );
      $arg2[] = 'format';
      $form['format'] = filter_form($conf['format'], 1, $arg2);
      $form['css_id'] = array(
        '#type' => 'textfield',
        '#default_value' => $conf['css_id'],
        '#title' => t('CSS ID'),
        '#description' => t('CSS ID of this custom content.'),
        '#weight' => 2,
        '#size' => 15,
      );
      $form['css_class'] = array(
        '#type' => 'textfield',
        '#default_value' => $conf['css_class'],
        '#title' => t('CSS class'),
        '#description' => t('CSS class of this custom content.'),
        '#weight' => 2,
        '#size' => 15,
      );
      return $form;
    case 'validate':

      // This one has nothing to validate.
      $form =& $arg;
      return;
    case 'save':

      // For this one, the form values go directly into the config.
      $form =& $arg;
      return $form;
  }
}