Error message

User warning: The following theme is missing from the file system: responsive_green. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1143 of /var/www/moscovie.com/includes/bootstrap.inc).

Drupal 7

Переадресация формы на другую страницу и вывод данных на ней Drupal7

function mymodule_menu() {
$items['accumulators'] = array(
'title' => 'Accumulators',
'page callback' => 'mymodule_page',
'access arguments' => array('access content'),
);

return $items;
}

function mymodule_page() {
$output = drupal_get_form('mymodule_form');
return $output;
}

The code has been tested and works

Исправляем ошибку Warning: file_put_contents(temporary://

Создаем папку tmp в корне
Редактируем file.inc
Очищаем кеш

function file_unmanaged_save_data($data, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
// Write the data to a temporary file.
$temp_name = drupal_tempnam('temp/', 'file');
if (file_put_contents($temp_name, $data) === FALSE) {
drupal_set_message(t('The file could not be created.'), 'error');
return FALSE;
}

The code has been tested and works

Программная авторизация Drupal

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$user = user_load(1);

if ($user) {
$edit = (array)$user;
list($major_version, ) = explode('.', VERSION);
if ($major_version == '6') {
user_authenticate_finalize($edit);
}
elseif ($major_version == '7') {
user_login_finalize($edit);
}

The code has been tested and works

Темизация форм Drupal 7

form


1 - theme_form()
1 - $form['#theme'][] = 'namefunction_form';
2 - theme_form_element()
3 - theme_form_element_label()
4 - theme_namefunction_field() //Переопределенный элемент

//Темизация формы на примере изменения формы регистрации, Регистрируем функцию формы для всей формы и для поля name
function mymodule_theme() {
return array(
'namefunction_field' => array(

The code has been tested and works

Исправление глюка с нераскрывающимся меню(main menu - show expanded)


function mytheme_links__system_main_menu($variables) {
$menu_name = variable_get('menu_main_links_source', 'main-menu');
$menu_tree = menu_tree($menu_name);
return drupal_render($menu_tree);
}

ПЕРЕПРОВЕРИТЬ ---- НЕ РАБОТАЕТ

РАБОЧИЙ ВАРИАНТ!!

function MYTHEME_menu_tree__main_menu($variables) {
return '

';
}

The code has been tested and works

Програмный вызов модального окна в Drupal7 через javascript

The code has been tested and works

Переопределение Local Task

Задача - необходимо переопределить свойства ссылок выведенные в табах

function MYTHEME_menu_local_tasks_alter(&$data, $router_item, $root_path) {
$tab1 = &$data['tabs'][0]['output'][1];
$tab1['#link']['localized_options']['attributes']['class'][] = 'tab1';
}
}

The code has been tested and works

Работа с базой данных в Drupal 7

Выборка с условием:

// Drupal 6
$nodes = db_query("SELECT nid, title FROM {node} WHERE type = '%s' AND uid = %d", 'page', 1);

// Drupal 7, вариант 1
$nodes = db_query("SELECT nid, title FROM {node} WHERE type = :type AND uid = :uid", array(':type' => 'page', ':uid' => 1));

The code has been tested and works

Pages

Subscribe to RSS - Drupal 7