texts:
I'd like to display the # (count) of Blogs on my quick tab menu. Ex: Blogs (3)

I found a way to overwrite the quicktab titles using the following function with an if statement

   function mymodule_quicktabs_alter($quicktabs) {
if ($quicktabs->machine_name == 'quick_tab_front_page') {
$quicktabs->tabs = array(
  0 => array(
    'machine_name' => 'quick_tab_blogs',
    'title' => 'BLOGS',
    'weight' => '-100',
    'type' => 'qtabs',
  ),
  1 => array(
    'machine_name' => 'quick_tab_news',
    'title' => 'NEWS',
    'weight' => '-89',
    'type' => 'qtabs',
  ),
);
$quicktabs->renderer = 'quicktabs';
$quicktabs->style = 'Arrows';
$quicktabs->options = array();
}
}

I created a view, using the Views module, which contains all the blog titles written by a user.

Now I need to figure-out a way to display the views' count on the quick tab title

I have tried

function mymodule_quicktabs_alter($quicktabs) {
    $view = views_get_view('user_blogs');
    $view->set_arguments(array($account->uid));
    $view->execute();
    $count = count($view->result);
if ($quicktabs->machine_name == 'quick_tab_front_page') {
$quicktabs->tabs = array(
  0 => array(
    'machine_name' => 'quick_tab_blogs',
    'title' => t('Blogs @count', array('@count' => $count));

but it gives me an error of Fatal error:  Call to a member function execute() on a non-object for the line $view = views_get_view('user_blogs');

I don't get why, I am new to php.


texts: How to enable Administration menu Toolbar style for editor profile?

texts:
I have created an Editor profile which can create specific content types. However, I would like to give such users the possibility of using the Administration menu Toolbar style (i.e. overlays) rather than the default page display.

Is this possible? If yes, how? Thanks.


texts: D8 - how to group view by paragraph term reference parent

texts:
I can't group view results by a taxonomy term's parent...

I have a content type of plant, with "field_plant_locations", referencing the paragraph type, "plant_locations". In this paragraph, I have a term reference field (field_location) to a "locations" taxonomy.

I've created a plant view. In it, I have a contextual filter to the Plant node ID. I've added all sorts of relationships trying to get to the taxonomy parent. Currently: field_location
field_plant_locations: Paragraph
(field_plant_locations: Paragraph) field_location: Taxonomy term
(field_location: Taxonomy term) Parent
(Parent) Parent

I've rearranged, I've tried to change relationships, I've tried getting the parent. I can't seem to find where to get that parent term. The closest 'parent' I can find is the field parent. I don't see anything letting me get Taxonomy parent.

So I get the plant field as a parent:

Field_plant_locations:
Spain, England, Germany, Alabama

I want to be able to group by location parents/grandparents to get a result like this:

Europe:   Spain, England, Germany
North America:   U.S.: Alabama


texts:
I have a site that is running on drupal 7 and uses civicrm 4.4.1. I need the events to be included in the search results.

So far all I have found was dated documentation on civicrm that required modules that are not available for Drupal 7.

I also tried the search page module and it is not grabbing the events.


texts: How to exposed custom profile fields in views

texts:
The custom fields were created using a custom form in a module, not user entities or Profile2.

How can I expose these fields to views? My goal is to allow an admin to filter users by exposing those custom fields.

Here's the function that creates the custom profile form:

function mymodule_profile_form($form, &$form_state, $account) {
[...]
//
// Basic Info
//
$form['fs_basic'] = array(
  '#title' => 'Basic Info',
  '#type' => 'fieldset',
  '#prefix' => '
',
);

$form['fs_basic'][SOME_SF_CONTACT_FIRSTNAME] = array(
  '#title' => 'First Name',
  '#type' => 'textfield',
  '#default_value' => $contact[SOME_SF_CONTACT_FIRSTNAME],
 );
$form['fs_basic'][SOME_SF_CONTACT_LASTNAME] = array(
  '#title' => 'Last Name',
  '#type' => 'textfield',
  '#default_value' => $contact[SOME_SF_CONTACT_LASTNAME],
);
$form['fs_basic'][SOME_SF_CONTACT_MIDDLENAME] = array(
  '#title' => 'Middle Name',
  '#type' => 'textfield',
  '#default_value' => $contact[SOME_SF_CONTACT_MIDDLENAME],
);
$form['fs_basic'][SOME_SF_CONTACT_SUFFIX] = array(
  '#title' => 'Suffix',
  '#type' => 'textfield',
  '#default_value' => $contact[SOME_SF_CONTACT_SUFFIX],
);
//
// Profile Info
//
$form['fs_profile'] = array(
  '#title' => 'Profile',
  '#type' => 'fieldset',
  '#prefix' => '
',
);
$form['fs_profile']['name'] = array(
  '#title' => 'Username',
  '#type' => 'textfield',
  '#default_value' => $account->name,
  '#maxlength' => 20,
);
[...]
$form['submit'] = array(
  '#value' => 'Submit',
  '#type' => 'submit',
  '#attributes' => array('class' => array('btn btn-primary align-left push-
down')),
);

$form['#validate'][] = 'user_account_form_validate';
$form['#validate'][] = 'user_validate_picture';
$form['#validate'][] = 'user_profile_form_validate';
$form['#validate'][] = 'mymoduler_profile_form_validate';
$form['#submit'][] = 'mymodule_profile_form_submit';
// Add the final user profile form submit handler.
$form['#submit'][] = 'user_profile_form_submit';

  return $form;
}

I want to be able to expose the Last Name in Views to I can allow an admin to search.


texts: Is it possible to export all block's region settings to Features?

texts:
I'm about use Features to deploy all configuration of my Drupal (7) site.

Now I'm wondering if there is a way to export the entire settings for block to region assignment without having to export all blocks into one big feature.

One big feature containing all blocks would create conflicts with other, more atomic feautures. Even worse, it seems only blocks that have a region assigned seem to be exportable, so I can't figure out yet how to export my defintions of disabled blocks. For example: I move a previously displayed block to the disabled region - is there a way to deploy this setting to remove the block on the staging site, too?


texts: Change a multiple value field to use divs instead of a table in node/add?

texts: I have the # of values set to 10, which I want to put in 2 columns of 5 each, but I don't know how to change the table structure to accomplish this, or perhaps preferably, just change it to use divs so I do it with css.


texts:
I have a website at mydomain.com. I am creating a clone of it on mydomain2.com. The only difference is that I want the landing pages to be different. Both domains are running the same codebase.

How do I make the landing page differ, depending on what domain you are on?

(Note: Without using i18n)


texts: How do I create a variable that my page.tpl.php file can access?

texts:
In Drupal 7, I have a module that implements hook_node_load. It creates a variable that I'd like to make use of in my page.tpl.php file. Let's pretend it is the count of nodes that are of the same type as the currently loaded node. As of now, I'm just making the variable global, like so:

global $node_count;
$node_count = db_query("SELECT count FROM {node} WHERE type = :type", array(":type" => $node->type"))->fetchAll()[0]->count;

Then, within my page.tpl.php file, I have to do something like the following:

global $node_count;
echo "<p>$node_count</p>";

I know that there is a way to make my $node_count variable in scope, in the same way that $node or $user are. The tutorials I find on the subject seem to involve rewriting the entire theme function - I'm not trying to do anything that complicated. Is there a simple way to just make this variable in scope in my .tpl.php files? Something like a function?


texts: How can I remove the header n the node/add/[content_type] pages

texts:
I have a content type 'Numbers' and on the node/add/numbers page there is a header that says 'Create Numbers.'

I would like to remove this header from the page. I've searched in node.tpl.php with no success. I'm thinking that this is a job for a HOOK_form_alter() but I'm not sure what needs to be altered in the form.


texts: Search taxonomy terms with node_search_execute()

texts:
I tried to use node_search_execute() to search nodes. So far, running the function is easy. I noticed that there was a $conditions parameter from the documentation of hook_search_execute().

Is there a way to extend the search function to also search for taxonomy terms?
Simple friendly pointers to guide me to do fast and complete node search are also welcomed.


texts:
I have create a template for user-register page

I have created a module under hook_form_alter as

if($form_id == 'user_register_form') {

            $form['account']['pass']['#type'] = 'password';
            $form['account']['pass']['#title'] = 'Password';
            $form['account']['mail']['#title'] = 'Email';
            $form['actions']['submit']['#value'] = 'Request Access';
             $form['#theme'] = 'user_register';

    }

Edited:

  function custom_user_register_form_validate($form, &$form_state) {

        if($form_state['input']['field_first_name']['und'][0]['value'] == ''){
            form_set_error('field_first_name', t('Email can not be empty'));
        }
          drupal_set_message($message, 'error');

     if($form_state['input']['field_last_name']['und'][0]['value'] == ''){
        form_set_error('field_last_name', 'Title cannot be "test"');
         drupal_set_message($message, 'error');
     }

                return $form;
    }

And i have created a user-regiter.tpl.php file

under this i have code like this

 <?php print drupal_render($form['field_first_name']); ?>
<?php print drupal_render_children($form); ?>

Which is working fine

Now when i submit form. it doesnt display error message . But it is showing red border in input box.

Why it is not showing error message . Please help

Thanks


texts: Workbench: Allow users to publish revisions without moderation

texts:
I want to be able to moderate authors who create new nodes, but allow authors to update their existing nodes without moderation. It's not immediately obvious to me how to do this in Workbench.

It seems like I should be able to set up a Rule that will basically have

Event: After updating existing content

Condition: Content's current moderation state is published

Reaction: Set moderation state during save: Published

Something like that. I've tried a lot of combinations, but I can't get it to work.

Also, every time an author saves, it saves as a Draft, which I almost never want. Even though the Default State is set to Needs Review that only applies to new nodes. Revisions of existing nodes are always saved as drafts.

So ideally what I'm trying achieve is this

new nodes default to Needs Review
revisions of existing nodes default to Publised


texts: Strange behavior while assigning the role programmatically

texts:
I used this code to set role to a user :

    user_external_login_register($form_state['values']['name'], 'beneficiaire');
    $account = user_external_load($form_state['values']['name']);
    $form_state['uid'] = $account->uid;
    $account->roles[]= 3;
    user_save($account);

My user is weel registered as admin, but if I logout and login, my user has an empty role in addition of the administrator.

Replacing 3 by administrator does not fix.

Do you have an idea of what's going on?

Thanks.


texts:
Migrate Source

  The migration configuration entity always contains a source key. The
  value is an associative array containing the name of the plugin and
  the configuration of it. Only the plugin key-value pair is mandatory,
  some plugins might not have any configurations.

source:
  plugin: d6_node

Googling I see examples outhere that use d6_node and d7_node but what does one use to migrate nodes from d8 to d8?

Looking at the core/modules/node/src/Plugin/migrate/source folder there is no such thing as d8_node


texts: manipulate form variables before render()

texts:
I have the following line of code in a user-profile-form.tpl.php which Drupal uses to render an input field in the user's edit profile page.

print render($form['field_machine_name']);
// this field can be found in the database table field_data_field_machine_name

The issue is that I want to run the value field_machine_name through a function like $form['field_machine_name'] = make_seo_url($form['field_machine_name']) before I run the render() function.  But this totally breaks the form because $form['field_machine_name'] is some very large array and render() output html input tag instead of the actual field_machine_name itself.

How does one actually go about massaging values in the $form variable before outputting it as an html field in render()?

Additionally, i want to make sure anytime field_machine_name is printed anywhere on the drupal site, i want it to run through the make_seo_url() function.  Is there a global place i can do this?


texts: How to set the "Read More" link (in Rewrite Rules for Body field) to point to the node url instead of the title?

texts:
I have created the blog as a view in Drupal 7.14 site. On my main blog page, I want to show 5 trimmed versions of the posts. I have added the following fields for the main blog page view - Title, Author, Post date, Body. In the Body field, I select the following options in "Rewrite Rules" section - Trim field, add read more text. Btw, I have selected the default format for the body. I add the "More link path" as [title] after referring to the Replacement Patterns.

When I apply the changes, I see that the "Read More" links to the actual title and not the url that is linked to the title. Example, it will create a link "www.mysite.com/My post title" instead of "www.mysite.com/blog/my-post-title".

In the Title field, I have selected the option to link the field to original piece of content.

The same setup worked on my localhost and it is not working on my Joyent server. Am I missing something? I have spent several hours looking at concepts like Pathauto, replacement tokens, etc, but no help.


texts: Prevent Drupal from timing out during a large node export?

texts: Is there a setting to prevent drupal from timing out during long operations?


texts:
According to http://drushcommands.com/drush-6x/user/user-password/ the command

drush user-password someuser --password="correct horse battery staple"

should change a user's password.

I am trying to change the password for user 1, but I get this error message:

-jailshell: !": event not found

I connect via ssh as root, try again, but get this error message:

-bash: !": event not found

Anyone know how I fix this? Using Drush 6.2.0. Thank you.


texts:
When I checked the code I wrote with phpcs --standard=DrupalPractice /path/to/myController, I got the following warning.

  WARNING | Node::load calls should be avoided in classes, use dependency injection instead.

The code I use to load the node is the following.

use Drupal\node\Entity\Node;

public function content_load($node = NULL) {
 $noad_data = Node::load($node, NULL, TRUE);
}

How should I use dependancy injection to load a node?


texts: Sidebar Menu like on Myspace (for each profile)

texts:
I have several content types. Bio, images, videos etc. for each user.
Now i want to have sidebar menu like on Myspace profiles where the menu reacts only to user you are watching.

Is there a module for this or i should use views and how ?


texts: How to dynamically pass a user field value to jQuery?

texts:
I have a notification bar with a counter, it actually prints the user's "notifications" field value (if it's greater than 0):

Activity
<?php
global $user;
$user_fields = user_load($user->uid);
$user_notifications = $user_fields->field_notifications['und']['0']['value'];
if ($user_notifications > 0) {
echo '
'.$user_notifications.'
';
echo '
'.flag_create_link('unmark_notifications', $user->uid).'
';
}
?>

And a jQuery function that resets the value to 0 on click:

    (function ($) {
      Drupal.behaviors.scriptjs =  {
        attach: function(context, settings) {

        $('.activity_link').click(function() {
        $('.activity_menu').toggle();
        $('.blob').fadeOut('normal');
        $('.flag-unmark-notifications .flag-action').click();
        $('.flag-unmark-notifications .unflag-action').click();
    });
    }
   };
  })(jQuery);

The problem is that when a new notification is received you need to refresh the page to see it.

What I've thought to do is to pass the user's "notifications" field to jQuery and update accordingly..

Is this the best way to do it or should I think about using Node JS?

How would you listen for a field value change event and then refresh the counter?


texts: Add scrolling effect to hidden node title

texts:
Here:
http://jsfiddle.net/sdleihssirhc/AYYQe/3/

There is a nice JavaScript code to ellipsize text when it’s too long. On hover, the text  slide to the left,  and show the hidden part.
I’m struggling to make this script work in a view, to ellipsize and show hidden part from node titles.
This is my  View  structure.

[picture]

[title]

this is the CSS I’m using:

#tweet, #tweet_js { border:1px solid red; width:25em; padding:.5em; }
#tweet_js { overflow:hidden; white-space:nowrap; }
.hiding { text-overflow:ellipsis; }

and this is the code:

var tweet = document.getElementById('tweet');
tweet.id = 'tweet_js';
tweet.className = 'hiding';

var slide_timer,
max = tweet.scrollWidth,
slide = function () {
    tweet.scrollLeft += 1;
    if (tweet.scrollLeft < max) {
        slide_timer = setTimeout(slide, 40);
    }
    };

tweet.onmouseover = tweet.onmouseout = function (e) {
e = e || window.event;
e = e.type === 'mouseover';
clearTimeout(slide_timer);
tweet.className = e ? '' : 'hiding';
if (e) {
    slide();
} else {
    tweet.scrollLeft = 0;
}
};

I added the JavaScript file in in the module's .info file using this :

scripts[] = script.js

but nothing is working, I have tested  this JavaScript code in HTML page, and its working  only when placed before  the ending body tag.

(JavaScript and CSS are not mine, they were posted by sdleihssirhc as an answer to this question: https://stackoverflow.com/questions/4755593/css-jquery-powered-sideways-scrolling-text-on-hover )


texts: what security measures should be taken when creating/updating/retrieving entities with data from users' form submissions?

texts:
We have webforms for authenticated users (anyone can create an account without admin approval) to fill out.  With their submission data I'm using the civicrm_api to create contacts and relationships.

For example:

// in hook_webform_submission_insert I do this:
$newcontact= civicrm_api3('Contact', 'create', array(
  'sequential' => 1,
  'contact_type' => 'Organization',
  'contact_sub_type' => 'Sub_Type',
  'organization_name' => $submission->data[20][0],
));

Is there any filtering I should be doing or are Drupal's security measures sufficient?

There are various hooks I could use.  Currently I'm using a combination of hook_form_alter with submit callbacks and hook_webform_submission_insert.  Would one of these or some other hook have significantly greater security measures?


texts: Entity reference field to show translation of nodes

texts:
I have a content type "Genetic Test" which has an entity reference field (select list) where I can select nodes of the content type "Material".
The Material nodes all have English set as their source language, but they are also translated in Dutch and French (entity translation).

The problem I'm having is, when I edit a node of the type "Genetic Test" with the interface language set to English, the select list shows the Material nodes, but when I change the interface language to Dutch or French the list is empty.

So my question is, how do I get the select list to show the Dutch or French node titles of the content type Material when I'm editing the Genetic Test node in said languages?

I hope I made myself clear a bit, English isn't my first language.

Thank you in advance for any help.

BTW: I'm working in Drupal 7.


texts: How can I programmatically display a block?

texts:
I'm developing a site using Drupal 8 beta-14. I've created a view block of different terms and now I want to display it using code. How can I display it programatically?
I used to do it in Drupal 7 using this code but I'm confused about Drupal 8.

$block = module_invoke('block', 'block_view', '4');
$text_block = render($block['content']);


texts: Show block menu links only on certain pages

texts:
I've built a menu with 20 links aprox. Then I put the block drupal creates for my menu on a region. Thing is I want some of the links to show for some pages, while others are hidden, like the option called "visibility options" on admin/structure/block/manage/block/nodenumber/

i.e.:
links 1,2 and 3 should be visible on page node/1
links 1,3 and 5 should be visible on page node/2
links 3,5 and 6 should be visible on page node/3

Any advice on how can I make it possible?

NOTE: Sorry for my english but it's not my native tongue.


texts: Drupal 8 cache failed to generate images

texts:
I set cache max age to 30mins, hosted on VPS without any 3rd party cache driver installed. The problem is sometimes images are not properly generated for images which use image style, but when I flush the cache manually it fixed.

Any solution or probably similar problem? Thanks.


texts: Why does my front page only work in one language?

texts:
I have problem with language of Drupal. When I click in home page in English language, the front page contains all content, nodes and blocks. When I click on other language, the front page doesn't show any contents and shows this message:

  No front page content has been created yet

How can I make 1 front page that contains the same blocks and content and is also translated in different languages?


texts: How to add attributes to menu and menu items on the block level in THEME_preprocess_block()?

texts:
With THEME_menu_tree() we can change the markup of the <ul> element and with THEME_menu_link() we can add css classes to the items of it easely. But what if we have an IF IS IN THIS BLOCK condition to incept?

Not THEME_menu_tree nor THEME_menu_link() know in which block the menues are, they alter, because both will alter all menus known by system.

Two ways came in mind, but both were dead ends: 1) pass a variable from THEME_preprocess_block() to THEME_menu_tree() and THEME_menu_link() -> No, makes no sense. Still, they don't know what to do with it nor can they follow the foreach() of THEME_preprocess_block(), because they have no conditions for blocks. 2) Finding a higher entry level to pass the condition over and alter the menu attributes and its item attributes from there.

Well. Good point. But where would that be? Printing out the $variables inside THEME_preprocess_block() was like counting drops in the ocean. Can someone please enlighten me if I am right with the second thought and with where to look at?


texts: Can any of the cache_* be emptied safely?

texts: Sometimes when moving the database it can be too large. Can any of the "cache_" prefixed tables be emptied without causing problems?


texts: Is it possible to backup created block as a module?

texts:
My question seems pretty simple but is very important: IS it possible or any solution to backup created block as a module to avoid duplication work, because there are times need to do something similar for multiple times and sites.
Like:

Create simple block with social media links, icon and some stable text.
Create a view that show five recent content title of custom content
type as customized block for several sites.
and all repetitive and permanent tasks can be done each time.

Thanks for any help and feedback.


texts:
I am using field_create_field and field_create_instance to create a taxonomy_autocomplete field in a rules action.

Can anyone help me enable chosen by default for these fields?

$vocab = '[vocabulary:machine-name]';

$field = array(
  'field_name' => 'field_termref_' . $vocab,
  'type' => 'taxonomy_term_reference',
  'settings' => array(
    'allowed_values' => array(
      array(
        'vocabulary' => $vocab,
        'parent' => 0
      ),
    ),
  ),
);
field_create_field($field);

$instance = array(
    'field_name' => 'field_termref_' . $vocab,
    'entity_type' => 'node',
    'label' => '[vocabulary:name]',
    'bundle' => 'product',
    'required' => false,
    'widget' => array(
        'type' => 'taxonomy_autocomplete'
    ),
    'display' => array(
        'default' => array('type' => 'hidden'),
        'teaser' => array('type' => 'hidden')
    )
);

field_create_instance($instance);


texts:
I need to delete node for specific Content type without confirm message

function _node_delete_function($node) {
  if ($node->type == 'bills') {
    node_delete($node->nid);
    drupal_goto();
 }
  else {

   return drupal_get_form('node_delete_confirm', $node);
  }
}

Any help?


texts: How can i limit the drop down list of countries in exposed filter?

texts:
I try to use the script https://drupal.org/node/1772498, but I don't get the right db_query for countries in the nodes. I change the script on these line:

$result = db_query("SELECT DISTINCT(l.country) FROM {location} l ORDER BY l.country ASC");

and get the error message:

Notice: Undefined offset: 1 in DatabaseStatementBase->fetchAllKeyed() (line 2180 of E:\xampp\htdocs\testsite\includes\database\database.inc).

It will be great, if somebody can help me!


texts:
I need to output some regions in the html.tpl.php template since these don't change between page.tpl.php and page-front.tpl.php (just to name two). Basically I want to avoid code duplication.

However there seems to be nothing associated with regions in html.tpl.php, nor I could retrieve anything using drupal_get_region_content (both with and without parameters it just returns an empty array).

Ideas?


texts: Choose header content from entity-reference dropdown?

texts:
Been struggling with this for a while... I know there is probably a fairly easy way to accomplish it but I haven't been able to figure it out.

The goal:
When a user creates a new page for the site, I would like them to be able to choose from several different headers using a drop-down list. I know I can set up blocks for the different headers and use the built-in functionality to have them appear on different content types or pages, but for various reasons I would like to have the header as a custom field within the page content type.

I have created a "Header Content" content type and used the Entity Reference module to populate a select list field in the page content type. I can display the selected option or the rendered entity it refers to in the body of my page without any trouble.

What I can't figure out is how to display the rendered entity in the header section instead of the main content.

Put another way: When creating a new page or editing an existing one, the user should be able to select existing nodes from a drop-down list (this part is done). The selected node should show up in the header region (this part is giving me trouble).

I think it could be accomplished in one of two ways:

1) Using Views:
I tried creating a views block to read either the reference or rendered content from the parent page and display it in the header (or wherever I place the block) but I can't seem to get the relationship right.

2) Using a custom module
This seems pretty straightforward but I'm not sure how to reference the value of "field_header" (the name of my custom field using hooks. I'm also not sure if the data will be available if I configure field_header not to display in the configuration.

This seems like a problem that's likely to be solved already. Maybe I'm not phrasing it correctly when I search because I haven't been able to find any examples to help me solve it.


texts: Changing the URL messed up my clients drupal site!

texts:
I have been working on my clients site without a URL so to log in to the server we've been using the "ip address/~henryl"  The client told me to make the site live by transferring over his domain name - nooo problem!  Wait - YIKES! PROBLEM!!  Part of the old URL stayed when I transferred the domain.
I changed the $Base URL in the settings.php, I've commented out sections of the .htaccess - but now I can't even LOG IN to the site to fix the other issues I'm finding.  When I log in, it just drops me back onto the same homepage.  if I change the URL to include the "~henryl/" after the new domain name it does work to show me some back end areas.  I don't know what I've done!!  I ran a search on all my back end files and I can't find "~henryl" in any of the back code - so it has to be in the database somewhere - so obviously there's an option in drupal that I've changed and forgot about... dang!!  Can anyone help??  I really have to fix the issues with my clients site.
The site is www.hayfield.ca and for some reason I have 2 homepages www.hayfield.ca/~henryl

I'd appreciate ANY help!!!

Additional
if I go to: "http://www.hayfield.ca/~henryl/admin/dashboard" it says that the page doesn't exist
if I go to: "www.hayfield.ca/admin/dashboard" it says that I am not authorized to see the page - even though I'm logged in...


texts: Generate unique ID in hook_redirect_form

texts:
I'm trying to write custom payment method for a custom bank gateway (off-site method). bank service expect me to send unique ID for each pay request per bpPayRequest() call.

currently I sending $order->order_id, but its wrong because: if first request fails this orderId is not unique for second bpPayRequest() call. so I should create unique ID which is related to $orders. Is there any commerce way for this question?

$parameters = array(
  ...
  'orderId' => $order->order_id,
  ...
);
$result = $client->call('bpPayRequest', $parameters, $namespace);


texts: Get rendered content of one block created as derivative block

texts:
I have created derivative blocks using a method such as this and want to get the contents of a specific derivative block.

I can see all the available blocks (even derivative blocks) that have been assigned to a region with

 $ids = \Drupal::entityQuery('block')->execute();

but can't see unassigned blocks

I have a feeling that I need to use the code from berdir's answer b)

$variables['block_output'] = \Drupal::service('plugin.manager.block')
   ->createInstance($plugin, $configuration)
   ->build();

but don't know what to use for $plugin or $configuration

any help example will be appreciated


texts:
I'm building a booking calendar module, and want to get back arrival & departure datefields values to highlight reservations on the calendar, passing to a library the variables.

public function showCalendarAction() {
        return [
            '#attached'=> ['library'=> ['my_booking_calendar/my_booking_calendar.popperjs']],
            '#attached'=> ['library'=> ['my_booking_calendar/my_booking_calendar.bootstrap']],
            '#attached'=> ['library'=> ['my_booking_calendar/my_booking_calendar.bootstrap_year_calendar']],
            '#markup'=>$this->t('

')
        ];
    }

I intended to store all the dates(linked to one hotel/house) in a json file, that I would call in ajax.

If it's a good Drupal 8 practice, how to do this ?

Else, what would be the good way to store and pass the variables to my module library ?


texts: How do I filter by date is null in a View

texts:
I have a View of contacts including the date of birth and want to filter by the date not being set.  When I add a filter on the date it provides a range of options (greater than, less than etc), but not one for "is null".

How can I add that?  Is there some configuration or another module to provide this functionality?


texts: Theming certain system block like user cancellation

texts:
I have difficulties in theming user cancellation form (user/%/cancel).

Basically I'm trying to achieve:

add h1 tag
wrap form in a div
add text between the buttons

Although this form has the ID = user-cancel-confirm-form, I can't theme it the same way like User profile page (user/%/edit).

This is what printing $var['block'] at preprocess_block tells me:

stdClass Object
(
    [bid] => 120
    [module] => system
    [delta] => main
    [theme] => mytheme
    [status] => 1
    [weight] => -24
    [region] => content
    [custom] => 0
    [visibility] => 0
    [pages] =>
    [title] =>
    [cache] => -1
    [subject] =>
    [last_in_region] => 1
)

I tried:

mytheme_theme() : nothing happens

'user_cancel_confirm_form' => array(
            'render element'    => 'form',
            'template'          => 'edit-acct-cancellation',
            'path'              => $path . '/templates/edit',
            //'variables' => array('form' => NULL,'form_title' => 'Cancel Account'),
        ),

mytheme_preprocess_block() : affects all block-system-main

if($vars['block']->bid == 120){
        $vars['theme_hook_suggestions'][] = 'block__user__cancel';
    }

UPDATE:

As to date, solution that works is to override the whole page with page--user--cancel.tpl.php But seriously, there must be a better solution (/proper) out there.

Any advise is much appreciated. Thank you in advance.


texts: What's the easiest way of importing content of a custom D6 content type into a D8 site?

texts:
I have a Drupal 6 site with three custom content types. We have tried using the Migrate Drupal UI module to migrate these to our new Drupal 8 site, but this resulted in all of the plain text fields being imported as long text fields (field type string_long when they should be string).

To fix this, I deleted all content of those types, exported the configuration created by the UI module with drush cex and used drush cim to re-import the YAML config files after changing all instances of string_long to string.

After about 3 hours of fiddling with this, I finally had a working D8 configuration with the same fields, forms and views as the original D6 site. Now it's time to migrate the content data across.

I have spent another ~6 hours researching and experimenting on how to do this, having tried the views_data_export and Feeds modules, as well as reading several resources on creating custom migration modules.

The former solution was tedious to set up and the default form for creating a feed type wouldn't allow me to create nodes with the original node IDs. So I tried to step through the code and figure out how to extend the module by myself, since the API documentation is severely outdated. This got me nowhere but extremely tired, confused and frustrated, and about 2 hours closer to my eventual demise.

I'm not even game to try the latter solution, since that would probably be just as hard. So now I've started investigating the DB structure in the hope of writing my own SQL update script...only to discover that there are not only node, node_field_data, node_revision and node_field_revision tables to contend with, but also node__<field_machine_name> and node_revision__<field_machine_name> tables for every defined field (35 of them in my case)!

This seriously can't be this hard! Surely I must be missing some crucial piece of documentation from my Google search results. So what would be the easiest method to accomplish what I want?


texts: Private Files System - Media upload works, but image is not displayed

texts:
I have set default download method in D7 to private. When uploading images, they are stored in the private folder (OS level). But when having a look to content-media, only a placeholder is visible. The image cant be displayed. Any ideas ?

Thanks

Martin


texts:
I have three fields in my node that I'd like to group together with a  tag (so I can center them all next to each other) but I'm not sure how to do this.

The fields are a user photo (the author of the node) a field that just says 'by' and then the 'author name' field.

Right now they look like this:

PHOTO
by
authorname

I could just 'float: left' but I also need to center the whole group on the page so that actually won't work in this case. Hence my need to put them inside a  tag.

Note: I'm also currently trying to use display suite to display my nodes, if that make a difference.

I looked at the display suite tpl file I'm using and frankly it doesn't give me many options other than 'print $ds_content;'

Anyone know how to do this?


texts: Rules action "Send Mail": doesn't work for more than one recipient

texts:
I have installed Rules, Views Rules, Phpmailer.

Test mail works.

In a rule, I have three actions:

1) Send mail to a specific address: it works!

2) Send mail to all users of a role: it doesn't work :(

3) View loop with action "send mail" in a display with a field mail for each row: it doesn't work :(

Rules log just sayss "206.965 ms Evaluating the action mail."

What's wrong?

P.S. Even registration mail doesn't arrive...


texts: Hover a trimmed views field for full text?

texts: I have a text field in a views table which I use the Rewrite results -> Trim this field to a maximum length with ellipsis option on. Is it possible and how, so that when I hover this trimmed text I get the full version as a popup or that the view updates to show the full text?


texts: How to make a particular role user and their content not accessible/viewable to other users?

texts: How do I make the user page (/user/uid) of a particular role (PendingFreelancer) and the content they create not accessible/viewable to other users?


texts: How to remove default div wrappers from fields output via custom field formatter?

texts:
I have a custom field and custom field formatter created in Drupal 8. I need to remove the default FIELD VALUE wrappers so that I can build an HTML table with the field values.

The field formatter is currently using a custom twig template, but I <div>'s are being rendered prior to the template, so I can't remove them there.

How can this be accomplished?


texts: Why do the exposed filters in my view return to previous values after I change them?

texts:
I have a catalogue list organised as a table with 4 exposed filter criteria set up. The page can be found here. An export of the view can be found here.

When a user runs the filter it works fine, but if they change the value of one of the filters and run it again, the search returns the results of the previous search and reverts to the previous value of the filter.

I know that if I enable a 'reset' button and the user resets the search that this works, but it is rather strange that if the user only wishes to change one of the filter criteria and keep the others the same that they cannot. They have to reenter all the criteria again.

Is there a configuration option that I am missing somewhere? I am running Views 7.x-3.0-rc1

Update: I have just noticed that even with the reset button that things do not work as they should.

If I hit 'reset' the query string at the end of the url is removed and the filter text boxes become blank. If I then add new criteria and hit 'apply' the querystring reflects the new filters, but the filter text boxes and the results reflect the original filter values.


texts: Can't make sense of the CSS loading order

texts:
I want bootstrap.css to load first, because it's breaking all of my styles.  Yet, no matter what settings I use in my module, it always loads last.  Every CSS file from a library in my theme loads last.  Using 'base' makes my bootstrap library load before my theme's other libraries, but yet after every other module and theme.  I see no differences between my theme and the core themes, yet core themes are loading first.

Even if I set weights on my CSS files with the { weight: <whatever> } option, it doesn't make the libraries appear before any other theme or module.

I've even tried changing the core.extension config to change the order of the module, to both high and low numbers, in desperation.

All I want is for my theme's library to load first.


texts:
There is a lot of blog posts and tutorial about multi-site with content sharing.

But what about inverse of it? Multi-site with separated contents?

Exactly which tables should be shared?

here is my settings.php for sub-site:

$databases = array(
    'default' =>
    array(
        'default' =>
        array(
            'database' => 'xxx',
            'username' => 'xxx',
            'password' => 'xxx',
            'host' => 'localhost',
            'port' => '',
            'driver' => 'mysql',
            'prefix' => 'default_portal_',
            'prefix' => array(
                'default' => 'default_portal_',
                // Users
                'users' => '',
                'sessions' => '',
                'role' => '',
                'role_permission' => '',
                'authmap' => '',
                'blocked_ips' => '',

                // Blocks
                'block' => '',
                'block_custom' => '',
                'block_node_type' => '',
                'block_role' => '',

                // CKEditor
                'ckeditor_input_format' => '',
                'ckeditor_settings' => '',

                'comment_notify_user_settings' => '',

                // Configuration
                'date_formats' => '',
                'date_format_locale' => '',
                'date_format_type' => '',
                'field_config' => '',
                'field_config_instance' => '',
                'filter' => '',
                'filter_format' => '',
                'i18n_block_language' => '',
                'i18n_string' => '',
                'i18n_translation_set' => '',
                'image_effects' => '',
                'image_styles' => '',
                'languages' => '',
                'locales_source' => '',
                'locales_target' => '',
                'node_type' => '',
                'quicktabs' => '',
                'rdf_mapping' => '',

                // Support
                'support_assigned' => '',
                'support_client' => '',
                'support_priority' => '',
                'support_reference' => '',
                'support_states' => '',
                'support_ticket' => '',
                'support_ticket_comment' => '',

                // System
                'system' => '',
                'taxonomy_term_data' => '',
                'taxonomy_term_hierarchy' => '',
                'taxonomy_vocabulary' => '',
                'variable' => '',
                'variable_store' => '',

                // Views
                'views_display' => '',
                'views_view' => '',

                // WYSIWYG
                'wysiwyg' => '',
                'wysiwyg_user' => '',
            ),
        ),
    ),
);

EDIT

Above configuration works after cache clearing, but some tables should not shared: variable and variable_store because of site_title and site_slogan ...

EDIT

If I share block table, I should enable all themes in main site.

yet I have question to ensure which tables should share?


texts:
I have the Views UI module on my Drupal site, and I would like to enable if but I can't.

How can I enable the Views UI module?

When I try to enable this module by using admin panel I am not able to enable because that

check-box itself disabled and I am not able to check that check-box


texts: Adding rating and commenting to individual fields

texts:
I have a node with a CCK field file upload, which is using the image widget.
This node can have multiple images uploaded to it.

How can I add fivestar rating (or something similar), and comment to these individual pictures? How could I do it with other fields in general?


texts:
I'm using computed field for my content types, but when I used $node, in Display Code, it doesn't display anything :

global $node;
$display_output = l("Apply", "apply_form?job_offer=".$node->nid);


texts: Search api solr deleted terms showing up in facet

texts: Why would taxonomy terms that I have previously deleted show up in my facet? I'm using search api solr. There is no term named "23"; it is a tid, but tid 23 is not in the database yet my facet shows 29 items as being tagged with it. I have flushed cache, run cron, rebuilt index, all multiple times, and don't know what else to do.


texts: How can I add a "group member" field to my Organic Group content type?

texts:
I want to create a content type called “task” that includes a field that is a select list of all members in the group.  The person creating the content should be able to select the group member that the task is “assigned to”.

When I try to create this using an entity reference field, I select “target type = user” and “mode = simple (with optional filter by bundle)”.  The field doesn’t show up when creating content here.  Instead the error message is displayed: Field Assigned to is a group-audience but its Entity selection mode is not defined as "Organic groups" in the field settings page.

However, when I change try to change the field’s entity selection mode, I get the following error message: Error: The selected "Target type" User does not have bundles that are a group type.

So is it impossible to add a multi-select field that is a list of group members to a group content type?


texts:
I want to create 3 different lists of 3 different content types. They should be displayed in one block and this block would be the only one in a particular region.

Ultimately I just want a title for this region or block respectively like news and inside three different news columns like sports, politics, business (just examples).

My ideas:

A Block view using fields with three attachments. Problem is I can't create an empty block view without any fields specified. But then I have this extra SQL Query and the result will be rendered in html anyway even if I mark it "exclude from display".
Create three different block views, assign them to the region and create a custom theme template for this region.

Are there other options. Panels? Haven't used it yet, so not sure if it would be a fit for this problem.


texts: How to open a node edit form in an overlay (modal window) in Drupal 8

texts:
I have a view with nodes of type 'tasks'.
I want to easily view and edit these tasks by using a minimized overlay. When I click on a task title in the view, it needs to open in an overlay.

In D7 this was possible with the core overlay module, in combination with 'Overlay Paths" module.
The core overlay has been discontinued in D8, in favor of a 'back to site' link, which does not serve my purpose to show a minimized popup block. It also needs to be used by authenticated users, not only administrators.

How can this be done in D8?


texts: How to translate contact message field labels

texts:
I have multiple contact forms in my multilingual D8 website:

questions or remarks
order gift voucher

Those have custom fields (like field_phone, field_amount, ...)

For my custom fields, the form-element-label.html.twig with label is a string, whilst the core "message" field is a TranslatableMarkup object.

How do I provide the translation for field labels of these forms?


texts: How can I add an BCC or CC email with programmatically?

texts:
I am sending email programmatically and I am using plugin.manager.mail to send email, I want to add a CC ó BCC.
Do you know the way to achieve it?


texts: Updating Entity Properties with hook_update_N()

texts:
I have a custom module which defines a custom entity. Now I would like to add a new field to this entity without reinstalling my module. I tried it with the hook_update_N() function:

/**
 * Description
 */
function MY_MODULE_update_7100() {
  $spec = array(
    'type' => 'int',
    'description' => 'Description',
    'not null' => FALSE,
  );
  db_add_field('my_table', 'my_new_field', $spec);
}

in my Module, I updated my existing hook_entity_property_info_alter to add the definition for this field:

function MY_MODULE_entity_property_info_alter(&$info) {
  $props = &$info['my_entity']['properties'];
  // snip
  $props['my_new_field'] = array(
    'label' => t('My Label'),
    'type' => 'integer',
    'description' => t('My Description'),
    'schema field' => 'my_new_field',
  );
  // snap
}

After updating, I can still create and update the entity, but sadly not my new Field which I created.

What did I wrong?

I looked for an example in the commerce module. But the module is using drupal_write_record instead of entity_save.

PS: I already saw this issue but it didn't worked.


texts: Can i specify an image style in my custom module

texts:
I search everywhere in the web but i dont find any solution.

I make an entity query for get some nodes. I pass the nodes to my template. In there nodes, i have an image field. So my questions is, can i specify an image style in this case ?

Controllers.php

$query = $this->entity_query->get('node');
$query->condition('type', 'foo');
$nids = $query->execute();
$foos = $this->entity_manager->getStorage('node')->loadMultiple($nids);
return array(
        '#theme' => 'foo',
        '#foos' => $foos
    );

template.html.twig

{% for foo in foos %}
    <img src='{{ file_url(foo.field_picture.entity.uri.value) }}'>
{% endfor %}


texts: How to print Promoted to front page to new block?

texts: I have article,news,video types for content. Now I checked Promoted to front page for print article/news/video, etc content to any block. Now, how to print 10 result Promoted to front page article/news/video to new block of index using views Module?


texts:
I tried to print the Image field URI and the image field in the views-field.tpl and i got this error.
Notice: Undefined index: field_photo in include() (line 6 of timeline.tpl.php).
Notice: Trying to get property of non-object in include() (line 6 of timeline.tpl.php).

Here is my code

    <div class="timeline-badge <?php print $fields['field_event']->content ?>" data-toggle="tooltip" data-placement="top" title="<?php print $fields['field_event']->content ?>"><?php print $fields['field_icon']->content ?>

<?php print $fields['field_minute']->content ?>

<?php print $fields['field_comment']->content ?>

        <?php if($fields['field_photo']->content){  ?>

        <a id="tml-photo" href="<?php  print $fields['uri']->content; ?>" title="<?php print $fields['field_comment']->content ?>">
        <?php print $fields['field_photo']->content ?>

        <?php } ?>


texts:
Having just kind of gotten my head around Simpletest functional testing in Drupal 8.x, I've now started trying to use PHPUnit testing since Simpletest has been deprecated in Drupal 9.1.x.
I started by looking at the instructions on Running PHPUnit tests. However, when I get to the step on running the tests I get this.

Fatal error: Uncaught Error: Class "Drupal\Tests\node\Functional\NodeTestBase" not found in /opt/drupal/web/core/modules/node/tests/src/Functional/PagePreviewTest.php:22

This looks a bit like an autoload issue to me. I ran the following command to verify it was effectively so.
php -r "require_once('autoload.php'); var_dump(class_exists('\Drupal\Tests\node\Functional\PagePreviewTest'));"

The command outputs bool(false).
My knowledge really ends here. The documentation seems to be moot on this, and it looks like I'm not the only one with this problem. (See How to run PHPUnit tests?).
How do I run PHPUnit tests?
This is the Docker file content that can be used to reproduce what I described in the question.
FROM drupal:9.1.0

RUN composer require -n \
  phpunit/phpunit:9.5.0 \
  phpspec/prophecy-phpunit:2.0.1 \
  symfony/phpunit-bridge:5.2.1

RUN cd web/core; phpunit -c phpunit.xml.dist modules/node/tests/src/Functional/NodeTestBase.php

Building this causes the error I described above.


texts:
I found some code on the Drupal forum that solves a problem I have. Several users report the code works for them so I suppose I did not exactly get how to create a custom module. I followed the following steps:

Create a folder called i18nblocktran in sites/all/module and added two files:

i18nblocktran.info

; $Id$

name = Wysiwyg taxonomy translation
description = Displays the wysiwyg editor in the taxonomy term translation interface
package = Nathan
core = 7.x
files[] = i18nblocktran.module

and i18nblocktran.module

<?php
function i18nblocktran_form_alter(&$form, &$form_state, $form_id){
  if($form_id == 'i18n_string_translate_page_form'){
    foreach($form['strings'] as $name => $field){
      if(preg_match('/blocks:block:[0-9]+:body/i',$name)){
        // Change textarea to text_format
        $form['strings'][$name]['#type'] = 'text_format';
        $form['strings'][$name]['#description'] = '<br/>';
      }
    }
    $form['#submit'] = array_merge(array('i18nblocktran_string_translate_page_form_submit'), $form['#submit']);
  }
}

function i18nblocktran_string_translate_page_form_submit($form, &$form_state) {
  // Remove wysiwyg format because i18n cant handle it
  foreach($form_state['values']['strings'] AS $name => $field) {
    if(preg_match('/blocks:block:[0-9]+:body/i',$name)){
      unset($form_state['values']['strings'][$name]['format']);
    }
  }
}
?>

Then I activated the module in the admin but nothing happened. What did I miss ?


texts: Discount is shown, after browser refresh / cart update / during checkout not shown anymore

texts:
I have added a few simple discounts like all products from a certain brand (category) get a 10% product discount. My discounts are shown/calculated fine 70% of the time, but 30% of the time (or even more) they are NOT calculated. When I refresh my browser, they aren't calculated, when I refresh again they are calculated. It's like toggling between discount and no discount just by refreshing the browser (cmd+r).

But the most bizar thing I see in my shopping cart. I use the normal view with a few lay-out changes. My product is the field (Line items referenced by commerce_line_items) Commerce Line item: Product (Product) - Formatter: rendered product, View mode: Line item. I added the price to the Line item display, just for debugging.
Prices are shown as Formatted amount with savings.

Normal view:
Discount is calculated on the price per item and the total product price, but not on my rendered product display (with the image)

After refresh or status update or next time you go to your shoppingcart (or during checkout)
Discount is NOT calculated on the price per item and the total product price, so the user does not get the discount price, but not on my rendered product display (with the image) the discount is calculated !!

When the discount is calculated in my shoppingcart and I go to checkout, the discount isn't calculated anymore in the order review . Or the other way round.

What is happening here ? How can I fix this ? Is this a bug somewhere? I have a few stores with commerce kickstart, never had this problem. This is the first store without Kickstart. If I compare my views, displays, modules and more with my other stores, I can't find a difference.
I don't have any errors in dblog,

I did not change anything to the price calculation rule.

I use normal Drupal Commerce, not Kickstart

Commerce Discount 7.x-1.0-alpha7 + Commerce Discount Date + Commerce Discount Usage
Commerce Discount Product Category 7.x-1.2
Commerce Price Savings Formatter 7.x-1.4


texts: Customizing display of facets with Apache Solr Search

texts:
I am using Apache Solr, and Facet API for search.
I have configure Apache Solr with facet, and its working fine, but I want to change the  layout of faceted block displayed on the page.

Now it displays as on left side image.

I want to display the same as in the right side image. I mean that, when I move over on any of the options, the right side there displays its related data in a small pop up.

How can I achieve this?


texts:
I am in involved in developing a site builder using Drupal 7.  Since it is a site builder, I need a user to be able to create menu items based on their needs, and then edit those menu items - but not any other users.

Also, is it possible to create a sub-domain during sign-up (along the lines of Drupal Gardens)?


texts: In Drupal 6, I have added fivestar widget to 'Story' nodes. Now I want to make a view to sort the stories according to their average fivestar ratings. But I don't see Fivestar among the 'Sort criteria', so how can I do the sorting based on Fivestar?


texts: How to declare a custom theming function for block content?

texts:
My goal is to render an array of values (body, date) using my own theming function.  I've read Using the theme layer, and checked out the example modules, and I can't see the reason why this isn't outputting the test string.

I've implemented registered my theme hook:

function mymod_theme() {
    $items = array(
        'mymod_items' => array(
            'variables' => array(
                'items'=>NULL
            ),
        ),
    );
    return $items;
}

I've implemented a theme function:

function theme_mymod_items($variables) {
    return 'I am themed output';
}

And I call this from my hook_block_view:

function mymod_block_view($delta = '') {
    switch($delta) {
        case 'mymod':
            $block['subject'] = t('My Module');
            $items = array(
                array('body'=>'body1','time'=>'time1'),
                array('body'=>'body2','time'=>'time2'),
                array('body'=>'body3','time'=>'time3'),
            );
            $block['content'] = theme('mymod_items',$items);
        break;
    }
    return $block;
}

This results in the block not displaying, and the following message turning up in the log:

  Theme key "mymod_items" not found.

Can someone please tell me what obviously essential step I've missed, or if I'm going in entirely the wrong direction?


texts: How to change access callback of user entity when entity module is installed? (how to make sure my alteration is the last)

texts:
I want to change the 'access callback' of user entity to my own access function or at least alter the original function 'entity_metadata_user_access'.

The problem is that 'entity module' which I need because of others' module dependencies already alters the 'user entity information' and changes the 'access callback' to its own function 'entity_metadata_user_access' and so when I alter it with my module, the entity module re-alters it to 'entity_metadata_user_access'.

To make it more clear, the entity module is alters the entity info after me which causes that the final value of the callback is not mine (does not come from my alteration) but its and therefore the callback is wrong.

I know that I could modify the module itself but I honestly don't want to do that because it makes later updates painful.


texts: How to display the user edit-picture form in custom block?

texts:
I am trying to customize the user edit page in Drupal7 using Panels for user-edit page. How can i display the user edit-picture form in any specific region in Drupal 7. In my panels, i added a custom text in my sidebar region as:

<?php
drupal_get_form("edit-picture") ;
?>

However, it does not show anything. I got the form id by looking at the css. Any suggestions?


texts:
I am creating a website that will allow users to upload projects. Project submissions will consist of .zip file. Once the user uploads their project, I need to unzip the .zip file and find the .html file . Also, it needs to be possible to upload these projects through the web interface "Add New Content" and through Node.create by way of the services module.
note I'm using the PclZip library.
This is part of the code I use when the uploaded file but it does not extract the file

function custom_unzip_node_submit($node, $form, &$form_state) {
    if ($node->type == 'flipper') {
    $p_zipname = base_path() .'sites/default/files'.$form_state["complete form"]["#node"]->field_file["und"][0]["filename"];
    $to_extract = base_path() . 'test/';

    $zip = new PclZip($p_zipname);
    $ar = $zip->extract(PCLZIP_OPT_PATH, $to_extract);

    }
}


texts:
I have a custom module defining a block which needs some complex page visibility rules that I'll write later. In building out the basic hook_block code the visibility and pages settings don't seem to be working when returning FALSE.

function popup_footer_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $blocks[0] = array(
      'info' => t('Popup Footer'),
      'visibility' => 2,
      'pages' => popup_footer_block_visibility(),
    );

    return $blocks;
  }
  else if ($op == 'view') {
    switch ($delta) {
      case 0:
        $block = array('content' => 'foo bar');
        break;
    }

    return $block;
  }
}

function popup_footer_block_visibility() {
  return FALSE;
}


texts: some cck fields of content type not displayed (corresponding elements also not showing in devtool)

texts:
Out of the blue it happened that a custom content type won't display some of the cck fields I constructed for the custom content type. This happens when I just visit the a full node of that content type.
When I go see in firebug, I also notice that the HTML elements to those custom made fields are entirely missing.

I checked the display options under admin->content
type->customcontenttype and everything looks the way it should.
I checked view permissions and those are also set for anonymous and
admin roles.

Does this sound familiar to someone that cck fields cease to be displayed in full node?


texts: How do I add an extra "Add content"-link to the admin toolbar dropdown

texts: I am trying to add some improvement to the workflow of the webmasters. Right now they have to click "Content", and then click once more on the "Add content" button. Since I am working with the "Admin toolbar" module, I want to add a "/node/add" link below the "Content" link in a dropdown. But no success yet.


texts: How can I get the taxonomy title from its machine name? (drupal 7)

texts:
I am trying to get the taxonomy name which I already got its machine name.
The content type "manage field" looks like following image:

Right now, I already got the value "field_application_type." How can I get the lable "application type"(in the red circle) for this machine name(in the blue circle)?


texts:
I'm very new to Drupal development and I am completely stuck(.

I have a custom content form, where I need to hide some fields in Inline Entity Form.
I am trying to write my own custom module to achieve this, I am doing the following:
1. I create module folder, where I put info.yml file
2. I create Controller file, where I add custom class and this code inside this class:

public function MY_MODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {if ($form_id == 'MY_FORM') {...};

The next thing I am completely stuck at is do I need a routing file to make this work?
I can't find any info about this so I'd really appreciate some help!
And if I need routing, what should I write there?


texts: Drush Error: environment settings not found or configured for Drush command

texts:
I'm working on a legacy project and am trying to see if Drush can be set up properly. I installed the drush executable locally, I'm not sure if that is the issue. But when I go to run a basic command like drush cr I get this error about "environment settings."
$ /home/ubuntu/.config/composer/vendor/drush/drush/drush cr
environment settings not found or configured for Drush command terminated abnormally due to an unrecoverable error.

Where are these "environment settings" supposed to be located? Googling around, I can't seem to find anything concrete. Any suggestions would be appreciated.
By the way, the executable itself seems okay:
$ /home/ubuntu/.config/composer/vendor/drush/drush/drush --version
 Drush Version   :  8.2.3


texts:
I want to serve an image programatically and execute custom code, something usal and simple in plain php.

<img src='test.php?image=1234.jpeg' />

Then you just serve the image in "test.php" and execute your custom code.

However I have not idea how to achieve this in Drupal.

The code should be in a module of course, but, how to I create a path equivalent the one above, that execute that custom code in my module?

Another solution could be to trigger a rule each time an image is download but that is too heavy. Even another could be something like URL alias to a content, and on display rewrite the output of that content? Is this possible?


texts: Looking for the right modules for user group management

texts:
I am creating a site that works similarly to Groupon with D7, and I am having trouble finding the right modules to deliver the functionality.

I need to create different user groups: buyer and seller.

For the buyers I need to store their name, geo-location, and email address.

For sellers I need to store the name of their business, email, geo-location, and I want the sellers to be able to create a list of offers(nodes) linked to their business.

My initial thought is to find a module that enables custom field for user profile. I also need a separate registration & login page for each group, and assign new sign-ups to the appropriate group ( buyer vs seller) based on which page they use to register. What modules would you recommend in order to fulfill these requirements?


texts: When viewing a user, display their content profile

texts:
When I go to /user/uid I want it to go to /content/content-profileID by default. This is a node typer that is used by content profile.

How can I go about doing this?


texts: In Drupal 8 module creation, why don't I have to put the directories "modules" and "src" in the namespace of my yaml file?

texts: I watched a tutorial on Drupal module development, and the namespace he used didn't include modules or src in the yml file (it is around 4:30).  I'm sure this is a basic PHP question, but why didn't he have to put in those directories?


texts: How to get value from field widget during AJAX callback loop?

texts: A select element on my form gets processed with an AJAX callback. There is a Multiselect widget on the form, and I want to see the new value of the field as if the form had been submitted. But, the $form_state['values']['my_multiselect'] is always NULL when checked in the form builder function during AJAX callback. Where does Multiselect build the value from the form state?


texts: How to bind javascript to ctools modal load

texts:
I have a ctools modal popup that has no Drupal generated form but an external iframe that loads a form into ctools modal. I have some jQuery codes to be invoked when the iframe gets reloaded (ie. to assume external form gets submitted).

This jquery code initiated and works fine with a normal page(without ctools) while javascript has been added by drupal_add_js().

How can I do the same with cTools?

// MENU
function dw_common_menu() {
  $items['download/%ctools_js/register'] = array(
    'title' => 'Register',
    'page callback' => 'dw_common_ajax_download_register_page',
    'page arguments' => array(1),
    'access callback' => TRUE,
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}
// Page callback
function dw_common_ajax_download_register_page($js = NULL) {
  /*
   * $sess_key : create a unique session key if not exists;
   * @TODO : instead of md5(REQUEST_TIME) use some other random function as multiple users
   * might access at a same time.
   */
  $output = "";
  $iframe_source = 'http://example.com/cn/iframe.form.php';
  $output .= '<iframe id="site-contact-us" src="' . $iframe_source . '" frameborder="0" scrolling="no" width="232" height="378"></iframe>';
  // Attaching jquery iframe event load in the ctools output itself.
  // The script from files are not invoking as window.load() doesn't takes effect in ctools window.
  $jsscript = "";
  $jsscript = 'jQuery(document).ready(function() {
    (function is_key_authorized(){
      alert(\'sd\');
    }
      });
    })();
    is_key_authorized();
    });';
  $output .= '<script language="javascript" type="text/javascript">' . $jsscript . '</script>';
  // Fall back if $js is not set.
  if (!$js) {
    return $output;
  }
  ctools_include('modal');
  ctools_include('ajax');
  return ctools_modal_render('Register', $output);
  exit;
}

