Skip to content

Instantly share code, notes, and snippets.

@objectivehtml
Last active December 17, 2015 17:18
Show Gist options
  • Select an option

  • Save objectivehtml/5644553 to your computer and use it in GitHub Desktop.

Select an option

Save objectivehtml/5644553 to your computer and use it in GitHub Desktop.
public function zenbu_field_extra_settings($table_col, $channel_id, $extra_options)
{
$this->EE->load->add_package_path(PATH_THIRD . 'photo_frame');
if(!class_exists('InterfaceBuilder'))
{
require_once(PATH_THIRD . 'photo_frame/libraries/InterfaceBuilder/InterfaceBuilder.php');
}
$fields = array(
'min_proximity' => array(
'label' => 'Min Color Proximity',
'description' => 'This is the minimum color proximity. The color proximity is the value used to determine if a particular color is in the same proximity of the color being searched. The smaller the number the closer to an exact match the colors must be. Increase the number to make the search less strict. The default value is <b>0</b>.<br><br>Use the following equation to figure out the best threshold for you.<br><b>(R - Ri)^2 + (G - Gi)^2 + (B - Bi)^2</b>',
),
'max_proximity' => array(
'label' => 'Maximum Color Proximity',
'description' => 'This is the maximum color proxmity. The color proximity is the value used to determine if a particular color is in the same proximity of the color being searched. The smaller the number the closer to an exact match the colors must be. Increase the number to make the search less strict. The default value is <b>12,000</b>.<br><br>Use the following equation to figure out the best threshold for you.<br><b>(R - Ri)^2 + (G - Gi)^2 + (B - Bi)^2</b>',
),
'min_color_depth' => array(
'label' => 'Minimum Color Depth',
'description' => 'The color depth allows you to choose how many colors to search. This settings allows you to define the minimum depth to search. The default is <b>0</b>.',
),
'max_color_depth' => array(
'label' => 'Maximum Color Depth',
'description' => 'The color depth allows you to choose how many colors to search. For instance, by default Photo Frame indexes the 8 most used colors in a photo. This settings allows you to define the maximum depth to search. The default is <b>3</b>.',
)
);
$data = array();
$count = 1;
foreach($fields as $field_name => $field)
{
// 'settings['.$channel_id.']['.$table_col.'][matrix_option_1]'
$field_name = 'settings['.$channel_id.']['.$table_col.'][' . $field_name . ']';
$vars = array(
'label' => $field['label'],
'description' => $field['description'],
'field' => InterfaceBuilder::field($field_name, $field, $extra_options)->display_field(),
'first_row' => count($fields) == 1 ? TRUE : FALSE,
'last_row' => count($fields) == $count ? TRUE : FALSE
);
$data[$field_name] = $this->EE->load->view('zenbu_settings', $vars, TRUE);
$count++;
}
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment