Get the resource hint settings for the preload attribute.
Paramètres
bool $return_defaults: Default FALSE, TRUE returns the default values.
Return value
array Ordered 2 dimensional array.
3 calls to advagg_get_resource_hints_preload_settings()
- advagg_add_preload_header dans ./
advagg.module - Add in the preload header for CSS and JS external files.
- advagg_admin_settings_form dans ./
advagg.admin.inc - Form builder; Configure advagg settings.
- advagg_set_admin_form_defaults_recommended dans ./
advagg.module - Save form defaults or recommended values.
Fichier
-
./
advagg.module, line 5532
Code
function advagg_get_resource_hints_preload_settings($return_defaults = FALSE) {
$sub_defaults = array(
'enabled' => 1,
'push' => 0,
'local' => 1,
'external' => 1,
);
// Collect your data.
$advagg_resource_hints_preload_settings_defaults = array(
'style' => $sub_defaults + array(
'#weight' => -10,
'title' => t('CSS Files'),
),
'font' => $sub_defaults + array(
'#weight' => -9,
'title' => t('Font Files'),
),
'script' => $sub_defaults + array(
'#weight' => -8,
'title' => t('JS Files'),
),
'svg' => $sub_defaults + array(
'#weight' => -7,
'title' => t('SVG Files'),
),
'image' => $sub_defaults + array(
'#weight' => -6,
'title' => t('Image Files'),
),
'all_others' => $sub_defaults + array(
'#weight' => -5,
'title' => t('All Other Files'),
),
);
if ($return_defaults) {
return $advagg_resource_hints_preload_settings_defaults;
}
$advagg_resource_hints_preload_settings = variable_get('advagg_resource_hints_preload_settings', $advagg_resource_hints_preload_settings_defaults);
// Merge in defaults.
foreach ($advagg_resource_hints_preload_settings as $id => &$entry) {
if (isset($advagg_resource_hints_preload_settings_defaults[$id])) {
$entry += $advagg_resource_hints_preload_settings_defaults[$id];
}
ksort($entry);
}
unset($entry);
// Sort the rows.
uasort($advagg_resource_hints_preload_settings, 'element_sort');
return $advagg_resource_hints_preload_settings;
}