Here I am trying to concatenate <script> to ctools modal output as drupal_add_js not helping to load.


texts: Boost not working on pages with ?_utma Google Analytics cookie in url

texts: Boost works on every page, but it doesn't work on pages with Google Analytics variable in the URL. For example, http://stratton.wanderlustfestival.com/?__utma=1.485948833.1348167330.1348796515.1348837057.31&__utmb=1.3.9.1348837058695&__utmc=1&__utmx=-&__utmz=1.1348167330.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)&__utmv=-&__utmk=172983075 doesn't show <!-- Page cached by Boost @ 2012-09-27 16:23:18, expires @ 2012-09-28 04:23:18 --> while http://stratton.wanderlustfestival.com does.


texts: Creating a new menu item that links to /user

texts:
How do I format an array item using hook_menu() that links to /user but has a new title and is only accessible to logged in users?

Currently I'm using

    $items['user'] = array(
      'title' => 'Account Settings',
      'path' => 'user',
      'router_path' => 'user',
      'description' => 'Manage your username, password and contact information here.',
      'access callback' => 'user_is_logged_in',
      'type' => MENU_NORMAL_ITEM,
      'weight' => -20,
    );

Then end goal is to have a link that is titled 'Account Settings' that links to /user and that is only available to logged in users.

Edit: I guess to clarify, how can I incorporate the system menu /user item into my modules menu without using the UI?


texts:
I am trying to filter views output using Parameters from url with views contextual filter.
There are two fields on the content type :

1.field_sku
2.field_width

I simply added the contextual filter for the first one , but as i add the second filter it doesn't work.
Is it posibble to add multiple contextual filter to a view?


texts:
Could you help help me correct the follow piece of code

I am getting the following error.

"The website encountered an unexpected error. Please try again later."

public function __construct(Connection $connection) {
    $this->connection = Database::getConnection();
  }
public function hello($state = '0') {
    $sqlQuery = $connection->select('pop11', 'C2011')
    ->fields('C2011', array('male', 'female'))
    ->condition('C2011.sCode', '10', '=');
    $data = $sqlQuery->execute();
    if ($data) {
        $results = $data->fetchAll(\PDO::FETCH_OBJ);
        foreach ($results as $row) {
        echo "Field a: {$row->male}, field b: {$row->female}";
        }
    }else{
        return array('#title' => 'Error', '#markup' => 'Could not Find. What you are Looking for.',);
    }

}


texts:
im using Drupal 7 and the Quiz module for making some quick courses.

It works fine, but i would love to make them with ajax transitions instead of doing it by the old form way.

I have seen the ajax quiz module, but it doesnt seem to work. any other recommendation? there's any other module i could use in order to ajaxify my quizzes or my whole site? Thanks.


