7939 Posts in 1472 Topics by 944 members
Page: 1 2
|Go to End||Next >|
29 April 2009 at 4:53pm Last edited: 29 April 2009 6:48pm
I am building a site that contains many types of data, and I really like the way DataObjectManager handles working with data in the CMS. However, for some of my fields, the user is only able to upload a set number (or less) of a certain type of data.
For example - on a products page, the user may upload 4 or less (or none) videos per product.
How can I setup DataObjectManager to only allow for a fixed number of maximum inputs?
How can I do the same thing for has many file manager?
30 April 2009 at 2:16am
Here's an interesting approach..
$perms = array('edit','delete');
if($this->FileObjects()->Count() < 4) $perms = 'add';
30 April 2009 at 3:24am
Thanks Uncle Cheese. Where would I go about putting that code?
30 April 2009 at 3:30am
In your getCMSFields() function.
And, you know all the variable names and property names are examples, right? I can't tell you how many people try to use my example code in production.
30 April 2009 at 3:42am
Yeah, I know that. I just didn't know if it went into the CMSFields() function, or I created a new function inside my datatype.
6 May 2009 at 1:00am
the approach posted by UncleCheese (modifying the $perms array) is nice, it has a serious usability downside though:
whenever you delete your latest object, you still can't add another one, as the permissions don't update. they DO update when you add another object though.
so: having 3 objects and 4 are allowed, and you add a 4th, the 'add' button disappears as intended.
but having 4 and deleting 1 won't result in the add button 'reappering' until you refresh the page.
hope this is understandable
6 May 2009 at 1:56am
Yeah, that makes sense. Although, you wouldn't have to refresh the entire page. You could just refresh the DataObjectManager itself. But I do see the issue. Deleting is the only action that does not refresh the entire DataObjectManager field.
6 May 2009 at 3:08am
could you set up dataobjectmanager to refresh after deleting an item / are there reasons not to do so?
i also got an somewhat related issue:
Page: 1 2
|Go to Top||Next >|