Skip to content

Commit

Permalink
DataTypeHook: Add a Hook for DataType
Browse files Browse the repository at this point in the history
refs #9715
  • Loading branch information
Alexander Fuhr committed Jul 24, 2015
1 parent 8715006 commit 1e694f2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions library/Director/Web/Hook/DataTypeHook.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Icinga\Module\Director\Web\Hook;

use Icinga\Module\Director\Web\Form\QuickForm;

abstract class DataTypeHook
{
public function getName()
{
$parts = explode('\\', get_class($this));
$class = preg_replace('/DataType/', '', array_pop($parts));

if (array_shift($parts) === 'Icinga' && array_shift($parts) === 'Module') {
$module = array_shift($parts);
if ($module !== 'Director') {
return sprintf('%s (%s)', $class, $module);
}
}

return $class;
}

public static function getFormat()
{
return 'string';
}

abstract public function getFormElement(QuickForm $form);
}

0 comments on commit 1e694f2

Please sign in to comment.