texts: Why when I do a configuration export does the config.tar.gz in tmp not get copied to the sync folder?

texts:
This happens when I use the UI and drush cex. The config.tar.gz is created in the tmp folder but nothing is created in the sync folder that I created in sites/default.

I have searched for similar tickets here, on Drupal.org and searching in google! I find references to folder and file permissions (I have tried 777 on most) and references to a .htaccess file in the sites/default folder with specific content.

The content my .htaccess file in sites/default is:

# Deny all requests from Apache 2.4+.
<IfModule mod_authz_core.c>
  Require all denied
</IfModule>

# Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c>
  Deny from all
</IfModule>
# Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
    # Override the handler again if we're run later in the evaluation list.
    SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

I am using the DDEV environment to create docker containers on my local Ubuntu 10.04 VM (VirtualBox) on my Windows 10 PC. I use the DDEV default settings.php for Drupal 8. I then added the following lines:

// Config sync directory.
#$config_directories['sync']='sites/default';
$config_directories = array (
    CONFIG_SYNC_DIRECTORY => 'sites/default',
);

// Configure private file path
$settings['file_private_path']='sites/default/private';

// Configure trusted host patters to prevent HTTP HOST header attacks
$settings['trusted_host_patterns'] = [
    '^<projectname>\.ddev\.local$',
];

I have tried variations of the $config_directories definition including the commented out version. I also defined the sync directory to be 'sites/default/sync'. I have created the 'sites/default/sync' directory. I have tried deleting the config.tar.gz in the tmp directory which gives the log message 'The file tmp/config.tar.gz was not deleted because it does not exist.' and then creates the config.tar.gz file in the tmp directory.

I have tried find . -name *.tar.gz to search all the directories for any such files in case it has put it somewhere unexpected and no luck!

OK so for my versions:

Ubuntu 18.04, DDEV 0.18.0 (Nginx 1.14.0, PHP 7.1.16-1+0~20180405085551.16+jessie~1.gbp4937aa, Database 5.5.5-10.1.28-MariaDB ), Drupal 8.5.5. I have done these tests on a standard Drupal installation with the only additional module being Backup and Migrate 8.x-4.0. I have enabled a few of the core modules not enabled by the standard installation (e.g. Media).

There don't appear to be any messages in my latest Drupal error log for today (my most recent test of this bug).

Is there anything else I can supply that might help diagnose what I am doing wrong?


texts: It looks like it's something obvious but I can't find the web interface to view simpletest results. Where should I view the errors besides the DB?


texts: I have many basic pages where I need the user to be logged-in in order to view them. How do I customize the site access denied page?


texts: Display thumbnail in teaser with WYSIWYG editor

texts:
I need to show a thumbnail in the teaser of my blog post.
My blog post already have images inserted with WYSIWYG editor and i can see it in the default view of the blog entry.
Then in the front page i have the teaser version of this blog entry and what can i see is the body of the entry and three dots '...'
How can I display the image in the teaser and display as thumb?

I also try to create a thumb field just for the teaser, so i kind of divid this two tasks (which is not ideal for my client since he would like to upload less image possibile to save time), at that it work but I still see the three dots in the teaser

Any suggestions?


texts: How do I create a block for my heartbeat activity?

texts:
I have a heartbeat activity and a message template. I'm able to log the activities using heartbeat_api_log(), but how do I show the activities in a block?

I'm using Drupal 7.


texts:
I am building a Drupal 8 site. The site will have basic pages (nodes) that have three fields: a title, a body and a list of embedded blocks.
The idea is to allow the editors to create content blocks by using the new functionality of Block Types in Drupal 8. Those blocks can be referenced and arrangaed inside the page by using an entity reference field.

I have built the necessary infrastructure and I can reference my custom blocks from the page and render them in the template. The trouble comes when I want to set a custom template for my blocks, for example I would like to have a custom template: block--image-gallery-block.html.twig that would be used when rendering blocks of type Image Gallery Block.

With Twig debug mode enabled I can see that Drupal is looking for a template for the entity reference field, and then starts to render the referenced block fields instead of the block itself, so I can not use any template for it (not even the default block.html.twig).

I've thought about using a custom template for my field and render here the block the way I like. Unfortunately my field can reference blocks of multiple types, so this solution won't work for me.

How can I make Drupal pick the proper template for the referenced blocks?

Edit: solution

I am explaining here the solution I've ended with after reading @ssibal and @4k4 answers.

I've built some new content-types that will represent the blocks.
I've modified my Basic Page content type to have an entity reference field that points to the blocks. This field simply references other nodes from the content types that I want (the ones I've made in the step 1).
In the display options of my basic page, I choose which view mode I want to use for rendering the blocks.
I use the view mode that I've set up in the step 3 to build custom templates for my block content types.
Since I do not want block content types to be accessed directly with a URL, I've implemented a hook_node_access to throw a 404 error when directly loading a node of my block content types.


texts: When selecting a product variation attribute, the add to cart button and attribute disappear

texts:
I have a strange issue.
I have created product dislays with product variations, which have attributes (size, color etc)

The attributes field show up fine on the product display, but when one of the product attributes is clicked, the Add to cart button and attribute field disappears! The rest of the product variation is display correctly.

My first thought is that it is caused by a Ajax issue since the clicking of the product shows a rotating ajax loader.

Sorry I have no idea where to start debugging. The console does not give error message.


texts: Implements a custom template for Langage switcher

texts:
I've tried to implement a custom template in MY_THEME/templates/general/links--locale-block.tpl.php. But it isn't called even if the block is correctly configured and placed in the right region.

I've never done any templating before, so any help would be welcome.


texts:
I have been using the recruiter distribution for a while and for some reason I remove the ability of the resume state.  I have analyze the problem and the issue is that every time someone register to the website their resume is automatic on visible state. And I need to make sure that the resume remain hidden until the user at least provide their contact information. This is a critical bug on the site because on the resume search show a lot incomplete users.

Anyone can help me to figure out how to enable the resume state functionality ? Or how to troubleshoot this problem. FYI... I updated the recruiter_features module and nothing happen.

I have post this issue on many places and I have not get any response.

https://www.drupal.org/node/2304539
https://www.drupal.org/node/2311329

Any help will be appreciated.

Views


texts: What is the equivalent of #page & #page-wrapper in Bootstrap theme?

texts:
In most of the Drupal themes I find the IDs #page and #page-wrapper, but it is not available in the Bootstrap theme.

I tried to find in theme, but maximum I could find is class .container but is covers only that particulate section i.e. header, main-content, footer.

Is there any ID or class in Bootstrap theme which covers entire webpage like #page does in almost all other themes OR if there is not how can I add that?

To experiment, I did try to add following to page.tpl.php like other themes,

And added following CSS to check,

#page {
    border: 5px solid red;
}
#page-wrapper {
    border: 5px solid blue;
}

But it applies to border of the browser not to actual width of the page  as shown in the following image.

Hence looks like this way we can not add this to Bootstrap theme.

Any idea or suggestion how to apply #page and #page-wrapper to Bootstrap theme? Thanks.


texts:
I'm trying to create a new workflow in Drupal. When I click "Content Types" beneath the "This workflow applies to:" section, it loads an empty modal. I have 6 content types but they fail to show.

There is an existing workflow that has the correct content types set. However, if I uncheck one of them, it won't be available if I try to add it back later.

I made a new, test content type. It will show as an option for workflows but the older, existing options will not.

Does anyone have any ideas as to why the content types won't load inside of the workflow editor?


texts: How do I programatically add a field to a node?

texts:
I'm trying to create custom Drupal 7 module. In the form setting for the module I have checkboxes where the admin can select multiple content types:

After installing the module I need to automatically create two fields (Price of type decimal (4,2), and currency of type text) only in the 'content types' the admin has selected from the list above.

And this is how I set the content type to the checkboxes list in the mymodule_payment_admin_settings_form hook in mymodule.module:

 $form['test_content_types'] = array(
      '#type' => 'checkboxes',
      '#options' => drupal_map_assoc(node_type_get_names()),
      '#default_value' => variable_get('test_content_types'),
      '#required' => TRUE
    );


texts: How do I send a variable from PHP to JavaScript from a function that returns a render array?

texts:
I'm trying to send a variable to my JavaScript. I would like to send a class name to my twig template and the same class-name to my javascript from a function that returns a render array. The function is called from a routing yml to display a page from a link in a page (which is beside the point).
The returned render array is similar to the following one.
return [
  '#theme' => 'theme_name',
  '#form' => $form,
  '#data' => [
    'customer' => $obj_customer,
    'customer_subscription' => $obj_customer->getSubscription(),
    'subscriptions_explanation' => $arr_subscription_text,
  ]
];

Passing data from PHP to javascript variable available to all pages in Drupal 8 says you can do something with '#attached' => ['drupalSettings' => ['do' => $something]] in hook_page_attachments(), but that doesn't seem to apply to the method I am using.
How can I do in my case? Adding stylesheets (CSS) and JavaScript (JS) to a Drupal theme doesn't seem to cover this use case.
In my JavaScript I define my JS functions inside:
(function ($, Drupal, drupalSettings) {
  Drupal.behaviors.portalCore = {
    someFunction() {
      ...
    }
  };
});

Is there perhaps a way to attach a variable to the portalCore from my example code?
EDIT (edited):
After applying kiamlaluno's answer: So If I call the drupalSettings in the console I see my assigned variable in there. But if I try to reach that variable from within (function ($, Drupal, drupalSettings) {} I get a cannot read property of undefined, obviously as logging drupalSettings logs undefined. When I remove the drupalSettings from (function ($, Drupal, drupalSettings) {}, I can reach my variable through drupalSettigs.myVar.
I, obvjously, should have included the drupalSettings in the final parentheses of the closure, like so (thank you @kiamlaluno):
(function ($, Drupal, drupalSettings) {
  Drupal.behaviors.portalCore = {
    attach(context, settings) {
      ...
    },
    functionName() {
      // Do stuff
    },
  };
})(jQuery, Drupal, drupalSettings);


texts: Commerce Coupons, Discounts, and Tax not appearing on Checkout Review page

texts:
So I'm able to apply coupons on the Checkout page. Quantity-based discounts also appear on the Checkout page. As does basic state-based Sales tax. But, when you continue from there, you select a shipping service, and then continue to Checkout review. At this point, the coupon is gone, as are the discounts and tax.

The coupon entered still appears in the form, but the Granted Amount is now $0.00.

I'm losing my mind on this one because I'm dealing with a site that is (was) 95% complete when this started happening. I must have introduced something stupid along the way.


texts: How do I add a filter to a checkbox list in a content editing form

texts: I have a taxonomy select field within a node form (7). I've chosen checkboxes and it is hard to scan them. I'd like to be able to add a filter so that the user can enter text to limit the number of choices in the list. How?


texts: profile2_load only working for current user

texts:
I have overridden page.tpl.php for a profile type and am trying to load a profile from the template. It is not working as expected. I can only load a profile for the currently logged in user but not for other users.

I want to load the profile for the user whose profile is currently being viewed. The pid is passed in from the url so that arg(1) is the pid. Here is what I'm trying

$pid = arg(1);
$profile = profile2_load($pid);
var_dump($profile);

The var_dump returns: bool(false)

I'm doing this logged-in as admin and admin has a pid=15

$profile = profile2_load(15);
var_dump($profile);

This returns a fully loaded profile.

As an experiment I tried profile2_load_by_user and the result is similar. For the user currently being viewed with pid=15 the uid=7

$profile = profile2_load_by_user(7);
var_dump($profile);

var_dump returns: array(0) { }

Doing the same for the currently logged in user (uid=1)

$profile = profile2_load_by_user(1);
var_dump($profile);

returns a fully loaded profile

I have checked permissions for profiles and "My Profile: View any profile" is set for 'Authenticated user'.

So it appears that I can load a profile for the currently logged in user but not for any other user. Anyone know how to resolve this?
Thank you!


texts:
I am using Drupal 8 to create a website for training purposes. The user roles are Trainer, Trainee. I have content type session where I get to allocate the trainer for a particular date. It is done by user reference.

By using rules I want to sent notifications to the trainer regarding the scheduled session. But I am not able to achieve this.

Is there any other way I can sent notifications to the trainer other than using Rules module? Please help.


texts: How do I nest two field in my node.tpl.php?

texts:
I have two fields of multiple values. When I print render($content['field_photo']) and render($content['field_photo_caption']) I get:

caption

caption

caption

How do I nest the values to get:

caption

caption

caption


texts: How to theme a menu in drupal 7 with this html

texts:
Home
The card of flight

News
The actual & promo

Compagnies
More details

Airports
Prepare your travel

Forum
The community


texts: Why doesn't my custom entity work in an entity reference field?

texts:
I've got a custom entity with bundles that I want to be able to use in an entity reference field in a different entity.  So, I've got an the content entity for my entity type:

/**
 * Defines the Redacted teaser entity.
 *
 * @ingroup redacted
 *
 * @ContentEntityType(
 *   id = "redacted_teaser",
 *   label = @Translation("Redacted teaser"),
 *   bundle_entity_type = "redacted_teaser_bundle",
 *   bundle_label = @Translation("Content type"),
 *   handlers = {
 *     "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
 *     "list_builder" = "Drupal\redacted\RedactedTeaserListBuilder",
 *     "views_data" = "Drupal\redacted\Entity\RedactedTeaserViewsData",
 *
 *     "form" = {
 *       "default" = "Drupal\redacted\Entity\Form\RedactedTeaserForm",
 *       "add" = "Drupal\redacted\Entity\Form\RedactedTeaserForm",
 *       "edit" = "Drupal\redacted\Entity\Form\RedactedTeaserForm",
 *       "delete" = "Drupal\redacted\Entity\Form\RedactedTeaserDeleteForm",
 *     },
 *     "access" = "Drupal\redacted\RedactedTeaserAccessControlHandler",
 *     "translation" = "Drupal\node\NodeTranslationHandler",
 *   },
 *   base_table = "redacted_teaser",
 *   admin_permission = "administer RedactedTeaser entity",
 *   translatable = FALSE,
 *   entity_keys = {
 *     "id" = "id",
 *     "uuid" = "uuid",
 *     "bundle" = "type",
 *     "langcode" = "langcode",
 *     "user_id" = "user_id",
 *     "created" = "created",
 *     "changed" = "changed",
 *   },
 *   links = {
 *     "canonical" = "/admin/redacted_teaser/{redacted_teaser}",
 *     "edit-form" = "/admin/redacted_teaser/{redacted_teaser}/edit",
 *     "delete-form" = "/admin/redacted_teaser/{redacted_teaser}/delete"
 *   },
 *   field_ui_base_route = "entity.redacted_teaser_bundle.edit_form",
 * )
 */

And the config entity for my bundles:

/**
 * Defines the Redacted teaser bundle entity.
 *
 * @ConfigEntityType(
 *   id = "redacted_teaser_bundle",
 *   label = @Translation("Redacted teaser bundle"),
 *   bundle_of = "redacted_teaser",
 *   handlers = {
 *     "list_builder" = "Drupal\redacted\RedactedTeaserBundleListBuilder",
 *     "form" = {
 *       "add" = "Drupal\redacted\Form\RedactedTeaserBundleForm",
 *       "edit" = "Drupal\redacted\Form\RedactedTeaserBundleForm",
 *       "delete" = "Drupal\redacted\Form\RedactedTeaserBundleDeleteForm",
 *       "default" = "Drupal\redacted\Entity\Form\RedactedTeaserForm"
 *     }
 *   },
 *   config_prefix = "redacted_teaser_bundle",
 *   admin_permission = "administer site configuration",
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "label",
 *     "uuid" = "uuid"
 *   },
 *   links = {
 *     "canonical" = "/admin/structure/redacted_teaser_bundle/{redacted_teaser_bundle}",
 *     "edit-form" = "/admin/structure/redacted_teaser_bundle/{redacted_teaser_bundle}/edit",
 *     "delete-form" = "/admin/structure/redacted_teaser_bundle/{redacted_teaser_bundle}/delete",
 *     "collection" = "/admin/structure/visibility_group"
 *   }
 * )
 */

I then try to use that in an entity reference field in another entity:

->setSetting('target_type', 'redacted_teaser')

But when I go to create an instance of this entity, the reference field isn't getting any of my bundle instances.

I've also try adding an entity reference field to a content type in the UI.  The field settings recognize my defined bundles when I'm setting up the field, but when I go to create a node of that content type the entity reference field doesn't pick up any of my bundles instances there, either.  I've compared my annotations to those in Node and NodeType and don't see that I'm missing anything.  I've also stepped through with Xdebug, and I can see that when my create form loads, it's getting "redacted_teaser" as the expected type for the reference field.

Everything else about my entity and bundles works just as expected.


texts: Drupal entity metadata wrapper no bundle property

texts:
Using <?php
$wrapper = entity_metadata_wrapper('node', $nid);
?>

When I $wrapper->title->value(); I get error msg that property Title does not exist....

Using Entity 7.x 1-8 and D7.56. I am aware that $nid can be a node (from node_load) or a node id.

What am I missing?


texts: form_set_error() redirects to raw ajax response page

texts:
I have a page with a simple view.  Above the view there is a menu link that when clicked loads a node form with a required file field.  The form is fetched and loaded using ajax_commands into a div on the current page.

The problem is when I submit the form without providing a file for the required file field (intentionally triggering error), form_set_error redirects the user to the menu path originally called to produce the form (sitename-ajax/new-profile), which displays an unrendered ajax response.  How do I get the validation response and return it to the target div on the same page - preventing a page redirect?  Code pasted below is simplified for reference.  Thanks!

In my hook_menu():

$items['sitename-ajax/new-profile'] = array(
  'title' => t('New Profile'),
  'type' => MENU_CALLBACK,
  'page callback' => 'sitename_ajax_new_profile',
  'access arguments' => array('access content'),
);

Page callback:

function sitename_ajax_new_profile() {
  $form = sitename_forms_prepare_form('ps_profile');

  $output = drupal_render($form);

  $commands = array();
  $commands[] = ajax_command_html('#new-form-target', $output);

  $page = array('#type' => 'ajax', '#commands' => $commands);

  ajax_deliver($page);
}

Form helper function:

function sitename_forms_prepare_form($type) {
  global $user;
  module_load_include('inc', 'node', 'node.pages');

  $node = (object) array(
    'uid' => $user->uid,
    'name' => (isset($user->name) ? $user->name : ''),
    'type' => $type,
    'language' => LANGUAGE_NONE
  );

  $output = drupal_get_form($type . '_node_form', $node);
  return $output;
}


texts: How do change the value of a session before form submission

texts:
I created a custom module that allows users to enter their information, and during the form submission, I set a session with the name that they type in the form:

$session = \Drupal::request()->getSession();
$session->remove('contact_first_name');
$session->set('contact_first_name', $form_state->getValue('first_name'));

Next, I set the name as a variable to be used on another page that I created as a thank you.

mytheme.theme:

function scottishleader_preprocess_page(&$variables) {
    $variables['signupname'] = \Drupal::request()->getSession()->get('contact_first_name');
}

Inside a template, I am now able to use the "signupname" as a variable.

But now I noticed that if the user goes back to the form and enters different detail, after the submission, the signupname" variable still return the name of the previous session.

Question: How can I delete or empty this specific session before the form gets submitted?

NOTE: I cannot destroy all the sessions because there is a session that must always be kept alive.


texts:
I am customizing my sub-theme and looking to see where to place styling rules. My web inspector is not showing me the specific files where the base theme rules are, it just show that all the rules are in foundation_subtheme.css.  I don't believe that I have any aggregation turned on, what do I need to do to see the specific files that the styling rules are inside of?

For example, how do I fine this rule?

.top-bar input, .top-bar select, .top-bar .button, .top-bar #contact-btn, .top-bar .button-ghost, .top-bar button {
    font-size: 0.875rem;
    height: 1.75rem;
    position: relative;
    top: 0.53125rem;
}

Even when I add a rule to _header.scss the web inspector doesn't show me that its there it only shows the main css file.


texts: Manually populating fields using SQL queries

texts:
I have created a new field on an existing content type. The field is called "Global News." It's a checkbox and I need it to be checked for all existing nodes. I ran a SQL query to gather all nodes of a specific type joined with the latest revision ID. Both the "field_data_field_global_news" and "field_revision_field_global_news" tables are populated with the correct fields but the checboxes remain unchecked. Is there another table I need to update so this field is linked to the correct nodes?

I tried editing one of the nodes manually, which worked, but the table entry remains the same which leads me to believe there is another table that needs populating.

Any ideas?


texts: Can I display video from youtube and file system in the same field?

texts:
I am using Media (7.x-1.4), Media: YouTube (7.x-2.0-rc4) and MediaElement (7.x-1.2) modules for drupal 7.

I have a video field where you can upload videos or enter a youtube url, thanks to the media module.

The problem is, I cannot display videos from the two sources. If I choose "rendered file" in the "Manage display" settings, the youtube video displays, but the local file is given as a link. If I choose "media element video", then the local video is displayed, but the youtube one will not.

Is there a way that I can display videos from both sources?


texts:
I am using Drupal 7

i am tracking login and setting errors but my error is not working properly

here is my code

  <?php

    function zloginsecurity_form_alter(&$form, &$form_state, $form_id)
    {
        switch ($form_id)  {
        case 'user_login':
        case 'user_login_block':
           $form['#validate'] = zloginsecurity_validators();
          break;
      }
    }

    function zloginsecurity_validators() {
        return array('user_login_name_validate', 'user_login_authenticate_validate', 'user_login_final_validate','zloginsecurity_validate');
    }

    function zloginsecurity_validate($form, &$form_state) {
           if (empty($form_state['uid'])) {
            //Check user Track Record
            echo "hello";
     form_set_error('name', t('hello test'));
          }else {
              zloginsecurity_removeevent();
            //Delete Track Records for Particualr user
        }

    }

 ?>

it is not showing hello test, it is showing default message .  Can anybody tell me how to solve this issue.   simple echo is working

Thanks


texts:
I am building an application for a university where teachers will submit questions(MCQs) into Topics(Vocabulary) containing many terms infact in hundreds.

Our business logic is so that teachers will be allowed to submit questions only of their respective academic field, so we need to limit the list of topics to teachers based on their area of field. For example computer science teachers will submit questions in computer science term and its children.

So basically what I want it, something like one role per taxonomy term, I tried the Taxonomy Access Control module and the user permission module, but to no avail.

Is there a better solution for limiting taxonomy terms per user? Not per role or should I then create a role against every taxonomy term?


texts: Why is my Twig Override not displaying any content, when the original Twig was barely different and worked just fine?

texts:
I'm overriding a Twig template for the responsive_menu module, and encountering an issue with content not displaying.

The original Twig is named responsive-menu-horizontal.html.twig and my replacement is named block--responsive-menu-horizontal-menu.html.twig. Please note that the name of the replacement was derived from my Inspect Element debugger's suggestions.

The two Twig pages are almost exactly the same, save for the names and the added classes for the ul and li pieces

![1]: https://i.stack.imgur.com/T25DZ.png

When I use my override for the default Twig page, the nav completely disappears, and my debugger leaves me with this:

<!-- BEGIN OUTPUT from 'themes/indyres/templates/block/block--responsive-menu-horizontal-menu.html.twig' -->
<!-- END OUTPUT from 'themes/indyres/templates/block/block--responsive-menu-horizontal-menu.html.twig' -->

I'm confounded as to how it'll read my overriding template and render nothing. Any help/explanation is greatly appreciated, this is the first Drupal project I've ever worked on, and though I managed to keep my head above water in creating the styles for the rest of the site, this piece has me really lost.


texts: Showing the date of the latest edit, instead of node's posting date

texts:
I have some nodes I update frequently, but in content pane I can see the posting date of node.

How can I make Drupal 7 show the date of the latest edit, instead of the posting date?


texts:
I am using two themes, one which is Mobile jQuery based that is presented to any mobile user. Also, I am using a jQuery lightbox module that is enabled for visitors on the desktop site to view a gallery of images in a lightbox. Going back to the mobile theme, I have a javascript file containing some jQuery logic to strip out certain attributes from my links as a result of the lightbox module. I would like to disable lightbox module for this theme, but I have no idea on how to do it.

To counter the effects of this module, I am writing the following function. The purpose of it is to parse every link, and if that link's 'href' attribute ends with jpg, png, gif, or pdf, I change that link's 'ajax-data' or 'rel' attributes. The following is my code.

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

        $('a').ajaxComplete(function(event, xhr, settings) {
            if ($(this).attr('href').match(/[.](jpg|png|gif)$/)) {
                $(this).attr('ajax-data', 'false');
            } else if ($(this).attr('href').match(/[.](pdf)$/)) {
                $(this).attr('rel', 'external');
            }
         });
        }
    };
}(jQuery));

This code does not necessarily work, but the following does. However, the following only works on page load, and not after a page has been loaded via ajax:

(function($) {
    Drupal.behaviors.my_theme = {
        attach: function(context, settings) {
            // Automatically discover document links and apply the following attribute.
            $('a[href]').each(function() {
                if ($(this).attr('href').match(/[.](jpg|png|pdf)$/)) {
                    $(this).attr('ajax-data', 'false');
                }
            });
            alert('success');
        }
    };
}(jQuery));


texts: Is there a way to filter a view by whether the item is set to <front>? Seems simple but it's not as easy as I'd have guessed.


texts: modifying results displayed for Search API Live results module

texts:
I really like the SEARCH API and have been playing with Search api live results. I have two questions about this though:

Is there a way to bold the the part of the live search result that matches what i've typed so far? Ex: if i've written "cat" and there's a node with the title "caterpillar" the live search results will show "caterpillar" I know that Search api autocomplete does something, but I was wondering how to do so with this module. I did check out this tutorial but I want to modify the content that appears below the search box, not in the search page.

My second question is: Is there a way to have the results (again, not the ones on the search page, but the ones generated below the search box) organized in subsections, by contentype.Ex: I type cat and there are results of content type a, content type b, content type c.

Contenttype a
cat a1
cat a2
Contenttype b
cat b1
Contenttype c
cat c1
cat c2

Would I be able to do this with a view or would I have to write code to do this?

----------------UPDATE------------------
I think I found the function that generates the html for the live results. I’ve attached an image of it.
In this function, I can see how a live-result-search-item div is created but I haven’t quite fully figured out how they generate the href inside it. I feel like it's done in another jquery function which I've also attached an image of.  I posted an answer. I still haven't figured out how to group items by content type though.


texts: autocomplete instant results in select options

texts:
I am trying to have my select options filled with autocomplete results.
I have two fields, a textfield and a select(box). Autocomplete is working on my textfield. The thing that I am trying to get done is to have the results from autocomplete populate the options of my select(box)

How can this be done? Below a snippet of my autocomplete function:

function _cities_autocomplete($string) {

    $matches = array();
    $result = db_select('tabel', 'c')
        ->fields('c', array('product', 'w'))
        ->condition('product', '%' . db_like($string) . '%', 'LIKE')
        ->range(0, 10)
        ->execute();

    // save the query to matches
    foreach ($result as $row) {
        $matches[$row->product] = check_plain($row->product) . ' w:' . ($row->w);
        }
    // Return the result to the form in json

  drupal_json_output($matches);
}

I tried using the code below instead of drupal_json_output() .. this is throwing an error.

return array(
   '#id' => 'overzicht_producten',
   '#type' => 'select',
   '#maxlength' => 60,
   '#value' => 'some value',
    '#options' => array( 0 => 'test1',  1 => 'test2',  2 => 'test3'),
 );

I accomplished to have dependent dropdown from the ajax example working. But the dependent select(box) is only populated after the textfield is losing focus, this is not desirable. I need to have my select(box) options populated exactly as autocomplete is populating the options below the textfield.

Many thanks in advance,


texts: What is internalviewpath in html template suggestions

texts:
Top of the list of template suggestions for the html template says:
html--[internalviewpath].html.twig

The internalviewpath part is confusing. Is it a normal path(eg: node/123)? Is it related to views module? Why combine the words "view" and "path" and not just "path" or "internalpath"? The only views related path I know is that used in views page view mode(vs block view mode). The document simply states the above but no further explanation given.


texts: Is there a Drupal tool to aggregate and compress CSS files

texts:
I know that Drupal 7 has settings for Aggregate and compress CSS files and Aggregate Jacascript files (under Administration/Configuration/Development/Performance).

Is there a tool that let me extract the result of this process?

I am using Sass and Compass, so I guess that to produce an aggregate and compressed .css, I could set output_style = :compressed in Compass and the just concatenate together all the separate .css files, but that won't resolve conflicts or combine overlapping CSS selectors.

I wonder if there are some better way to do this, for instance making use of the Drupal built-in tool that apperently is designed specifically for the job.

This is for a Zen sub-theme.  The Zen STARTERKIT produces a lot of CSS-files, and before making this sub-theme generally available, I would like to "clean up" the distribution by consolidating CSS and Javascript into two aggregate and compact files.

(Outside the Drupal universe, YUI compressor seems to be the most popular tool for this.)


texts: Views relatonship with multi value field - and views distinct

texts:
I have a View that shows a list of Classes (nodes) and the relevant Teachers (Users) on my system. It is designed to show one class per table row and then a comma seperated list of the users who belong to this class.

As my "relationship" in the View is a user reference field (multi valued) then I get a list of Classes and teachers names next to them (as this uses the relationship to find Profile2 fields of First Name, Surname etc). But it causes duplicate nodes. I have tried using Views Distinct but you can see what happens below. I can get rid of the duplicates but it doesn't give any way for me to have a comman seperated list of my rewrote ouput of Users.

In my example there are 3 users referencing "Year 2" but when I try to eliminate the duplicates - it only shows one teacher next to that class. Is there a way around this duplicate, multi valued, relationship issue in Views?


texts: Main menu is hidden from unauthenticated users

texts:
I am using a slightly modified Responsive Batrik theme. The odd thing is that the main manue and site logo are hidden from unauthenticated users. When they log in, they can see the menu and logo.

I'm wondering why this happen and how to solve it?


texts:
I have configured my application and simplesamlphp behind reverse proxy. I have created a test SP But when I am going to test the SP, it redirects to https://web-server-ip/adfs/ls/?SAMLRequest=nZL instead of redirecting to ADFS server url https://adfs.server.com/adfs/ls/?SAMLRequest=nZL

I have changed the baseurlpath in config.php to "https://web-server-ip/simplesaml/". But still same error.

SP is working with App server. If I am trying to test the SP using https://app-server-ip/simplesaml, it redirects to ADFS server login.

But no luck via web server.

Please suggest any solution.


texts: website shows unavailable while taking DB backup?

texts: My website is created using Drupal 7 on one instance of amazon & database is on amazon RDS . whenever i am taking backup of database using Mysql with root user & simultaneously when a developer try to clear the cache on the website that time website goes offline untill backup gets over say for around 30 min this happens everytime . what is the solution to avoid this problem . I am using inodb storage engine & using MYsql Administrator application to take backup with all tables selected.


texts: How can I insert a variable from a preprocess function in template.php to Block Body in admin

texts:
Seems like a pretty easy thing to do, but I am having a hard time in using a variable from function theme_preprocess_block(&$variables, $hook) in template.php in a Block body in admin.

For example, in template.php, I have:-

function theme_preprocess_block(&$variables, $hook) {
  $variables['theme_url'] =  base_path().drupal_get_path('theme', variable_get('theme_default', NULL));

}

From here, I want to use theme_url variable in Block Body in admin as shown:-

It's not happening through the shown way. Any idea how I can achieve that?

Thanks.


texts: How do I manage collaborative development on a Drupal site?

texts:
I work with another developer on a Drupal site. We have struggled to find a good way to work on different parts of the site at the same time without getting in each others way. We've tried working on the same development instance of the site, but we often step on each others toes, or bring down the site with some bad code making it impossible for the other to continue working until it's resolved. So we've moved to separate development instances. But now it's a big pain to merge our work into a single instance of the site. We basically end up redoing everything on a shared copy.

The biggest problem we have now is how do we merge database changes, and how do we include the database in our source control system? The files are easy, just track them all (we use git) and merge our work, resolving conflicts where needed. But this doesn't really work with the database. We can take a SQL dump and include that in our git repository, but we can't really merge the databases. The Features module helps a little, letting us export some of our database work into code which can then be versioned and merged. However, not even close to everything supports Features. So...

What steps can we take to easily merge our database changes?
How should we version the database (is putting a dump file in git a good way to do it)?
Are there any modules available that help with some of these problems?
Or, are we stuck with working on the same copy of the site? (please so no)

Edit: In the comments we discussed what things can't be exported with Features and one of them was Taxonomies. There's another question that deals with that.


texts: Varnish 4.0 (authcache) not working for authenticated users on drupal 7.41

texts:
I've configured Varnish 4.0 through authcache and its working perfectly fine for anonymous users but for authenticated users it always shows "MISS" both in authcache debug and browser response headers. Drupal logs shows following message:

"Varnish: Cache-Control header with max-age=0 on response. Varnish will not store this response." But on checking response headers in browser shows "max-age=432000"

        #######
Accept-Ranges: bytes
Age: 0
Cache-Control: public, max-age=432000
Connection: keep-alive
Content-Encoding: gzip
Content-Language: en
Content-Length: 6663
Content-Type: text/html; charset=utf-8
Date: Thu, 04 Feb 2016 07:17:31 GMT
Etag: "1454570251-1-21a69a4"
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified: Thu, 04 Feb 2016 07:17:31 GMT
Server: Apache/2.2.15 (CentOS)
Set-Cookie: SESS6621be2effc350e524c26ac1457d7607=t_EB-SqlJSlYCNxf0hxozSMSx1O-2p6Sj9K24erZMV8; path=/; domain=.forumies.co.in; HttpOnly
Vary: Accept-Encoding, Cookie
Via: 1.1 varnish-v4
X-Generator: Drupal 7 (http://drupal.org)
X-Powered-By: PHP/5.6.17
X-Varnish: 163934
X-Varnish-Cache: MISS
x-content-type-options: nosniff, nosniff
#########

Below in my default.vcl

    include "/var/www/html/sites/all/modules/authcache/modules/authcache_varnish/varnish-4/core.vcl";

sub authcache_key_path {
  set req.http.X-Authcache-Key-Path = "/authcache-varnish-get-key";
}

sub authcache_key_cid {
  if (req.http.Cookie ~ "(^|;)\s*S?SESS[a-z0-9]+=") {
       set req.http.X-Authcache-Key-CID = "sess:"+regsuball(req.http.Cookie, "^(.*;\s*)?(S?SESS[a-z0-9]+=[^;]*).*$", "\2");
  }
  else {
      set req.http.X-Authcache-Key-CID = "host:"+req.http.host;
  }
}

/**
 * Place your custom vcl_recv code here.
 */
sub authcache_recv {
     if (
      req.url ~ "^/admin$" ||
       req.url ~ "^/admin/.*$" ||
       req.url ~ "^/batch.*$" ||
       req.url ~ "^/comment/edit.*$" ||
       req.url ~ "^/cron\.php$" ||
       req.url ~ "^/file/ajax/.*" ||
       req.url ~ "^/install\.php$" ||
       req.url ~ "^/node/*/edit$" ||
       req.url ~ "^/node/*/track$" ||
       req.url ~ "^/node/add/.*$" ||
       req.url ~ "^/system/files/*.$" ||
       req.url ~ "^/system/temporary.*$" ||
       req.url ~ "^/tracker$" ||
       req.url ~ "^/update\.php$" ||
       req.url ~ "^/user$" ||
       req.url ~ "^/user/.*$" ||
       req.url ~ "^/users/.*$") {
     return (pass);
   }

   if (req.http.Cookie) {
     set req.http.Cookie = ";" + req.http.Cookie;
     set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
     set req.http.Cookie = regsuball(req.http.Cookie, ";(S?SESS[a-z0-9]+|aucp13n|NO_CACHE|nocache|has_js|aucdbg|cache_render)=", "; \1=");
     set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
     set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");

     if (req.http.Cookie == "") {
       unset req.http.Cookie;
     }
   }
   if (!req.http.X-Authcache-Get-Key) {
     set req.http.X-Authcache-Get-Key = "get";
   }
}

sub vcl_backend_fetch {
  }

sub vcl_backend_response {
  if (beresp.http.Cache-Control ~ "(private|no-cache|no-store)") {
     set beresp.ttl = 0s;
   }
}

sub vcl_deliver {
     if (resp.http.X-Generator ~ "Drupal" && req.http.user-agent ~ "Safari" && req.http.user-agent !~ "Chrome") {
     set resp.http.Cache-Control = "no-cache, must-revalidate, post-check=0, pre-check=0";
   }
 if (obj.hits > 0) {
     set resp.http.X-Varnish-Cache = "HIT";
   }
   else {
     set resp.http.X-Varnish-Cache = "MISS";
   }
}


texts: Modules ".module" file not being called when anonymous user

texts:
I think I have a persmissions problem but I'm not sure how to resolve it.

I've made a custom block in a module called "people_passed". When I'm logged in the block displays fine, when I'm logged out the block HTML displays but the CSS does not. I've figured out that this is because people_passed.module is not being called and so the CSS is not displayed.

Here is the contents of my people_passed.info:

name = People Passed
description = A block that shows how many people passed in the last year.
package = Other
core = 7.x
files[] = people_passed.module


texts: RewriteRule fails if called after line 112 of .htaccess

texts:
I'm having an issue that is similar to this question.

In short, I'm trying to use some custom RewriteRules to point old (no longer functioning) urls to new working urls. To accomplish this, I'm trying something similar to:

RewriteRule ^oldsite/directory/ABCD(.*)\.html? /search/$1 [NC,R=301,L]

The issue is, this is completely ignored (as mentioned in the question linked to before.) However, I've noticed that if I move my RewriteRule from the bottom of the .htaccess file up a bit to line 112, which is:

# Pass all requests not referring directly to files in the filesystem to
  # index.php. Clean URLs are handled in drupal_environment_initialize().
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

The the rewrite rules work just perfectly fine. The answer to the previous question said that you couldn't use a clean url destination. So this would work:

RewriteRule ^home/code/([^/]+) ?q=home/software/node/&code=$1

but this won't:

RewriteRule ^home/code/([^/]+) home/software/node?code=$1

Problem is neither of them seem to work for me. I remember a few D7 updates ago there was an update to the .htaccess files. Could that be effecting this? Is there another way around this issue to get RewriteRules to work?


texts:
A theory/best practice question as opposed to a technical one. Should it be up to a module's code to format a timestamp into a date string, or the template that displays it?

E.g. the two ways of doing it (both with the same result):

MYMODULE.module

$variables['date'] = date('m-d-Y', $timestamp);
return theme_render_template('template.tpl.php', $variables);

TEMPLATE_FILE.tpl.php

<?php print $date; ?>

Or:

MYMODULE.module

$variables['date'] = $timestamp;
return theme_render_template('template.tpl.php', $variables);

TEMPLATE_FILE.tpl.php

<?php print date('m-d-Y', $date); ?>


texts: How to apply node access rules when querying menu_links table

texts:
I am creating a custom block which displays a menu.  The menu is constructed by retrieving certain menu links from the menu_links table in the database. It has occurred to me that building it this way could introduce a security issue, in the situation that a user does not have permission to view a certain node, but that menu link is still included in in the custom block.

I am wondering if there is some way of filtering results obtained from menu_links table based on current user role?

Menu links are currently being retrieved with queries like this one:

// Get all siblings of parent menu.
$siblings = db_select('menu_links', 'ml')
  ->fields('ml')
  ->condition('plid', $target['plid'])
  ->condition('hidden', 0)
  ->orderBy('weight')
  ->execute();

Actual menu structure is being constructed as a render array (basically each menu item is a link within a div wrapper).  Below is example of how a menu item is being constructed:

foreach ($siblings as $sibling) {
  $link = l($sibling->link_title, $sibling->link_path);
  $menu_item = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array('nav-level0'),
    ),
    'content' => array(
      '#markup' => $link,
    ),
  );
  $menu[] = $menu_item;
}


texts: Custom Webform handler not working on Wizard Webform

texts:
I am attempting to write a simple webform handler to add to the end of a multi-step webform, ultimately to generate a barcode with the submitted data. I've had success with other handlers on single step forms but it looks like the handler causes the wizard form to freeze and not progress to the next step.
My suspicion is that I'm missing something in my plugin code but I can't seem to find an answer to the problem in similar issues.
So far there's no functionality attempted in the handler because the form freezes on the first step.
Ultimately I only need this handler to fire upon final submission of my form.
I'm trying to test for the forms state with $webform_submission->getState() but I can't seem to get it right
  public function postSave(WebformSubmissionInterface $webform_submission, $update = TRUE) {

   $state = $webform_submission->getWebform()->getSetting('results_disabled') ? WebformSubmissionInterface::STATE_COMPLETED : $webform_submission->getState();
    if ($this->configuration['states'] && in_array($state, $this->configuration['states'])) {
       //do something

    }
  }


texts: How to place every node of a content type under a menu item?

texts: I'm looking for a module that will let me add every node of a content type as a link with a common parent link.


texts: I've got a view that generates a CSV report on user information. However, due to the size of the dataset it's causing the server to timeout. Is there some way that I can set the max_execution_time() or set_time_limit() just for this path?


texts: Where is the "Add fields" button on content types when using the Minimal installation profile?

texts:
I just installed Drupal 8.1.x and used the Minimal installation profile.

I added a new content type, but how do I add additional fields? I don't see a button anywhere.


texts:
We our developing a Drupal 8 Commerce website that does not need anything to do with addresses

The products are all virtual: membership and event tickets.
The billing is using PayPal express which takes care of billing address.

Therefore we don't want to prompt the customer to fill in an address, or store an address, or give them an "addresses" tab on their profile.  Please can anyone advise how to configure this scenario?

So far we have considered:

Edit the commerce flow.  The BillingInformation pane gets included via PaymentInformation.  If we remove PaymentInformation it does suppress the prompt for address and suppress the creation of a profile, but unfortunately it seems to stop the payment step from working properly.
Edit the customer profile form display to disable the address field.  This does suppress the prompt for an address, but we find that an empty profile is created for every order.
Delete the customer profile type.  We didn't try it yet because it seems likely to break the site as the Commerce core code has various hard-coded references to that profile type.

As an secondary question, we'd also prefer not to enter an address for the store as it does not have a physical address.  However the address seems to be mandatory and does not allow country=none.  We have entered a dummy value which seems to work as so far we haven't seen it used.  Can we trust the dummy address will never be used, and if so, would it be reasonable to say that the address ought to be an optional field?


texts: Creating a form that only show form fields for editing the node title, body, and any fields created using the field API

texts:
I have created a content type with some field API fields.

How can I create a edit form that allows to edit just the title, the node body, and those fields?

The normal node edit form contains extra form fields that are not necessary for my purpose (i.e. they are not for editing the parts of a node I listed).


texts: How can I trace the source of a redirect error listed in Administration -> Reports?

texts:
Under Reports -> Recent log messages, I have a large number of errors such as the following:

Type: access denied
Date: November 7, 2013
User: Anonymous
Location: https://mysite.com/ja/user/en/user/register
Referrer: http://mysite.com/ja/user/en/user/register
Message: user/en/user/register
Severity: warning

I have a multilingual site (English en and Japanese ja), so I assume that somewhere there is a bad link or a module is outputting a bad link to the registration page.  How can I find out where?  The only clue I have is this entry in the recent error log.

When I visit the link (http://mysite.com/ja/user/en/user/register), I get a "The page isn't redirecting properly.  Firefox has detected that the server is redirecting the request for this address in a way that will never complete."


texts: Site's settings file return blank screen

texts: I'm looking through a few of my drupal sites since the recent DRUPAL-SA-CORE-2012-003 security update. I noticed that on a few of them, if I navigate to the settings.php file location through the url. The browser is just a blank page. Does this mean I can access the settings.php file? Or is this the intended functionality due to proper permissions being set?


texts: Easiest way to export specific user-generated content?

texts:
I'm using Drupal 6.x on a site that has many users. There are about 20 "Pro" users that function as authors. I need to export an individual author's posts in order to later import them into WordPress. What might be the easiest way to accomplish this?

Bonus! I also need to export the comments associated with each article, AND change all comment authors to "Anonymous." Should I do that after the export through SQL, or is there an easier way?

I am looking into the Views module, but it's pretty far over my head... I would certainly prefer a simpler solution if that is possible.

Thanks for the help in advance!


texts: Disable user login, register and password reset

texts:
I am working on a Drupal 8 site that for all intents and purposes will be used as a company intranet. I'm also using the Social Auth Google module to allow only company-registered GSuite accounts to use the site.

I have tested this module, and it works great! However, I'd like to remove the /user/login, /user/register, and /user/password routes, as well as the associated tabs (as per screenshot below), to prevent anyone using anything but the Google Social Auth login feature.

Sure, I could use CSS to hide these elements, but that doesn't feel right to me.

I'd appreciate any guidance on how to achieve this.


texts: How do you get Product Variation Type fields and display modes to show up when displaying Products in a View?

texts:
I've created a Product Variation Type for all my products, all of which have the following custom fields: Display Title, Subtitle, and Top Rated Product? (boolean checkbox):

When setting up a View to display my Products, I am unable to access any of these fields, regardless of whether I choose "Fields" or "Content" under "Format > Show:". Nothing shows up:

I also can't access any of the display modes I created for Products — not even the default "Cart" display mode shows up here:

Am I missing something that's required to get this working properly? I can only choose "Fields", "Product", or "Search Results", and like I said, even when I choose "Fields", I can't find any of the custom fields for my Products.


texts: Listen to AJAX complete event from a behavior

texts:
I have a form that has an AJAX button.  When I click it, it updates a bunch of stuff as expected which is fine.

I was wondering if there is a way to create a listener in behavior that gets called when the AJAX call is complete?

Thanks


texts: Change AJAX processing icon and progress bar in Drupal7 using CSS

texts: Can I change the throbber/ajax loading icon and progress bar in Drupal 7 by adding new pictures and overriding CSS system files?


texts: Where to write hook_commerce_payment_method_info() in drupal8?

texts: I am migrating one of the drupal commerce related module from Drupal-7 to drupal-8.As I am newbie to D8, struggling to get proper structure in drupal-8. I have a hook that is hook_commerce_payment_method_info(). I am confused to where to write this hook. I am guessing it will be in .module file. please share your suggestions to me. So that I can move in right direction. Thanks in advance.


texts: Add content type machine name to an attribute in the body tag?

texts:
I figured this would be easily done in the template_preprocess_html function, but I haven't found a way to do it... yet.

I need to add the content type machine name to a "data-init" attribute in the body tag.  How can this be done exactly?

End result: <body ... data-init="content_type">


texts:
I am trying to create a simple static query just to see if the data exsits but I keep getting an error:

$result = db_query('SELECT * FROM field_data_field_product_id WHERE field_product_id_value = "mnbvcxz"');

if ($result->rowCount() > 0) {
  Do something
}

I get this error:

  PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'mnbvcxz' in 'where clause': SELECT * FROM field_data_field_product_id WHERE field_product_id_value = "mnbvcxz"; Array ( ) in validate_product_id_form_alter() (line 9 of sites/all/modules/validate_product_id/validate_product_id.module).


texts: How to prevent non-English characters from turning into jumbled words?

texts: Whenever I move database, even within the same server the non-English characters change into words that are unreadable. My site is not multilingual (it will be in the future) but users post products titles with accents and in French, Polish or another language. How do I retain the characters and prevent the jumbled words? Thank you.


texts: Can conditions be attached to how a Geofield is populated?

texts:
Some of my nodes will be created via Feeds, which will import lat/long data, which I can store in Geofield to pass to Leaflet.

However, some of the feeds I am using do not have lat/long data, so I think I will have to create it manually by using Addressfield, with Geocoder transforming the address data and passing it to Geofield.

Is there a way to easily set a condition where, if a node doesn't already have any lat/long data, it will let me add an address to pass to Geofield?


texts: drupal #default_value not working for #type radios

texts:
i am editing a form in drupal 7.1 and want to add a group of radios
    $form['yearofstudy']= array(
   '#title'=>'What is your year of study',
   '#type' => 'radios',
   '#options' => array(1=>'first year',2=>'second year',3=>'third year',4=>'fourth year',5=>'fifth year'),
   '#required' => true,
   '#default_value'=>array(1,0,0,0,0),
   );

The problem:
I intended the first option to be selected but this is what am getting

Please help.


texts: Enable/ Disable elements under 'edit' depending on role

texts:
I want some users to have access to certain items under the 'edit' tab but hide others...

I know you can allow a role to 'edit' or not 'edit' a published node content type but that enables and disables the whole of the edit tab!


texts: I have just updated the Internationalization and language_dropdown modules successfully after Drupal asked me to. Having done that, the site configuration when clicked every time, returns blank page. Sometimes when I click it twice, it returns a screen with a table of PHP errors of the the l10n update. This is frustrating. I know that this is regarding the update I made. But a bit of searching indicated that this is because l10n_update is still available in beta3 form.


texts: Create an exposed filter block from a BLOCK display output

texts:
I'm trying to show my views exposed filter as a block (so it's placeable in the block structure), from a block display. I understand if I was using a page display, I could just use "Advanced > Exposed Form" to show as block, but the option doesn't exist if the views' output is a block.

I've search everywhere, and I can't find any solution. Do you have any idea?


texts:
When I try the command

drush sql:sync @dev.dev @self or drush sql:sync @dev.dev @local it errors with:

Undefined class constant &#039;MYSQL_ATTR_SSL_CA&#039; in Drush\Sql\SqlMysql->creds() (line 60 of /Users/kevinquillen/Servers/foo/vendor/drush/drush/src/Sql/SqlMysql.php).
 [error]  Drush command terminated abnormally due to an unrecoverable error. [5.47 sec, 7.92 MB]
 [error]  Failed to import /tmp/foo_20180405_152230.sql.gz into target. [5.48 sec, 7.91 MB]

Previously, I could do drush sql-sync @source @destination and it worked just fine (from the host OS).

Not really sure where to go from here, I recently upgraded from Drush 8 to 9. The problem also happens on another project.

drush @local sql:connect -vvv works. A basic query with sql:query also works.

Why can't I sync from remote to local anymore after the upgrade?

Remote environment: Acquia Cloud

Local environment: DrupalVM

DrupalVM config.yml:

# Update the hostname to the local development environment hostname.
vagrant_hostname: local.mysite.com
vagrant_machine_name: mysite

# Set the IP address so it doesn't conflict with other Drupal VM instances.
vagrant_ip: 0.0.0.0

# Use Ubuntu 16.04 LTS to match Acquia Cloud environments.
vagrant_box: geerlingguy/ubuntu1604

# Set drupal_site_name to the project's human-readable name.
drupal_site_name: "My Site"

# Provide the path to the project root to Vagrant.
vagrant_synced_folders:
  # Set the local_path for the first synced folder to `.`.
  - local_path: .
    # Set the destination to the Acquia Cloud subscription machine name.
    destination: /var/www/mysite
    type: nfs

drupal_build_composer_project: false
# Toggling this to `true` would invoke `composer install` with the
# projects own `composer.json` successfully.
drupal_build_composer: false
drupal_composer_path: false
drupal_composer_install_dir: "/var/www/mysite"
drupal_core_path: "/var/www/mysite/docroot"
ssh_home: /var/www/mysite

drupal_db_user: drupal
drupal_db_password: drupal
drupal_db_name: drupal

