forked from protalk/protalk
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request protalk#73 from Bendihossan/master
Adds ability to manage pages in backend
- Loading branch information
Showing
4 changed files
with
72 additions
and
9 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
/** | ||
* ProTalk | ||
* | ||
* Copyright (c) 2012, Steffan Harries <contact@steffanharries.me.uk> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Protalk\AdminBundle\Admin; | ||
|
||
use Sonata\AdminBundle\Admin\Admin; | ||
use Sonata\AdminBundle\Datagrid\ListMapper; | ||
use Sonata\AdminBundle\Datagrid\DatagridMapper; | ||
use Sonata\AdminBundle\Validator\ErrorElement; | ||
use Sonata\AdminBundle\Form\FormMapper; | ||
|
||
class PageAdmin extends Admin | ||
{ | ||
protected function configureFormFields(FormMapper $formMapper) | ||
{ | ||
$formMapper->add('url')->add('pageTitle')->add('title')->add('content'); | ||
} | ||
|
||
protected function configureDatagridFilters(DatagridMapper $datagridMapper) | ||
{ | ||
$datagridMapper->add('pageTitle'); | ||
} | ||
|
||
protected function configureListFields(ListMapper $listMapper) | ||
{ | ||
$listMapper->addIdentifier('title')->add('url'); | ||
} | ||
|
||
public function validate(ErrorElement $errorElement, $object) | ||
{ | ||
$errorElement | ||
->with('pageTitle') | ||
->assertMaxLength(array('limit' => 100)) | ||
->end() | ||
->with('url') | ||
->assertMaxLength(array('limit' => 100)) | ||
->end(); | ||
} | ||
} |
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
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