texts: How to Modify Views output on every 10th item?

texts:
I have a drupal based project that uses views to output some images and markup in a loop. Each content chunk is similar so pretty standard set up. However I now have a request to uniquely modify every 10th ( or so ) content block that gets output to have a different style and markup.  I am not sure how to handle this in drupal views. Can somebody please point me in the right direction?

I don't know how many items in total would be output.


texts: How to attach username at the end of url?

texts:
Suppose I have a site www.example.com with many users in it. Now user "abc" is logged in, then the username should be attached at the end of that URL, like: www.example.com/abc

Also I have fix content on my website e.g. about us , contact us etc.
Now if I go to the "about us" content then the link should be : www.example.com/abc/contact-us


texts: How can we configure the Master slave concept in Drupal 7?

texts: I have one large scale website and hosted on AWS. I want to enable Master-Slave concept on it. How can it be possible to configure the same?


texts:
I need to be able to display a Facebook album in my Drupal site. I have the FB integration done, and have the PHP code to pull down photos. To keep things clean, I don't want to write my own album functionality and shove that into Drupal - I'd rather just present to views the data I have pulled from FB and have views display it.

Is there any way to achieve this? Most links I can find regarding custom views assume you are querying a database.


texts: Views Bulk Operations execute php loop over reference values

texts:
I am trying to finalize migration from d6 content profile to d7. I'd like to execute an arbirary php script using VBO to set a multi value entity reference field(users) based on the authors of a multi value node reference(bio content type) field.

I am looking for proper syntax for looping through each node reference item and populating the entity(user) reference with the uid from that node.

Final working solution:

$containing_node = node_load($entity->nid); //$nid is what node if you get from VBO
$w_containing_node = entity_metadata_wrapper('node', $containing_node);
$references = field_get_items('node', $containing_node, 'field_res_mem');
   foreach($references as $index => $value) {
     $my_index = 0;
     $reference_nid = $value['nid'];
     $rnode = node_load($reference_nid);
    $ruid = $rnode->uid;
    $w_containing_node->field_res_memuser[] = $ruid;
  }
$w_containing_node->save();


texts: How can I show only webform content by excluding header,footer?

texts:
I wan to show only the form elements in an modal(popup), but am not able to achieve that. Along with the form elements header, footer is also showing. So how can I remove those things for specific webform?

I tried by creating a template file with the name webform-form-162101.tpl.php. But it doesn't helped me. Please share some other way to achieve this.


texts: Widget Access not linked to NodeAccessControlHandler->checkFieldAccess

texts:
I have created a custom widget for a paragraph type (my_parag_type).
The parents of any my_parag_type are always a Node ($node->field_my_parag)
I have also extended NodeAccessControlHandler for my Nodes and, by this, the the field $node->field_my_parag can be edited only by some roles. I have done this by implementing MyCustomNodeAccessControlHandler::checkFieldAccess.
If I use the regular paragraph widget, everything is fine: only the allowed roles can see the widget.
If I use my custom widget, everybody can see/edit it, which is bad.
Important Note:
My widget, which is working well except this, doesn't extends widgetBase for numerous reasons; it extends PluginSettingsBase (But it does implement WidgetInterface)
My question is: where Drupal is checking the field accesses to display a widget. I haven't see any access stuff in the widgetBase class.


