Skip to content

Instantly share code, notes, and snippets.

@tristanlins
Created June 3, 2014 09:19
Show Gist options
  • Save tristanlins/fd934e5f6f7ad1d0e42e to your computer and use it in GitHub Desktop.
Save tristanlins/fd934e5f6f7ad1d0e42e to your computer and use it in GitHub Desktop.
<?php
$GLOBALS['TL_DCA']['tl_content']['fields']['my_headline']['save_callback'][] = array('Hooks', 'saveMyHeadline');
class Hooks
{
public function saveMyHeadline($value, $dc)
{
$headline = array('value' => $value, 'unit' => 'h2');
$database = \Database::getInstance();
$database
->prepare('UPDATE tl_content SET headline=? WHERE id=?')
->execute($headline, $dc->id);
return $value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment