Skip to content

Instantly share code, notes, and snippets.

@dantleech
Created February 15, 2011 10:12
Show Gist options
  • Save dantleech/827346 to your computer and use it in GitHub Desktop.
Save dantleech/827346 to your computer and use it in GitHub Desktop.
InheritanceField
// .. InheritableField.php
public function __construct($key, Field $field)
{
parent::__construct($key, array());
$this->setPropertyPath('inheritanceData');
$field->setKey('value');
$field->setPropertyPath(sprintf('[%s][value]', $key));
$checkboxField = new CheckboxField('inherit');
$checkboxField->setPropertyPath(sprintf('[%s][inherit]', $key));
$this->add($checkboxField);
$this->add($field);
$this->targetField = $field;
$this->inheritField = $checkboxField;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment