drupal 7: How to altering Webform components?

function YourThemeName_form_alter( &$form, &$form_state,$form_id ){
// information about structure of the form array
dpm($form);

// show details about component name
dpm($form[‚submitted’][‚name’]);

// limit altering to specific form
if ($form_id == ‚webform_client_form_133’) {
$form[‚submitted’][‚name’][‚title’] = ‚Title’;
$form[‚submitted’][‚name’][‚#prefix’] = ‚

‚;
$form[‚submitted’][‚name’][‚#suffix’] = ‚

‚;
$form[‚submitted’][‚name’][‚#field_suffix’] = ‚suffix’;
}
}

Drupal 7: How to install drupal core?

CONFIGURE VIRTUALHOST
1. Create directory for drupal
[root@localhost] cd /home/robert/website/
[root@localhost] mkdir drupal

2. Edit vhosts file
[root@localhost] vi /etc/hosts
3. Add line at the end of the file
127.0.0.1 drupal.dev

4. Add vhost
[root@localhost] cd /etc/apache2/sites-available/
[root@localhost] cp default drupal.dev
[root@localhost] vi drupal.dev


ServerAdmin webmaster@localhost
ServerName drupal.dev
DocumentRoot /home/robert/websites/drupal

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/drupal-error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/drupal-access.log combined

Alias /doc/ „/usr/share/doc/”

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

5. Enable drupal.dev
[root@localhost] a2ensite drupal.dev

6. Restart apache2
[root@localhost] /etc/init.d/apache restart

INSTALL DRUPAL AND SET FILE PERMISSIONS
1. On Linux server download the latest version of Drupal.
wget http://ftp.drupal.org/files/projects/drupal-7.26.tar.gz

2. Untar the file
tar zxf http://ftp.drupal.org/files/projects/drupal-7.26.tar.gz

3. Create files directory
[root@localhost] cd /path_to_drupal_installation/sites/default
[root@localhost] mkdir files

4. Copy default.settings.php to settings.php
[root@localhost] cp default.settings.php settings.php

5. Change permission of the directories and files
https://drupal.org/node/244924

[root@localhost] cd /path_to_drupal_installation
[root@localhost] chown -R robert:www-data .
[root@localhost] find . -type d -exec chmod u=rwx,g=rx,o= ‚{}’ \;
[root@localhost] find . -type f -exec chmod u=rw,g=r,o= ‚{}’ \;

[root@localhost] cd /path_to_drupal_installation/sites
[root@localhost] find . -type d -name files -exec chmod ug=rwx,o= ‚{}’ \;
[root@localhost] for d in ./*/files
do
find $d -type d -exec chmod ug=rwx,o= ‚{}’ \;
find $d -type f -exec chmod ug=rw,o= ‚{}’ \;
done

6. Add write permission for www-data to the settings.php file.
[root@localhost] chmod g+w settings.php

CREATE DATABASE

INSTALL DRUPAL
1. Go to your favorite browser and add slash at the end of website address
drupal.dev/

2. Fill the form
Database: drupal
Database username: drupal
Database password: drupal
ADVANCED OPTIONS
Database host: localhost

Drupal: Translate name and slogan

To translate site name and slogan in Drupal 7 you should install the i18n modules pack and enable the „Variable translation” module.

1. Configuration -> Multilingual settings -> Variables (tab) -> Site information (tab) -> enable the corresponding options.
2. Configuation -> System -> Site information -> set the site name and slogan for each language.

Drupal 7, php: Multilanguage Link on the FrontPage

1) Add code to your page-front.tpl.php file.

[sourcecode language=”php”]<?php print l(t(‚More’), ‚link-to-page’); ?>[/sourcecode]

Add class to Link
[sourcecode language=”php”]<?php print l(t(‚More’), ‚link-to-page’, array(‚attributes’ => array(‚class’ => array(‚class-1′,’class-2’)))); ?>[/sourcecode]

Add span to Link
[sourcecode language=”php”]<?php print l(‚<span>’ . t(‚More</span>’) . ‚</span>’, ‚link-to-page’, array(‚html’ => TRUE)); ?>[/sourcecode]

Add button to Link
[sourcecode language=”php”]<?php print l(‚<button>’ . t(‚More</span>’) . ‚</button>’, ‚link-to-page’, array(‚html’ => TRUE)))); ?>[/sourcecode]

2) Go to link-to-page and translate Page to other languages (en/link-to-page, pl/link-do-strony). Then drupal automaticly redirect link from one language to another.
en/link-to-page -> pl/link-do-strony

3) Go to Menu, find and translate ‚More’ text to other languages.
admin/config/regional/translate/translate

Drupal 7: add span to Main Menu Title

Add below code to template.php file in your Drupal 7 theme folder /sites/all/themes/zurb/template.php.

[sourcecode language=”php”]
function zurb_links__system_main_menu(&$vars) {
foreach ($vars[‚links’] as &$link) {
// do what you need here…
$link[‚title’] = ‚<span>’ . $link[‚title’] . ‚</span>’;
$link[‚html’] = TRUE;
}
return theme_links($vars);
}
[/sourcecode]

Remove default message from front page

I found 8 options how to remove default message from a front page.

1) Module unwelcome [D6]
a) install drupal module unwelcome
b) enable module

2) Create page [D6/D7]
a) create a new page with URL „home”
b) go to admin/settings/site-information
c) put the url alias „home” to „Default front page”

3) CSS file [D6][D7]
a) edit your css file
#first-time { display: none; }

4) page-front.tpl.php [D6] / page–front.tpl.php [D7]
a) create „file page-front.tpl.php” in folder „templates”
b) remove from the file region $content

5) Change page.tpl.php [D6][D7]
Change this line
[php]<?php if ($title): ?>[/php]
into this line
[php]<?php if ($title && !drupal_is_front_page()): ?>[/php]

Example:
[php]<?php if ($title && !drupal_is_front_page()): ?>
<h1 class="title" id="page-title"></h1>[/php]

6) Change page.tpl.php [D7]
Add this line [php]<?php if(drupal_is_front_page()) {unset($page[‚content’][‚system_main’][‚default_message’]);} ?>[/php] before this line [php]<?php print render($page[‚content’]); ?>[/php]

Example:
[php]<?php if(drupal_is_front_page()) {unset($page[‚content’][‚system_main’][‚default_message’]);} ?>
<?php print render($page[‚content’]); ?>[/php]

7) Add Views [D6][D7]
a) Add new VIEWS
b) Add page View
b) set page URL to „home”
c) go to Site information
d) type „home” in front page section

8) Edit template.php [D7]
a) edit your template.php file
b) add below code

[php]function nameofyourtheme_preprocess_page (&$vars, $hook) {
unset($vars[‚page’][‚content’][‚system_main’][‚default_message’]);
}[/php]

c) if doesn’t work just clear cache in admin/performance

CKEditor could not be detected in Drupal 7

I method
Edit file in /sites/all/modules/wysiwyg/editors/ckeditor.inc
before:
/*
if (preg_match(‚@version:\’)(?:CKEditor )?(\w\.]+)(?:.+revision:\'([\w]+))?@’, $line, $version))
*/

after:
/*
if (preg_match(‚@version:[\’\”](?:CKEditor )?([\d\.]+)(?:.+revision:[\’\”]([\w]+))?@’, $line, $version))
*/

2 method
Edit file in /sites/all/libraries/ckeditor/ckeditor.js

before:
/*
Copyright (c) 2003-2012, CKSource – Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

after:
/*
Copyright (c) 2003-2012, CKSource – Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
version:’CKEditor 4.1 SVN’,revision:’769d961112
*/

Version and revision details you will find at the beginning of js code: var b={timestamp:”…”,version:”4.1„,revision:”769d961112„…

Reload the wysiwyg profile page (admin/settings/wysiwyg/profile).

Error in Drupal 7 – Notice: unserialize() [function.unserialize]: Error at offset X of Y bytes in variable_initialize()…

Search error in database.
a) replace Y with the number from your error message,
b) identify the name of variable causing the issue,
c) replace NAME in the SQL query.

SELECT name, LENGTH( value ) , value
FROM variable
WHERE LENGTH( value ) = Y

DELETE FROM variable WHERE name = 'NAME'

Migracja CCK z Drupal 6 do Drupal 7

Wiele, ale nie wszystkie funkcje CCK są teraz częścią rdzenia Drupala 7. Niektóre funkcje wymagają instalacji nowych modułów dla wersji 7.

1) Przeprowadź upgrade Drupal 6 do Drupal 7
2) Ściągnij i włącz moduł CCK w najnoweszej wersji dla Drupal 7
3) Ściągnij i włącz moduł Content Migrate w najnoweszej wersji dla Drupal 7
4) Ściągnij i włącz potrzebne moduły w wersji 7.
Node reference (D6) and User reference (D6) -> References module (D7)
Node reference (D6) and User reference -> Entity Reference (D7)
Content permissions (D6) -> Field Permissions module (D7)
Field Groups (D6) -> Field Group module (D7)
Link module (D7). Po włączeniu tego modułu uruchom update.php.

5) Wyczyść cache
6) Idź do Structure > Migrate Fields (/admin/structure/content_migrate).
7) Zaznacz chceckbox przy wszystkich dostępnych polach, które chcesz migrować.
8) Naciśnij przycisk Migracja
9) Po zakończonym procesie zobaczysz podsumowanie dla każdego migrowanego pola.

Źródło: http://drupal.org/node/1144136