texts: load balancing multiple horizontal drupal instances

texts:
I've developed a REST WebAPI using the Services module. It works fine. I have a client of that API with projected usage requiring I horizontally scale my Drupal instance. Note that due to the nature of my API, requiring significant CPU and GPU resources, I can not use cloud servers. Also, due to the nature of my API, the Drupal instances have to run on Windows OS. (My application requires software only available on Win64.) I have a fairly beefy server in a co-location now, and for this ambitious client I am planning to horizontally scale my hardware in the following manner:

One CentOS server running HaProxy as the front end load balancer,
Two to start, with more added as needed, Windows Server 2008 R2
servers hosting Drupal,
One CentOS database server providing a single database for the
multiple Drupal instances,
One CentOS database server running in replication mode in case DB
server 1 dies.

My questions have to do with how the HaProxy load balancer works. I'm assuming that the sessionIds created by the Drupal instances will be unique from one another. Does the load balancer look at the sessionId and route all requests to the same server that produced that sessionId? How would a REST WebAPI communication work if load balancing caused each API request to go to a different server? Does any and all data referenced by the WebAPI have to be stored in the database because I can't insure that multiple API requests for the same resource will be routed to the same Drupal instance?


texts:
I use the command drush up for sites I store on a shared server & locally.

Within some months my Inode volume vent from about 25% 96% (96% is insane for most people using a shared server on whatever platform) and given the fact I already have 30 days backwards backup service, I don't really need this specific backup creation.

How can you disable the automatic backups created by drush each time drush update is ran?


texts: Creating breadcrumbs based on content type relationships

texts:
Currently I have 3 different content types: Program, Chapter, Item. A program contains multiple chapters and a chapter contains multiple items. These are related to one another using node reference field types.

On the item page I would like to have a breadcrumb listing: Program --> Chapter that is related to that specific item node.

I've looked into Custom Breadcrumbs and Page Breadcrumbs, but can't seem to figure out how to pull in the chapter and program that it is related to.


texts: How to use inline_entity_form in Drupal 8?

texts:
I am building 2 custom Content entity types: one is a Node type representing a type of food, called "food". This food may have multiple varieties, which will differ with regards to specific details, so I wish to store information about the varieties in a separate database table, and to accomplish this I have defined a second entity type called "food_type" which serves to provide additional information related to the "food" node.

Within the Food form, I want to also fill out all the fields for the related food_type. I am trying to accomplish this using inline_entity_form.

Following the documentation, I have done the following things for food_type:

Added a dependency of inline_entity_form in food_type.info.yml (there are no other dependencies)
Created food_type/src/Controller/FoodTypeInlineEntityFormController.php, which contains the following code:

namespace Drupal\food_type\Controller;

/**
 * Controller routines for Food Type pages.
 */
class FoodTypeInlineEntityFormController extends EntityInlineEntityFormController {

 /**
   * Overrides EntityInlineEntityFormController::entityForm().
   */
  public function entityForm($entity_form, &$form_state) {

    return parent::entityForm($entity_form, $form_state);
  }
}

Added the following code to food_type_install() in food_type.install:

$entity_info['food_type']['inline entity form'] = array(
    'controller' => 'FoodTypeInlineEntityFormController',
);

Defined '\Drupal\food_type\Controller\FoodTypeInlineEntityFormController::entityForm' as the _controller default under entity.food_type.form in food_type.routing.yml

I cannot enable the food_type module. Attempting to do so yields the following error:

  Fatal error: Class 'Drupal\food_type\Controller\EntityInlineEntityFormController' not found in {directory}\sites\all\modules\custom\food_type\src\Controller\FoodTypeInlineEntityFormController.php on line 9

I assume this is caused because I do not include a use statement in FoodTypeInlineEntityFormController.php for EntityInlineEntityFormController. From Googling, it seems that such a statement is not used in example code that uses this module at all, and it's supposed to simply work when the inline_entity_form module is enabled. However, I for sure have inline_entity_form enabled and am still getting this error.

I would like to try a use statement, but the EntityInlineEntityFormController class does not seem to exist at all in the module code, as far as I can tell from searching. I am using 8.x-1.0-alpha6.

I am very new to drupal development and believe I am probably doing something else wrong, but I am completely at a loss here as to how to proceed or troubleshoot. Can anyone please help me or point me in the right direction?

Thank you in advance.


texts:
I would like to show a "cumulative total" of nodes by date. For example, it should look like this:

date number total
1/1  1      1
1/2  3      4
1/3  2      6
1/4  4      10

I've tried views_php without luck:


texts: Site redirects to install.php file over and over again after installation of Drupal

texts: I installed Drupal-7.x-2.0-alpha5-core in my localhost and installation completed successfully but i can't go into the site after installation. it directs me to the install.php file over and over again.Is there anything i can do to fix this ?


texts: Search system based on two taxonomy vocabulary for Local Business Directory for Drupal 7

texts:
I am new in drupal

I am making a Local Business directory. every business entry is a node (content type "Profile") and I make two taxonomy vocabulary name as "Business-city" and "Business-category" . every node is tagged with two taxonomy term.

Now I want to make search system where user can select "Business City" and "Business category".

Please tell me how can I do this.

Thanks in advance


texts: How to create a content type that incorporates a batch upload and body field, with a gallery output

texts:
I'm working on a client site that needs to include event recaps with a gallery of photos for each event under the text recap and event results. They're not very tech savvy so the standard method of creating a view through individually uploading images is going to be too complicated for them, So what I want for them to be able to do

Log in > Click add content > Click event recap or similar > Add a title and a date > Upload a thumbnail image > Put in their event results, who won what etc, probably just in a wysiwyg field > Batch upload images > Click save

And then for the front end, have a teaser sorted by date under an event recaps parent menu link, and on click the 'page' itself with the text recap, the thumbnail and the images in gallery format.

Is there some way I can combine taxonomy, views, and a batch upload module to make this come together for a less tech friendly user or a module that already does something similar?


texts: How to take the node reference field from views

texts:
I have added images through image content type and tagged the node to article content type nodes using node reference , while getting the article credentials through views , i cant figure out how to take the images from the tagged node reference field through views .

some option only avail to get the node reference field in views .
1)Title.
2)Title link.
3)Full content.
4)Print.

and two more which is not helpful for me .

Here i need to get a image from image content type which is tagged in article content type through node reference .

Anyone help for this as soon as possible.


texts: How can I isolate *content* from *configuration* in the database?

texts:
There's no obvious way (that I can see) to isolate a Drupal site's configuration (which is of course all in the database) from its content (which is of course in the same database) when doing any operations on the database.

For instance, it would be very useful to be able to be able to push your configuration changes from your development server to production,

drush sql-sync @dev @prod

and then push only your content back to development from production.

drush sql-sync @prod @dev

Short of going through the database and making a list of tables for each type of data, and writing your own script to dump and import just those tables (an approach which seems kludgey and error-prone), how can this be done?

