21285 Posts in 5732 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 732 Views |
-
Link/URLField

7 July 2011 at 11:27pm
Is there such a thing? I want to store a list of links related to a page, editable from the CMS. And it should work like the link widget in the HTMLEditor. Is this possible?
-
Re: Link/URLField

11 July 2011 at 10:20pm
Hi,
I'm not sure how much of this can be done exactly the same way, but I would create a DataObject like...
class MyLinkURL extends DataObject {
static $db = array(
'LinkURL' => 'Varchar',//possibly use HTMLfield to allow creating a link in that way...
);
}then I'd add has_many to the Page type required, then add the has_many as a tab when editting the page
...
static $has_many = array(
'MyLinkURLs' => 'MyLinkURL',
);
...
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.MyLinkURLs",
new ComplexTableField(
$this,
'MyLinkURLs',
'MyLinkURLs'
)
);
return $fields;
}
... -
Re: Link/URLField

16 July 2011 at 10:27am
Thanks for the tip. I had sort of given it up already and simply faked it using virtual pages. Kind of user friendly, but the urls gets messy.
I'll look into your tip.
| 732 Views | ||
|
Page:
1
|
Go to Top |


