Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getEditForm($id = null, $fields = null)
- {
- /**
- * @var $EditForm CMSForm
- */
- $EditForm = parent::getEditForm($id, $fields);
- $EditForm->Fields()->add(LiteralField::create('Sync', '<button><a href="www.google.com"> Sync </a></button>'));
- return $EditForm;
- }
- class GridFieldSyncButton implements GridField_HTMLProvider
- {
- /**
- * @var string
- */
- protected $targetFragment;
- /**
- * @param string $targetFragment
- */
- public function __construct($targetFragment = 'before')
- {
- $this->targetFragment = $targetFragment;
- }
- /**
- * @param $gridField
- * @return array
- */
- public function getHTMLFragments($gridField)
- {
- //-- The link to where the button links
- $data = new ArrayData(array('Sync' => Controller::join_links('link')));
- //--
- return array
- (
- $this->targetFragment => $data->renderWith('GridFieldSyncButton')
- );
- }
- }
- <a href="$Sync" class="ss-ui-button ui-button ui-widget ui-state-default ui-corner-all" data-icon="add">
- Sync Calculators
- </a>
- <br/><br/>
- $GridField = $EditForm->Fields()->items[0];
- $GridField->getConfig()->addComponent(new GridFieldSyncButton());
Add Comment
Please, Sign In to add comment