# Set this to 'false' if you don't need to install drupal (using the drupal_*
# settings below), but instead copy down a database (e.g. using drush sql-sync).
drupal_install_site: false

# Drupal VM automatically creates a drush alias file in your ~/.drush folder if
# this variable is 'true'.
configure_drush_aliases: false

# This is required for front-end building tools.
nodejs_version: "9.x"
nodejs_npm_global_packages:
  - name: bower
  - name: gulp-cli
  - name: yarn
nodejs_install_npm_user: "{{ drupalvm_user }}"
npm_config_prefix: "/home/{{ drupalvm_user }}/.npm-global"
installed_extras:
  #- adminer
  - drupalconsole
  - drush
  - mailhog
  - memcached
  - nodejs
  #- solr
  #- selenium
  - xdebug

# PHP 5.6 (PHP 7.1 is being tested, see: https://docs.acquia.com/node/25726).
php_version: "7.1"
php_install_recommends: no
php_memory_limit: "256M"
php_display_errors: "On"
php_display_startup_errors: "On"
php_realpath_cache_size: "1024K"
php_sendmail_path: "/opt/mailhog/mhsendmail"
php_opcache_enabled_in_ini: true
php_opcache_memory_consumption: "192"
php_opcache_max_accelerated_files: 4096
php_max_input_vars: "4000"

php_packages_extra:
  - "php{{ php_version }}-bz2"
  - "php{{ php_version }}-imagick"
  - imagemagick

# XDebug configuration.
# Change this value to 1 in order to enable xdebug by default.
php_xdebug_default_enable: 1
php_xdebug_coverage_enable: 0
# Change this value to 1 in order to enable xdebug on the cli.
php_xdebug_cli_enable: 0
php_xdebug_remote_enable: 1
php_xdebug_remote_connect_back: 1
# Use PHPSTORM for PHPStorm, sublime.xdebug for Sublime Text.
php_xdebug_idekey: PHPSTORM
php_xdebug_max_nesting_level: 256
php_xdebug_remote_port: "9000"

post_provision_scripts:
  - "../../../acquia/blt/scripts/drupal-vm/post-provision.php"


texts: Using the youtube_uploader module, how do I upload the video as private, without hacking the module

texts:
I have been able to achieve what I need by changing the module here:

function youtube_uploader_get_settings_form() {
  $ret['youtube_uploader_publishing_options'] = array(
    '#type' => 'radios',
    '#title' => t('Default privacy options'),
    '#description' => t('More info on !here', array('!here' => l(t('YouTube support page'), 'http://support.google.com/youtube/bin/answer.py?hl=en&answer=157177'))),
    '#options' => array('public' => t('Public'), 'unlisted' => t('Unlisted'), 'private' => t('Private')),
    '#default_value' => strtolower(variable_get('youtube_uploader_publishing_options', 'unlisted')),
  );
  //Added: 'private' => t('Private') - being the added code.
}

How do I achieve this without hacking the module?


texts:
What would be the best way to make a custom registration twig template ?

I have implemented the hook :

function THEMENAME_theme_suggestions_form_alter(array &$suggestions, array $variables) {
    $suggestions[] = 'form__' . $variables['element']['#form_id'];
}

Si I get form twig template suggestions such as form--user-register-form.html.twig

Then I can call every value I want using "element" :

{{ element.field_name }}

My only problem is that I'm facing error with fields validation with ajax i.e for the picture field, when uploading a picture I got an error message that the picture size overpass the php limitsize from the server (which is obviously not the case).

So I have to call {{ children }}in my twig template to get it working properly. The only bad point is that calling {{ children }} actually call the whole form ......

Am I doing something wrong ? Is it the best way to accomplish stuff above ? Is it {{ children }} that I have to call to get the form working ?


texts: Users add payments to order without editing order

texts:
Use case is that users need to be able to "pay off" an order eg. Yearly Fees of $200, the user might pay it off sporadically $5 or $10 at a time until order balance reaches $0.

Users are able to add payments through admin/commerce/orders/%/payment if the permission "Edit own orders" is active. This however means that the customer is able to edit the order details (prices, products, status etc.) which is a problem.

Is there a workaround for this? Im coming up blank.


texts: Is Drupal Commerce ready for the real world?

texts:
I'm trying to make a decision between Drupal 6 + Ubercart and Drupal7 + Drupal Commerce... I'd much rather develop in 7 and am excited about Drupal Commerce but, as it is relatively young, have some concerns about its security and stability.

Does anyone have any relevant experience they would be willing to share?


texts: Resolution of Recaptcha Error in Drupal 7 forms

texts:
I am using Recaptcha module for filtering the spam on the form.
But the form contains some alax file upload field which stop recaptcha to work properly. Every time I upload the file in the form by AJAX it is giving me following message:

CAPTCHA session reuse attack detected.

This made me difficult to use the module. Please let me know if there is any work around to solve the problem.

I am just newbie in Drupal 7. If there is any better spam protection module than recaptcha then also suggest me.


texts: Views - comprehensive source for studying?

texts:
Making my first website I've been playing a lot with Views recently but I am still struggling to master both Relationships and Contextual filters. I've watched the video trainings provided in the views' section as well as passed through the docs but I think that's not deeper enough. Could you guys suggest some source for studying on this topic - a book, video series, web page ... ?
Much appreciated :)
BR, Ivan


texts: Change the amount of content displayed per page in Content Management -> Content

texts: I'm trying to do a CSV export of all my content, but it only shows 50 per page and I have 50+ pages. I want to be able to check all and export as one csv. Is there a way to change the pagination settings for Content Management -> Content?


texts: How do I force Twig output from my custom module, instead of from the theme?

texts:
I'm new to Drupal, I create a module including block and twig.
I want to call out my twig(modules/custom/footer_block/src/templates) and store data in there when execute build() in block.

However, it output a twig from theme folder(a templates folder inside the theme folder) that's is not created by me.

How can I force to output from my module folder?

The block is using the following code.

footerMenu_block.php.

public function build(){
    return [
        '#theme' => 'footer_menu',
        '#address_title' => $this->configuration['address_title'],
        '#address_content' => $this->configuration['address_content'],
    ];

footer-menu.twig.html

{{ address_title }}

{{ address_content }}

footer_block.module

<?php
function footer_block_theme($existing, $type, $theme, $path){
  return array(
    'footer_menu' =>
      array(
        'variables' => array(
          'address_title' => '',
          'address_content' => '',
        ),
      ),
  );
}

If I move the Twig to that output folder (inside theme folder), it will be unable to store my data.
If I make simple output '#markup' inside build() that will work fine. Therefore, other code in block should be working without problem.

I am using Drupal 8.6.x.


texts: add billing information in Drupal Commerce Programatically

texts:
I am developing api access point for drupal commerce, from that access point user can upload his/her billing information during checkout process. Here is my code, but it can not add user full name in billing information. Any suggestion is greatly appreciated.

Thanks

  function commerce_services_bill_ship_create($data, $flatten_fields) {
    $status; $message;
    $orderId; $uid;

    $orderId =$data["orderId"];
    $uid = $data["uid"];
    $fullname = $data['fullname'];

    $order = commerce_cart_order_load($uid);
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);
    $order_wrapper->commerce_customer_billing->commerce_customer_address->name_line = $fullname;
    $order_wrapper->commerce_customer_billing->commerce_customer_address->thoroughfare = "No.1, ABC street";

    $order_wrapper->commerce_customer_billing->commerce_customer_address->locality = "New York";
     try{
        // Save the order.
        commerce_order_save ($order);
        $status = 1;
        $message = "order update successfully.";
    }catch(Exception $ex){
        $status = 0;
        $message = "order can't update successfully.";
    }
    $reply= (array('status' => $status,'message' => $message));

    return $reply;
 }


texts: How can I solve my problem (PDOException: SQLSTATE[25P02])?

texts:
When I write in my blog I get this error:

  PDOException: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block: SELECT column_name, data_type, column_default FROM information_schema.columns WHERE table_schema = :schema AND table_name = :table AND (data_type = 'bytea' OR (numeric_precision IS NOT NULL AND column_default LIKE :default)); Array ( [:schema] => public [:table] => url_alias [:default] => %nextval% ) in drupal_write_record() (line 7239 of /var/www/site/includes/common.inc).

If I write in title some number like 1111 article adding, but if I write some words I get the error. I tried to write an issue about this.

Now I've already updated core to 7.33.

I've seen 26 version's core file common.inc and 33 function drupal_write_record and I didn't see any different and file too except some comment strings.

I've seen

  Major changes since 7.26:

  Modules which use custom Ajax form page callbacks require updates for Drupal 7.27

  This is expected to affect several popular modules such as Field Collection (issue) and Hierarchical Select (issue), although only in cases where the form widgets provided by those modules are exposed to anonymous users.

  Modules which provide alternative page cache implementations require updates for Drupal 6.31 and Drupal 7.27

  This is expected to affect modules such as Boost and Authcache.

  form_set_cache() now validates the passed-in form build ID

  This is not expected to affect most sites.

But I didn't see something what I can do. I get the error, how can I solve it?


texts: I'm using Drupal Cycle module and list field_images items. I check 'random' button, but it is not working. I want get random image every refresh page. How can do it? field_sort_items or anyway solution?


texts: Views - sticky items per page paginated using several displays (Hooks or UI way)

texts:
Hi and thanks for take the time to read this post.

(I want to know if exist some hook or User Interface way to make this)

I have two content types (content type X and content type Y), and I want to build one view that have the nodes of content types X and Y, but that shows always sticky items for X content type per each paginated page.

For example: the view will show 10 items per page.

to the first page --> the first 3 items will have positions 1,2,3 to X content type nodes, and the last positions 4,5,6,7,8,9,10 will have Y content type nodes.

to the second page --> the first 3 items will have positions 11,12,13 to X content type nodes, and the last positions 14,15,16,17,18,19,20 will have Y content type nodes.

