function isotope_get_config_json in Isotope (with Masonry and Packery) 7.2
Convert the name of a config into a JSON representation.
Style as per http://isotope.metafizzy.co/#initialize-in-html.
1 call to isotope_get_config_json()
- theme_isotope_grid in ./
isotope.module - Default theme implementation for the grid.
File
- ./
isotope.module, line 126 - Load the isotope library and provide configuration and theme options.
Code
function isotope_get_config_json($config, array $additional_attributes) {
ctools_include('export');
$plugin = ctools_export_crud_load('isotope_configurations', $config);
if (empty($plugin)) {
return drupal_json_encode(array());
}
// Properties that should be passed directly to isotope.
$allowed_attributes = array(
'layoutMode',
'transitionDuration',
'urlFilters',
'isFitWidth',
'isHorizontal',
'stamp',
'horizontalAlignment',
'verticalAlignment',
'isOriginLeft',
);
// Default attributes.
$attributes = array(
'columnWidth' => '.isotope-grid-sizer',
'itemSelector' => '.isotope-element',
'gutter' => '.isotope-gutter-sizer',
) + $additional_attributes;
foreach ($plugin as $key => $value) {
if (in_array($key, $allowed_attributes)) {
$attributes[$key] = $value;
}
}
return drupal_json_encode($attributes);
}