Greetings
as described in Creating Article Pages without Parents I have started making a Article (Review) Page that actually contains no real Published Articles. The Logic is as follow:
ArticleHolder.php
<?php
class ArticleHolder extends Page {
private static $many_many = array(
'Articles' => 'Article'
);
public function getCMSFields() {
$fields = parent::getCMSFields();
$allArticles = new GridField(
'Articles',
'All Articles',
$this->Articles(),
GridFieldConfig_RelationEditor::create()
);
$fields->addFieldToTab('Root.Articles', $allArticles);
return $fields;
}
}
class ArticleHolder_Controller extends Page_Controller {
}
Article.php
<?php
class Article extends DataObject {
private static $db = array(
'Heading' => 'Varchar',
'CreateDate' => 'SS_Datetime',
'Author' => 'Varchar',
'Content' => 'HTMLText'
);
private static $belongs_many_many = array(
'Article' => 'ArticleHolder'
);
public static $summary_fields = array(
'Heading' => 'Heading',
'CreateDate' => 'Date',
'Author' => 'Author'
);
private static $searchable_fields = array(
'Heading' => 'PartialMatchFilter'
);
}
so far it works well, but I need some help in parts of the UI.
- Question: The search result when Linking Articles only show the ID, how do I get the Heading of the result to display?
Question/Answer: How do I get Create Date in the edit view to have the 'showcalendar' function
- Question: Can I create a hidden field for 'lastEditedBy' and save the current user in there on edit
- Question: How to list a Selection of Pages that this Article Relate to.
I know this is allot of question, but right now I have no clue even how to search for these, and thus ask the more experienced people to help me solve this the right way, from the start.
At least when everybody helps along, the Forum should have some nice examples for all to use;)
PS: Please reply to the relevant Questions in there respective Threads, this way the stuff is all nice and simple to understand.
Greetings from Germany