I am reviewing modules like Nodequeue or Weight but I can not understand how to reach this using this modules (i think that this is a useful way with nodequeue: http://www.absolutecross.com/tutorials/drupal/custom-re-ordered-front-page-teasers but my question about how to sort automatically in the required way still is pending)

I must say that I have some aproximation to resolve this using a php snippet in one page: I use one pagination control that handle a SQL query with all results (all content types needed), and the other two SQL queries will call the respective quantity of data to each kind of content type (the sum of results of all individual queries, must be the number in the respective pagination parameter)...it works, but, like I already indicated, I want to know if exist some hooks way, or User Interface way, to make this because I will use several exposed filters that will change SQL queries.

Thanks in advance.


texts: change field from int to big int in drupal

texts:
I have a integer field in a custom content type, first we did't estimate that we have a data more than 2 147 483 647(max integer number_ , but I have some data that bigger than max integer range,
we input very data to that field and it not logic that install bigint module then remove integer field and create a bigint instead of it ( all of our data will lost),
I know I can change table in mysql database by myself,but maybe in future needs update drupal to newer version , what is your suggestion to me ?


texts:
I used Drupal 7.14, Video Module 7.x-2.5, VideoJS 7.x-2.0 HTML5 player, and ffmpeg 0.7.2 to transcode a 200mb mp4 video into Ogg, Flv, MP4 formats. The process worked, but took over 1 hour. Using the command line, I can file transfer and transcode same file in under 15 minutes.

Aside from upping server processing power, or wishing that Drush handled video transcoding via ffmpeg, is anyone else off-loading Drupal processes via PhP Process Forking, or Asynchronously via Javascript, ie. node.js?

Ideally, once I click save on any Drupal form, a child process should spawn and work on the side, as I go about doing other things, without my admin interface locking up to process one thing (synchronous coding). Thanks for your time,


texts:
I'm quite familiar with PHP but do not a clue of Drupal.
All I have to do is to add a captcha to the registration form. How do I do this and btw. where is this registration form module located.

I know that this a beginner's question, but nevertheless any help would be appreciated. :)

Cheers

Chris


texts:
I have field_employee and i want to get his default value from nid in url

../node/add/qualifications?field_employee=3617&destination=node/3617

To display it Like:
field_employee == $node->title; //As a default value


texts: "Strict warning: Only variables should be passed by reference in eval()" when concatenating several text fields

texts:
I am using Computed Field to concatenate a few text fields into one value. The text fields are pieces of a street address (the street address, the city, the state, and the zip code). When using the code below, I receive the error below.

COMPUTED CODE:

  $entity_field[0]['value'] =
  array_pop(array_pop(field_get_items($entity_type, $entity,
  'field_address'))) . ', ' .
  array_pop(array_pop(field_get_items($entity_type, $entity,
  'field_city'))) . ', ' .
  array_pop(array_pop(field_get_items($entity_type, $entity,
  'field_state'))) . ' ' .
  array_pop(array_pop(field_get_items($entity_type, $entity,
  'field_zip_code')));

DISPLAY CODE:

  $display_output = $entity_field_item['value'];

ERROR:

  Strict warning: Only variables should be passed by reference in eval()
  (line 1 of
  /home/mysite/public_html/sites/all/modules/computed_field/computed_field.module(468)
  : eval()'d code).

How can I resolve this issue?


texts: Why do form builders have a $form parameter?

texts:
In Drupal 8, the first parameter of FormInterface::buildForm() is $form.

When implementing a form builder, one has the option of either adding stuff to this existing array and returning it, or creating a new $form array, discarding what was passed into the function. In my experience, both of these options usually work fine.

What's the point? Is there ever a case when this parameter is needed?

I think to vaguely remember that this is somehow relevant when a form is rebuilt, so this would be the old form.. but I would not really know what to do with it.


texts: Deliver ajax commands on successful form submit

texts:
First of I apologize if this has been asked before, but I haven't found anything that actually does what I want to do.

Question: I'm trying to deliver some ajax commands on after a successful ajax submission of a form.

The Code

function my_module_form_form($form, &$form_state){
    $node = $form_state['build_info']['args'][0];
    $form = array(
        'track_id' => array(
            '#type' => 'textfield',
            '#title' => t('Track ID'),
            '#required' => true,
            '#prefix' => '
nid.'">',
        ),
        'courier' =>array(
            '#type' => 'textfield',
            '#title' => t('Courier Name'),
            '#required' => true,
        ),
        'actions' => array(
            '#type' => 'actions',
             'submit' => array(
                '#type' => 'submit',
                '#ajax' => array(
                    'callback' => 'my_module_form_ajax_submit',
                    'wrapper' => 'form-finished-wrapper-'.$node->nid,
                ),
                '#prefix' => '
',
                '#suffix' => '
',
                '#value' => t('OK'),
            ),
        ),
    );

    return $form;
}
function my_module_form_validate($form, &$form_state){
    // form_set_error('courier', 'catch all');
}

function my_module_form_ajax_submit($form, &$form_state){
    $return_form = array(
        'track_id' => $form['track_id'],
        'courier' => $form['courier'],
    );
    return $return_form;
}
function my_module_form_submit($form, &$form_state){

    $node = $form_state['build_info']['args'][0];
    $track_id = $form_state['values']['track_id'];

    $node->field_track_id[LANGUAGE_NONE][0]['value'] = $track_id;
    $node->field_courier_name[LANGUAGE_NONE][0]['value'] = $courier;
    node_save($node);

/* How can I deliver the below commands?

    $ajax_commands = array();
    $ajax_commands[] = ajax_command_invoke('myModal, 'modal', array('hide'));
    $ajax_commands[] = ajax_command_replace('form-finished-wrapper-'.$node->nid, t('Submited Successfuly'));
    ajax_deliver(array('#type' => 'ajax', '#commands' => $ajax_commands));

*/

}

Context

The form appears in a modal my_module_form_ajax_submit is responsible to display validation errors along with messages. I have tried ajax_delivery and ajax_render to return the commands. With ajax_render nothing happens, but with ajax_deliver I get an ajax popup with the commands in JSON. I think I'm close but surely I'm missing something.

Any help appreciated!


texts: "message": "X-CSRF-Token request header is missing"

texts: When using postman to fire post request I get this message. Does anyone has idea how to disable it? In this case it is post to register user so no authentification is required.


texts:
Normal scenario
In a custom form (created using FAPI) I have a fieldset definition:
$company_field_set = [
  '#type'  => 'fieldset',
];

If I would like to customize the fieldset template, I normally would create a hook_theme_suggestions_HOOK_alter function to add suggestions and then overwrite the template.
Alternative
I was wondering though why I wouldn't simply use the #theme key, so I tried this:
$company_field_set = [
  '#type'  => 'fieldset',
  '#theme' => 'my_custom_company_fieldset',
];

This does indeed render my custom template instead of fieldset.html.twig, but I don't get any variables in it. I would expect it to behave just like fieldset.html.twig.
I have tried several theme definitions:
// Same as default fieldset
'my_custom_company_fieldset' => [
  'render element' => 'element',
]

// Another tryout
'my_custom_company_fieldset' => [
  'render element' => 'children',
]

My template currently looks like this:
{% extends 'fieldset.html.twig' %}

I also tried:
{{ children }}

I see the template contents (like static text and such), but no variables.
I think I know a little bit too little about this and am missing something somewhere.
Could anyone point out my mistakes and/or tell me whether or not this is even possible?


texts:
I'm trying to update from Drupal 7.22 to the current (7.26) version. I keep getting the following error on the Configuration page after updating.

Fatal error: Class 'DatabaseTasks_mysql' not found in /server/path/stuff/here/domainname.com/html/modules/system/system.install on line 188

I have tried upgrading incrementally 7.22 -> 7.23
I've tried upgrading directly to 7.26
I've tried uploading files via FTP, following the standard upgrade instructions, and I've tried upgrading with drush. I always get the same error. (though the line number does change depending on which version I'm updating to.)

Does anyone have any suggestions?


texts: Track how many times a JSON file is requested from other websites

texts:
I developed a mobile site using html and angularjs, which displays all of data from my Drupal site. From a view that output JSON data. All data collect good from JSON, but i can't create a popular item list.

Since, drupal not update node view by json request. So, i think, if i collect total request of each json/view, i can filter by this from my mobile site. So, i need to display how many times this json/view is requested from other domain/website like statistics module.

Does any method to track how many times a specific JSON/VIEW is called or requested from another domain/website?


texts:
is it possible to sum field values and then show in one row, instead of column sum at footer over each page.
field collection values values1[2,3], values2[43,32], and values3[2]
over the view with aggregation sum function its give me SUM-values1[5], SUM-values2[75], and SUM-values3[2] (Total: 82).

I need to just show the result 'Total' parts even values may be 1000 or more but here how we can display only the whole sum value excluding list down values at top?


texts: Display Custom User Profile Fields in a Block on All of Their Published Pages

texts:
I have created a role, and have added additional fields to their profile using Profile 2. The fields are part of the location module, and are just basic contact info (address and phone number). They are also able to chose a name, which is used in the url for both their profile and content.

So, when a user creates their account, the url is site.com/their-name. When the user adds content the URL is site.com/their-name/content.

My goal is to display their contact info in a block on all pages they publish. I was able to do this for their profile page with the following view (see attached image). However, I would like this block to appear on all pieces of content that they author.


texts:
If I have a module in sites/all/modules named dc_front and then I have a module in sites/default/modules named dc_front, which one gets used when it is enabled?

It appears the module in default gets used.

Is this expected and reliable behavior?


texts: Site gone offline after aborted mysql restart

texts:
After trying new my.cnf, restarting  mysql took to long (apparently due to some incompatible commands in the experimental config) , so I restored to my original my.cnf and restarts mysql successfully. But now I see that the site has gone off line. I tried the 'desparate' solution, i.e. issued:

UPDATE variable SET value = 's:1:"0";' WHERE name= 'site_offline';
DELETE FROM cache WHERE cid = 'variables';

but had no effect. Then I changed my database admin credentials. then, to possibly counter a corrupted table, I tried to repaire the database (MyISAM enginge) using

mysqlcheck -uroot -pPASS --auto-repair --optimize --databases MYDB

I also rebuilt the file permissions on the server.

No cure either.

I'd seen before that the site went offline on whim, but now this seems to become persistent. really appreciate your help to overcome this nasty problem.


texts: How to get replacement pattern for Search API's fulltext search in global text area header

texts:
In Drupal 7, I'm currently using the default core search, and a view for node search results. I have a global text to pull in the replacement pattern for the term that were searched for. I get the token by adding the contextual filter Search: Search Terms I am using the replacement pattern %1 as seen in the picture:

Then I put You searched for:  %1  in my global text to display the keywords that were searched for:

This all works great for Drupal core search, but I am not finding a way to do this with the view in Search API? I am using Database Service, and a view built from the database index I created. I have tried to find a field such as keywords for the full text search, but since the view is based off of indexed content, I am not able to get those type of fields added, to make them available for tokens, even via relationships. Maybe there is a better way to build the view?


texts: ddev sequelace not connecting (how to debug?)

texts:
According to this https://ddev.readthedocs.io/en/stable/users/developer-tools/#database-management
we should be able to type ddev sequelace and have sequelace connect to the db server in ddev.
However it is failing and I'm not finding verbose output flags to turn on and ddev is a binary so am not sure if I'll be able to get to where the ssh (or tunnel) is failing. (see screenshot)

On other Drupal Devs like docksal we can go under the hood and turn on verbose and see where things are failing.  But I'm not sure how to do this with ddev.
I've tried replacing the 127.0.0.1 in the host with the server name that ddev gives the site but that fails connection too.  I also thought that my vpn might be messing with it but after disabling the vpn the connection still fails.
Thanks for any pointers!


texts: Variable storing payment method in ubercart order

texts:
Seems easy but I am not able to figure it. I am using ubercart module in drupal 7, I am few payment methods like paypal, innovate and free method. All the 3 payment methods are activated, When a user places any order he has to choose which payment method he want to go for, if he is going for free method,

I need to know which variable is storing this payment method value,it should be like $order->method or $order->type same like other variables like $order->order_id,$order->billing_first_name.

In short I should come to know which payment method is chosen for a particular order.

If any buddy knows please help me.


texts:
How can I rearrange the weight of the exposed filters?
In Drupal 6 I had that option, and in Drupal 7 it has disappeared.

Is there something I'm missing?


texts:
I'm working on a website for a client where he wants a order form created and e-mailed back to him.  Because of the nature of the business, the card cannot be charged until the order is verified that all the items are in stock and the shipping cost verified - then they charge the card themselves.  So the form is supposed to gather the card numbers.  The problem is that when I use a webform, it actually SAVES the credit card number!  YIKES!! I've created a PDF interactive form, which I think is a much better and safer option, but I can't get the PDF to display on the page like the customer wants.
Does anyone have any advice on what I should do or look into??
Thanks so much!!


texts:
I've created a views from comments. I want to have add comment form at the button of my views (in footer). so I installed "views_php" module and add "Global: PHP" to footer and write this code to print add comment form in footer.

$comment = new stdClass;
$comment->nid = $row->nid;
$form = drupal_get_form('comment_form', $comment);
print render($form);

but the problem is that I don't have comment_body or any other custom field in the printed form. actually just author, subject and save button.

I tried this code too:

print drupal_render(drupal_get_form("comment_form", (object) array('nid' => $data->nid)));

or

print drupal_render(drupal_get_form("comment_node_news_form", (object) array('nid' => $results[0]->nid)));

but none of them worked properly!


texts: How can I query the full component layout of a form?

texts:
I need to create a webform preview page for a client's website that uses many multipage webforms. The idea is to allow a preview so website users can prepare for the requirements of the form before they start.

I am currently extracting and re-printing the component data available via the webform_component_list() function, which is convenient but is very limited. The webform_component_list() function's purpose is for use in an email settings options list and preparing an email to be sent. Unfortunately I can't get it to display a hierarchy lower than the first level and their is no attribute data related to the form fields which I need to better loop through and add display formatting.

What functions/methods are available already through webform to access this dataset or do I need a DB query?

Picture of the limited formatting:

Note: I have looked through the webform module and various other files within the folder structure. I have already put work into this and have a working version, it just doesn't have enough data about the form structure to better layout the page during a loop. The purpose is a "webform preview page", i.e. a list of all components allowing users to see what they need. This is explained above. I would like insight from anyone who may have insight into the webform module.


texts: Which Views hook do I use to alter the view results page before it loads?

texts:
I have a view that I want to change two items right before the page loads - the title, and the zipcode that determins the location to filter by.

My module detects a person's location and replaces the default value in the Views filter so that the results are properly sorted by that area.

So, the title changes to 'Viewing items around Charlotte, NC' where Charlotte, NC is the dynamic element.

I have created a module, but I am not sure what views hooks I need to use to achieve the results, especially getting the view to execute with the new location.

Here are the views hooks for D7
http://api.drupal.org/api/views/views.api.php/group/views_hooks/7

Do I pre_view it? pre_render? Alter the query with the new location details before its executed?

Here is a sample of my module trying to use hook_views_pre_view

function zipcode_filter_views_pre_view  ( &$view, &$display_id, &$args) {

    $view = views_get_view('baby_clothes_pages');
    $view->set_display('default');
    $view->set_exposed_input(array('postal_code' => $zipcode));
    $view->display['default']->handler->options['title'] = $title;

}

note: this reference influeced the code I used. However, the documentation is wanting. Am I even on the right track with this? http://groups.drupal.org/node/10129


texts:
I managed to "hide" files using "private folders". The problem with this is that, when I upload an image called "cat.jpg", it will appear in the file system as "cat.jpg". If I then try to view it, the URL will be something like /system/files/styles/medium/private/cat.jpg?itok=fDHu1Q5k.

Is there a way to obfuscate the name, so that it will instead be something like /system/files/styles/medium/private/2342343534532122.jpg?itok=fDHu1Q5k?

To be clear, I want whoever uploads the file to be able to upload it as "cat.jpg". When it hits the file system, it must still be stored as cat.jpg. Only when it's opened displayed as URL, must the filename be changed. Yes, I know, changing the filename on upload would probably be easier, but there are just too many already uploaded files for me to consider this route, and I still want to be able to browse through the files on the filesystem using the original names.


texts: Modify Reference on Taxonomy Field Output

texts:
I want to modify the output of a 'Reference on Taxonomy Field'.
I created a 'Reference on Taxonomy Field' in a content type that relates to terms in a vocabulary that have a title and a picture.
The content type is displayed by a view that outputs the fields of the content type. I added the field and created the template file views-view-field--kategorieseiten--page--field-produkteigenschaften.tpl.php and it works.

It should be displayed like this:

OUTPUT_OF_THE_TERM_PICTURE

The problem is that I don't know how to address the fields from the taxonomy term, since they are not directly stored in the node.

Thanks for your help!


texts:
How exactly do I get a table header to appear above the table?
In views-view-table.tpl.php I can see a <thead> section, but what causes it to actually get rendered?
Where do I specify the column header text?
I tried various options in the settings page, but to no avail.


texts:
I decided to give a shy try to Drupal 8. Installation went quite smooth, but when everything was ready to hit the home page I was delighted with the following error:

  CRASH: PHP segmentation violation in method_exists() called at [/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php:72], in Symfony\Component\HttpKernel\Controller\ControllerResolver::getController() called at [/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:117], in Symfony\Component\HttpKernel\HttpKernel::handleRaw() called at [/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:73], in Symfony\Component\HttpKernel\HttpKernel::handle() called at [/core/lib/Drupal/Core/HttpKernel.php:52], in Drupal\Core\HttpKernel::handle() called at [/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php:197], in Symfony\Component\HttpKernel\Kernel::handle() called at [/core/includes/bootstrap.inc:2208], in drupal_handle_request() called at [/index.php:12]

How would I go about solving this? Is that something of a Drupal programming error? Is that something that depends on final configuration? I kind of don't believe this would massively occur to all people, so I assume it might be caused by something in my setup.

I'm running PHP 5.3.21 with a local php.ini setting the magic quotes flags to off.
Due to the hosting, I had to comment out the htaccess bottom part for gzip compression, if that matters.


texts: Views query alter for specific node/content type

texts:
My idea are instead of update the views
name to the custom code one by one. I like to apply to same content type, but
I don't know the syntax.

 function myModule_views_query_alter(&$view, &$query)

   if(($view->name == '?????????'){

}

I would get the node/content type "myArticle" for node table as following code

$content_type = $wrapper->type->value();

but how can I update $view->name to $views->node->type ? I try print_r the $view but not fully understand the syntax  to access the field. Not sure if I went in the wrong direction. Please advise.


texts:
I am having a problem removing the comments link from a page.
I am using Taxonomy and Tags, I added a term to Tags and gave it a URL alias such as tags/sandy_repair.
I created a new basic page and added that term to the page.
When you display the page it lists that tag at the bottom.
When you click on the tag link it takes you to the alias you created that would display the teasers of all the

pages with the same tags. So the tag links to tags/sandy_repair
On this page there is a comment icon and a link to 0 comments ()
I would like to remove that icon and comments link entirely.
The structure of the Basic page is not set to display comments, manage display does not even show comments and the

Comment Display tab has the comment field hidden.
The only thing I can figure is that this comment display is not coming from the basic page settings.


texts: Add class and extra HTML to specific menu items with hook

texts:
In page.tpl.php I have the following to echo out the main menu:

<?php if ($main_menu): ?>
        <?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'top', 'class' => array('links')))); ?>
<?php endif; ?>

The site is responsive so on desktop monitors it displays like this:

But as you reduce the screen to mobile size it turns into a navigation list that can be opened and closed with a button. See here:

However the desired effect is to have small descriptions for each of the menu items in the mobile version simply by using
little description
 wrapped within the menu li and a tags. See here:

I also want to add CSS class 'nobile' to tthe list item 'Home' in the menu so that it doesn't display on the mobile version.

So how can I add this CSS class to the 'Home'
? And how do I go about adding the link descriptions to each
? Can I use a hook in template.php? If so how do I go about this?

Thanks for your help!


texts:
Until now I'm calling a web service with using specific function like hook_user_logout, _validate, _submit..., but now I need to create a page that will display details that I'll receive results from the web service, but I don't know how to call when I enter lets say user/%/reports.

Also on that page there will be a link that will display more details that will come from the webservice.

Is there a function for page load, url open or something similar in Drupal 7?

Here's my part of the code when a user logouts.

<?php

function mymodyle_user_logout($account) {

    global $user;

    $username = $user -> name;
    $ip_address = $_SERVER["REMOTE_ADDR"];
    $session_id = session_id();

    $xml_string = '<some_method>
       <username>' . $username . '</username>
       <ip_address>' . $ip_address . '</ip_address>
       <session_id>' . $session_id . '</session_id>
       <language>en</language>
       </some_method>';

    $client = new nusoap_client('http://10.10.60.80:8090/CardHolderAuthentication.asmx?wsdl',  array('soap_version' => SOAP_1_1, 'trace' => 1, 'exeptions' => true));
    $client -> soap_defencoding = 'UTF-8';
    $client -> decode_utf8 = FALSE;

    $result = $client -> call('Logout', array('_xml' => $xml_string));

    //$response = simplexml_load_string($result['LogoutResult']);

    //$status = $response -> error->descr_bg;

}