-
-
Save hailwood/36ff00bf788152912d01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class BlogHolder_ControllerExtension extends DataExtension { | |
public static $allowed_actions = array('ArticleSearchForm', 'search'); | |
public function ArticleSearchForm() { | |
// Create fields | |
$categories = array(); | |
foreach($this->owner->BlogCategories() as $category){ | |
$categories[$category->ID] = $category->Title; | |
} | |
$keywordField = new TextField('Keyword', 'Keywords:'); | |
$keywordField->setAttribute('placeholder', 'Keywords'); | |
$fields = new FieldList( | |
$keywordField, | |
new DropdownField('Category', 'Category:', $categories) | |
); | |
// Create actions | |
$actions = new FieldList( | |
new FormAction('search', 'Search') | |
); | |
return new ArticleSearchForm($this->owner, 'search', $fields, $actions); | |
} | |
public function search($data, $form){ | |
die('<pre>'); | |
var_dump($data, $form); | |
die('</pre>'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment