Skip to content

Commit

Permalink
API CHANGE: The module now requires the Orderable module for field so…
Browse files Browse the repository at this point in the history
…rting, rather than implementing custom fields.
  • Loading branch information
ajshort committed Dec 31, 2010
1 parent ee6e291 commit a86bbd1
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 205 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Maintainer Contacts
Requirements
------------
* SilverStripe 2.4
* The [Orderable](https://github.com/ajshort/silverstripe-orderable) module

Documentation
-------------
Expand Down
4 changes: 4 additions & 0 deletions _config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
* @package silverstripe-memberprofiles
*/

if (!class_exists('Orderable')) {
throw new Exception('The Member Profiles module requires the Orderable module.');
}

Object::add_extension('Member', 'MemberProfileExtension');
9 changes: 4 additions & 5 deletions code/MemberProfileField.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class MemberProfileField extends DataObject {
'Note' => 'Varchar(255)',
'CustomError' => 'Varchar(255)',
'Unique' => 'Boolean',
'Required' => 'Boolean',
'Sort' => 'Int'
'Required' => 'Boolean'
);

public static $has_one = array (
Expand All @@ -33,7 +32,9 @@ class MemberProfileField extends DataObject {
'Required' => 'Required'
);

public static $default_sort = 'Sort';
public static $extensions = array(
'Orderable'
);

/**
* Temporary local cache of form fields - otherwise we can potentially be calling
Expand All @@ -54,8 +55,6 @@ public function getCMSFields() {
$memberFields = $this->getMemberFields();
$memberField = $memberFields->dataFieldByName($this->MemberField);

$fields->removeByName('Sort');

$fields->insertBefore (
new ReadonlyField('MemberField', $this->fieldLabel('MemberField')),
'ProfileVisibility'
Expand Down
2 changes: 1 addition & 1 deletion code/MemberProfilePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function getCMSFields() {
new HeaderField(
'ProfileFieldsHeader',
_t('MemberProfiles.PROFILEFIELDS', 'Profile Fields')),
$table = new OrderableCTF(
$table = new OrderableComplexTableField(
$this, 'Fields', 'MemberProfileField')
));

Expand Down
4 changes: 4 additions & 0 deletions code/dataobjects/MemberProfileSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class MemberProfileSection extends DataObject {
'Parent' => 'MemberProfilePage'
);

public static $extensions = array(
'Orderable'
);

public static $summary_fields = array(
'DefaultTitle' => 'Title',
'CustomTitle' => 'Custom Title'
Expand Down
6 changes: 3 additions & 3 deletions code/formfields/MemberProfileSectionField.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* An extension to {@link OrderableCTF} that allows you to create and manage
* one of each {@link MemberProfileSection}.
* An extension to {@link OrderableComplexTableField} that allows you to create
* and manage one of each {@link MemberProfileSection}.
*
* @package silverstripe-memberprofiles
* @subpackage formfields
*/
class MemberProfileSectionField extends OrderableCTF {
class MemberProfileSectionField extends OrderableComplexTableField {

/**
* @return array
Expand Down
58 changes: 0 additions & 58 deletions code/formfields/OrderableCTF.php

This file was deleted.

34 changes: 0 additions & 34 deletions javascript/OrderableCTF.js

This file was deleted.

104 changes: 0 additions & 104 deletions templates/OrderableCTF.ss

This file was deleted.

0 comments on commit a86bbd1

Please sign in to comment.