View source
<?php
function panels_bootstrap_layout_builder_requirements($phase) {
$requirements = array();
$t = get_t();
$requirements['panels_bootstrap_layout_builder'] = array(
'title' => $t('Panels Bootstrap CSS'),
);
$path = libraries_get_path('bootstrap');
$css_path = $path . '/css/bootstrap.min.css';
if ($path && file_exists($css_path)) {
$requirements['panels_bootstrap_layout_builder']['value'] = $t('Exists');
$requirements['panels_bootstrap_layout_builder']['severity'] = REQUIREMENT_OK;
}
else {
$requirements['panels_bootstrap_layout_builder']['value'] = $t('Not Found');
$requirements['panels_bootstrap_layout_builder']['severity'] = REQUIREMENT_INFO;
$requirements['panels_bootstrap_layout_builder']['description'] = $t('The %css file does not exist. Either your admin theme is bootstrap or you will need to <a href="@tb">download bootstrap</a> to /sites/all/libraries/bootstrap.', array(
'%css' => $css_path,
'@tb' => url('http://getbootstrap.com/'),
));
}
return $requirements;
}
function panels_bootstrap_layout_builder_permission() {
return array(
'administer layouts' => array(
'title' => t('Administer bootstrap layouts'),
'description' => t('Administer backend settings for bootstrap layouts.'),
),
);
}
function panels_bootstrap_layout_builder_ctools_plugin_directory($owner, $plugin_type) {
if ($owner == 'panels' && $plugin_type == 'layouts') {
return "plugins/{$plugin_type}";
}
}
function panels_bootstrap_layout_builder_ctools_plugin_api($owner, $api) {
if ($owner == 'panels' && $api == 'layouts') {
return array(
'version' => 1,
);
}
}
function panels_bootstrap_layout_builder_menu() {
$items = array();
$items['admin/structure/panels/settings/bootstrap'] = array(
'title' => 'Bootstrap',
'description' => 'Panels Bootstrap Layout Builder settings',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'panels_bootstrap_layout_builder_admin_settings_page',
),
'type' => MENU_LOCAL_TASK,
'access arguments' => array(
'use panels dashboard',
),
);
return $items;
}
function panels_bootstrap_layout_builder_admin_settings_page() {
$form = array();
$form['panels_bootstrap_grid_size'] = array(
'#type' => 'textfield',
'#title' => t('Grid Size'),
'#description' => t('By default this is 12. Changing this value does not update your css.'),
'#default_value' => variable_get('panels_bootstrap_grid_size', 12),
'#size' => 2,
'#maxlength' => 2,
'#required' => TRUE,
);
return system_settings_form($form);
}