UPDATE: There doesn't seem to be any way to do exactly what I'm asking how to do.  Since both answers were very helpful, however (1st of all because they contain useful information, and secondly because they indirectly confirm that it's not currently possible to do in any practical way) I'm up-voting them and selecting one.  I hope that by selecting an answer no one is confused into thinking that what I described is possible.  (I've seen such things happen before.)


texts: Where is the module registry stored outside the database?

texts:
As a long time Drupal dev, I should probably know the answer to this question, but I'm stumped by the behavior I'm seeing.

Let's say I have a local and a remote site.  On the remote site a module is uninstalled properly and the module code is removed from the file system (git tracks the deletion, etc).

Then to get my local installation up to date, I completely drop all tables in my database (it's completely empty) and I do a git pull, so the local module files are deleted. I then get the remote database and load it into my local.

In that situation there are no database remnants from my old local install and the file system is updated with the deleted modules.  It should reflect the remote site completely.

However, when I load up the local site I get all the 'XXXX module is missing" and everything breaks.  I run the registry rebuild via drush rr, and it fixes everything.  But then, going forward into the future, I continue to see this broken registry each time I reload the site from the remote database (meaning I have to rr each time).

This strikes me as so odd...because where are those old registry records stored outside the database? Why, if I have a fully clean database, does it recognize old modules as missing?

And of course...how can I 'clean them up' permenantly?


texts:
Is there Drush command that can backup whole multisite platform:

database dump of each site
code of each site
backup of sites/all or complete core with sites/all
and all that in just ONE tar.gz

There is a archive-dump command which can backup whole platform code and database, but it does that for each site, and omitting other sites from its archive. And that is a problem because if you want to use that backup, and let's say you have 3 sites in platform, you would have to untar 3 backups of each site, and then merge those so your /sites folder has all three sites there, instead only one per archive.

Second, less annoying problem with that command is, if you provide it argument @sites, it will try to backup default site as well, which is not used on Aegir.


texts: rate widget showing 403 error when anonymous submitting vote

texts:
I have added rate widget as five star to content type. I have set permission for rate widget that only 'authenticated user' can vote and 'Redirect to login form' for the anonymous user.

I want to display rate widget in right side bar, so I created a custom module to display rate widget in block.

I have also set "Do not add automatically" setting for rate widget in admin.

I have implemented hook hook_block() into module and creating the block.

Code Snippets for block body

$node = menu_get_object();

    $output = '';

    if ($node->type == 'primary_antibodies') {

        $output = '

                 Rate this product

                Is working as
                  expected:

                ' . $node->rate_field_pr_prab_rate_expected['#value'] . '

                Product
                  documentation:

                ' . $node->rate_field_pr_prab_rate_documentation['#value'] . '

                Product quality:

                ' . $node->rate_field_pr_prab_rate_quality['#value']. '

                Service:

                '  . $node->rate_field_pr_prab_rate_service['#value'] . '

';

    }
return $output;

When any anonymous user trying to vote, its showing '403 error'.
Thanks for your help in advance.


texts: Drush site-upgrade always gives mysql error: Access Denied

texts:
I am trying to run "sudo drush site-upgrade @alias" however I invariably get the same large HTML output containing the error block:

The site is currently not available due to technical problems. Please try
        again later. Thank you for your understanding.

If you are
        the maintainer of this site, please check your database settings in the
        settings.php file and ensure that your hosting provider's
        database server is running. For more help, see the
        handbook, or contact your hosting
        provider.

The mysql error was: Access
        denied for user &#039;root&#039;@&#039;[HOST NAME WAS HERE]&#039;
        (using password: YES).

     ...
     ...
Drush command terminated abnormally due to an unrecoverable error.

I am using the root user of my sql database with the proper password but am still getting this access issue.

Strangely enough any other drush command fails to execute and instead spits back this error. Even "drush help". Drush is working fine in other Drupal site directories on the server


texts: Using a view to attach fields from a content type to another one

texts:
I am a bit new to this, but I do have a programming background, and I have been working with Drupal for a while.

I am putting together a site for our Yoga Studio and I have a content type (scheduled class)  that has a field (field scheduled_class) that is a node reference to a content type (class description). The Scheduled Class content type has as field for date which is used in a calendar, and there are multiple classes using the same class description.

I am trying to use a view to attach fields from the class description to the scheduled class content type and I cannot get it to work. I have been banging my head against the wall for months now.

                               --> fields
Scheduled class --> Class Type --> fields
                               --> fields

I have not been able to get the contextual filter and relationship set up properly to allow this to work. I have tried every single combination I can think of. I am pretty sure the source of the problem is trying to get the right default value of the Class Type, but I am not sure.


texts:
I am trying to figure out what's the problem with my code. It creates the product, but the price field is allways empty.

$cp = commerce_product_new('deposit_temp_'.$_POST['importe']);
$cp->is_new = TRUE;
$cp->revision_id = NULL;
$cp->status = 1;
$cp->created = $cp->changed = time();
$cp->sku = 'deposit_temp_'.$_POST['importe'];
$cp->title = t('Booking deposit');
$cp->language = LANGUAGE_NONE;
$cp->commerce_price['und'][0]['amount'] = 20;
$cp->commerce_price['und'][0]['currency_code'] = commerce_default_currency();

commerce_product_save($cp);


texts: I'd like to change the  class from "menu" on one specific menu I have showing up as a block on about 3 pages in a Drupal 7 site. I've been researching but can't seem to figure out the best way to go about doing this.


texts: How to make Drupal highlight the same menu item for 2 different nodes (URLs)

texts:
When defining the menu item, I can only choose a unique URL for language. But I want that a bunch of pages, one of them the referenced by the menu item, highlight that menu item (Products) so I know I am in that section of the page. For example:

www.example.com/products
www.example.com/search-product
www.example.com/product-detail

all would have to highlight the menu-item := products, that which references the first URL above.

I have tried with the following code but I am not sure if there is a faster and more direct approach, it seems too convoluted to me to theme() nothing to keep the above desired effect

Code:

   print theme('links__system_main_menu', array(
        'links' => $main_menu,
        'attributes' => array(

        ),
        'heading' => array(
          'text' => t('Main menu'),
          'level' => 'h2',

        ),
      ));

function theme_links__system_main_menu($variables) {
  $html = "
";
  foreach ($variables['links'] as $link) {

  // HERE I would change $link['href'] to merge the 3 links
  //together and make that this item is hilited when I am in one of the 3
  //links. Of course, the href link will direct to the first one, but
  //the hilite will make the user to know that she is in this section.

    $html .= "
".l($link['title'], $link['href'], $link)."
";
  }
  $html .= "
";
  $html .= "";

   return $html;
}

Another coded approach:

 $a = menu_tree_output( menu_tree_page_data("main-menu") );
 print "
";
foreach($a as $key => $value){
 active = "";
   if($value["#href"] == current_path() || ( drupal_is_front_page() && $value["#href"] == "<front>" ) ){
     // HERE I would change $link['href'] to merge the 3 links
    //together and make that this item is hilited when I am in one of the 3
    //links. Of course, the href link will direct to the first one, but
    //the hilite will make the user to know that she is in this section.

    $active = 'class="active"';
   }
        if($value["#href"] == "<front>"){
            $url = "";
        }else{
            $url = drupal_get_path_alias($value["#href"]);
        } // if
        if($value["#title"] != "") print '
language . "/" . $url . '">' . $value["#title"] . "
";
    } // foreach
     print "
";


texts: How do I know whether drupal_write_record has done an insert or an update?

texts:
I use the function to insert or update records in a table, but sometimes I would like to know whether the function has executed an update or an insert. In my scenario I always provide the primary key:

drupal_write_record('mytable',$entry,'key');

The function inserts a record if $entry['key'] does not exists and updates the record with the new information otherwise.

Is there somewhere I can check to see what the function has done ?


texts:
We are working on a drupal ecommerce subscription service.

Modules: Commerce, Commerce Mollie, Payment etc..

Everything works 99%.

After finishing the payment the user needs to get the right role + a message.

This works with the default test creditcard payment.

But the commerce mollie integration module, is not triggering any rule after finishing the payment.

This is a real problem for us.

Screenshots:

UPDATE

https://www.drupal.org/project/mollie_payment
https://www.drupal.org/project/payment_commerce
https://www.drupal.org/project/payment

I would love any help, if there is information missing tell me!

Thank you guys.


texts:
I have created a field with unlimited number of values allowed. Now, using view I want to display all even number items (like 2nd, 4th, 6th and so on). How can I do that?

My thought: May be I need to edit views-view-field.html.twig file. But I'm not finding any way to display items in field instead of complete field. Please help me.

View source of views-view-field.html.twig:

{{ output -}}


texts: presave like option for adding vocabulary and terms similar to one provided by hook_nodeapi

texts:
I'm a Drupal newbie and trying to customize the 'Add Vocabulary' and 'Add Term' provided by taxonomy using a module named Domain Taxonomy.

To customize it as per my own requirement I'm gonna have to insert the domain specific data when the term is saved without messing up over the existing code provided by domain taxonomy rather wish to override it.

I'm looking for a hook similar to hook_nodeapi where in '$op == presave' after validations and before saving node it can be customized with user added data.

To my understanding hook_nodeapi doesn't apply for stuff like taxonomy or user profile. Does something similar exist for taxonomy that i could put to use here. Kindly let me know if my understanding is flawed and provide valueable comments/feedbacks and possible solution.


texts: Why I am not able to add custom validate Handler function for UserPasswordResetForm on form_alter?

texts:
I am trying to override default reset password functionality by using hook_form_FORM_ID_alter as below:
The below code is written in custom module called usr_registration.module file

    /**
     * Implements hook_form_FORM_ID_alter().
     */
    function usr_registration_form_user_pass_reset_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id, AccountInterface $user = NULL, $expiration_date = NULL, $timestamp = NULL, $hash = NULL) {

            $form['account']['pass'] = [
            '#type' => 'password_confirm',
            '#size' => 25,
            '#description' => t('Provide a password for the new account in both fields.'),
            '#required' => TRUE,];

             $form['#validate'][] = 'usr_registration_validate';
             $form['actions']['submit']['#submit'][] = 'usr_registration_form_user_pass_reset_custom_submit';
    }

    // this function itself is not getting called
    function usr_registration_validate(&$form, FormStateInterface $form_state) {

      //unable to see below debug message and form is getting submitted
       echo "I am here"; exit;

       if($never_login) {
                        //some custom logic
       } else {
                       //some custom logic
       }

     }

The important thing I noticed in UserPasswordResetForm class(user core module's form) is that there is no default validate method defined.
I am unable to find out that why I cant alter the UserPasswordResetForm and custom validate handler over here.

note: My question is similar to this but not exactly same so please dont mark it as redundant.


texts:
There is a plenty of plugins for building all kinds of sliders and carousels with Views.

But frequently I find myself in a situation, when I need to make some kind of slider not for a whole node but only for one particular field with multiple values. Of course, I can attach a view using the EVA module and use it to output just one field of current node.

But is it a recommended way? Are there better solutions?


texts: How to set a multi line value from drush vset

texts:
I was trying to add a value to the drupal antibot antibot_form_ids variable.

drush vget antibot_form_ids

returns a string separated by /r/n
Adding just a value to this string isn't just enough.
If you do a
drush vset antibot_form_ids 'webform_*\r\nuser_login\r\n
and so on you end up with exactly this value in the form field of the config area.

So how can it be done?


texts: Hide admin email address in user's from field (Webform)

texts:
I am using the Webform  module.
So far the user can send an email via a form to my admin email.

However when I reply to the user my admin email address shows in their 'from' field! - How do I hide that to the site's name (but still pointing to my admin email address)?