Outside Links collection sticky icon

Sometimes you find just the right resources that fulfill certain need and nothing much should be added to them, in those cases I will just collect them on this page and add short comment why is this so.

How to combine Git and Drush to have perfect workflow for site maintenance, information and examples are here
http://www.jenlampton.com/blog/keeping-your-drupal-site-date-git-and-drush

Setting upt perfect Git + Drush workflow, read here
http://www.acquia.com/blog/using-git-drush-win-workflow

Advanced modal forms - modal windows with CTools (singe and multistep)

So I client of mine wanted to use popups :) but not just ordinary popups, he wanted to put there, login, registration, node adding, notificiations, user invites for OG, simple menus and even FB login and registration. We also needed to save some user choices before the login/registration and act upon them after the user logs in. So spoiler alert now "if you want to save budget and time" dont't use modal windows or any popups for complex workflows.

Fixing some fatal errors

Recently I got to fix some older Drupal 6 site. It had WSOD so I needed to add this to index http://drupaldump.com/wsod-or-white-screen-death-and-error-reporting and then I saw sort of this error "Fatal error: Unsupported operand types in common.inc" so I used this post https://www.drupal.org/node/362799 and added this code to the "l" function, and solved this bugger.

if (!is_array($options)) {
echo " "; $backtrace = debug_backtrace(); var_export($backtrace[0]); die(); }

Cool login/register screens, without overlays - no regions, just content

As subject tries do describe, to build cool login screens that are popular now and you can find them on sites such as
https://www.icloud.com/ and https://app.buzzsumo.com/login you need to remove all the data from a page and just have content.

Other way you could do this is also with an overlay kind of module, like modal window from CTools or just use modal forms module or some other pop up module. But as I prefer not to use them and have a page that looks like overlay but basically is a content only page we are going to do that now.

Load another node after CTools modal window is submited

Continuing from http://drupaldump.com/ctools-modal-window-return-message-same-modal-window we can also do some more stuff after one modal is submited, we can load another content in it. For example a whole node, we just need to load it and then render it properly. Problem you can encounter is that you will need to change the modal size

if ( $form_state['submitted']){

$output = array();
$node = node_load(7);

// Content for modal window:
$contents = render(node_view($node, 'full', NULL));

CTools modal window, return message in the same modal window

I wanted to have a confirmation message in modal window, instead of closing the modal and having it on normal page. All that is needed is to check form_state after submit and add this part of code in form function

function my_module($form, &$form_state)
{
$form = array();
....

if ( $form_state['submitted']){
$output[] = ctools_modal_command_display('Success', '

');
print ajax_render($output);
exit;
}
return $form;
}

and you will have this message in modal window.

p.s.

Views and custom dynamic titles for pages set with fields values or anything else

By default you can't set dynamic titles for views other than using contextual filters and using them to change title, this will sometimes help and sometimes you want to use something else, so custom modules/overrides to the rescue. There is also a page title module but you can use tokens with it and seems it doesnt work now. So use one of this 2 hooks and you will have plenty of info to choose from to set your title. You can use field values, or any other part of view and just put it into title. Here are 2 examples I used and both of them work fine.

Insert something every nth row in Views

Most likely you will want to insert an ADD, probably adsense add every nth row in views. To do that there are 3 methods. One of them is a module a guy made that acts as global filed you add and then you enter what goes in there, problem is that JS code doesnt work there as it is html only field, so some custom formatters should be added. 2 other methods are more straightforward, you just edit the template file and add code there every nth row or you make a view override and on creation of view add a line of code, it can be a node or something else. Here is the list of them with links

Remove/hide Vertical tabs on node edit forms

Node edit forms are not the nicest thing you have seen and new layouts in Drupal 8 that basically copies wordpress style forms are much better. Sometimes you will have clients that can't stand this vertical tabs and would rather not have them at all and probably they will never use them anyway. So best thing to do is to remove them for them. Just add this to your module, which will hide them for them and for user 1 you will still see them.

function custom_form_node_form_alter(&$form, &$form_state) {
global $user;

if ($user->uid != 1){

Rules, action for first time logged in user

If you want to have an action happen on user who logs in first time and logs in right after the registration, without email verification. You can use the event "After saving a new user account" problem here is the in conditions you will not have any data about the current logged in user, as he will be logged in after that. So even if you check global $user it looks like the anonymouse user.