-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DataTypeHook: Add a Hook for DataType
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.
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
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); | ||
} |