You are here

class ContentProfilePageEditProfile in Content Profile 6

ContentProfilePageEditProfile displays a form that allows users to edit content profiles.

Hierarchy

Expanded class hierarchy of ContentProfilePageEditProfile

File

./content_profile.pageroute.inc, line 22

View source
class ContentProfilePageEditProfile extends PageroutePageEdit {
  public function getForm(&$form, &$form_state, &$args) {
    $args['hide_pageroute_buttons'] = FALSE;
    $args['default_target'] = PAGEROUTE_CURRENT;
    $page =& $form_state['page'];
    if (isset($form_state['node']) && $form_state['node']['type'] == $this->options['content-type']) {
      $node = $form_state['node'];
    }
    else {
      if (isset($page)) {
        $node = node_load(array(
          'type' => $this->options['content-type'],
          'uid' => pageroute_page_get_uid($page),
        ));
      }
    }
    if (empty($node)) {
      PageroutePageAdd::setNodeAddForm($form, $form_state, $page);
    }
    else {
      $this
        ->setNodeEditForm($form, $form_state, $page, $args, $node);
    }
    parent::unsetForm($form);
  }
  public function getAdminForm($page, &$form) {
    $form['options']['content-type'] = array(
      '#type' => 'select',
      '#title' => t('Profile content type'),
      '#options' => content_profile_get_types('names'),
      '#default_value' => $page->options['content-type'],
      '#weight' => 2,
      '#description' => t('Select a content profile type.'),
    );
    PageroutePage::nodeUi($page, $form, TRUE);
  }
  public static function help() {
    return t('A page of this type will present a content profile node editing form of a configurable content-profile-type. It will edit the node with the id taken from the first argument of the pageroute. Furthermore this type can be configured to show a node adding form if the content profile is not existing. So you can build a pageroute that manages the creation and editing of content profiles.');
  }
  public static function info() {
    return array(
      'name' => t('Content profile editing form'),
    );
  }
  public function setUp() {
  }
  public static function getDefaultSubmitHandler($form) {
    return 'node_form_submit';
  }

}

Members