gambitph/Titan-Framework — pull request #177 by hasinhayder (2014-09-13 12:56:05+00:00)
Title: Support for Field's visibility based on other field's value

I've added visibility support for fields based on other field's value. At this moment select and text fields are supported. This can be used as shown in the following example

```php
$panel2 = $titan->createMetabox(array(
'name' => 'Yo Yo'
));

// Create options for my admin panel
$panel2->createOption(array(
'name' => 'My Text Option',
'id' => 'my_text_option',
'type' => 'text',
'desc' => 'This is our option'
));
$panel2->createOption(array(
'name' => 'My Text Option 2',
'id' => 'my_text_option_2',
'type' => 'text',
'desc' => 'This is our option',
'dependency' => array('id' => 'my_text_option', 'value' => 'yo')
));

$panel2->createOption(array(
'name' => 'My Select Option',
'id' => 'my_select_option',
'type' => 'select',
'options' => array(
'1' => 'Option one',
'2' => 'Option two',
'3' => 'Option three',
),
'desc' => 'This is a select drop down box',
'default' => '2',
'dependency' => array('id' => 'my_text_option', 'value' => 'yo')
));

$panel2->createOption(array(
'name' => 'My Text Option 3',
'id' => 'my_text_option_3',
'type' => 'text',
'desc' => 'This is our option',
'dependency' => array('id' => 'my_select_option', 'value' => '1')
));
```

see how dependency parameter is added in each of these fields. I have also added necessary javascript which
perform the validation. Works fine for all containers.