texts: Expose Custom DB Tables to Drupal Views Error

texts:
I am trying to display an already existing table to Drupal Views. This table exists within my current Drupal Database, along with my Drupal tables.
The table's name is ACCOUNT_PNL and I would like to expose the fields in this table to Drupal Views.
I've followed the instructions here, but when I go and enable this module, I get the following error from my site:
DatabaseSchemaObjectExistsException: Table ACCOUNT_PNL already exists. in DatabaseSchema->createTable() (line 657 of /var/www/drupal7/includes/database/schema.inc).

I understand that the table already exists, but isn't the tutorial code supposed to only "expose" it to Views so I can then use Views to display it?
Perhaps there is an error in my understanding, any help would be appreciated.


texts: How do I create a folder structure inside a view

texts:
I have created a view to get the all images that I have used in the website.  But it returns as a bulk list. But I have saved the images according to a folder structure. How do I get the images according to a folder structure in my view.

Below is my view

Currently it returns a bulk list. How do I get the images with the folder structure?

For an example I need to get the /path1/path2/image.jpg inside a folder named path1 which contains a folder named path2.


texts:
This may be a silly question, but I'm curious what the benefit is of using a list (text) multiple select field over a taxonomy term reference field. They both seem to fill roughly the same function of giving predetermined multiple choice options, but taxonomy has the added benefit of allowing you to add terms after content has been written to the database.

So is there any good guideline for one to use one or the other? (And particularly when list(text) makes more sense than taxonomy term reference?).


texts: How to use the Rules module for assigning a role during user registration based on a select field option?

texts:
I need to assign a role to user based on select field at the time of registration.

I have added a field in user registration form (ex: school checkbox) . When user click on school I need to assign a school role to user . otherwise default user role assign by drupal. For this I tried to create role but its not working.

{ "rules_user_reg" : {
    "LABEL" : "user reg",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "user_insert" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "account" ], "field" : "field_selector" } }
    ],
    "DO" : [
      { "data_set" : { "data" : [ "account:roles" ], "value" : { "value" : { "6" : "6" } } } }
    ]
  }
}


texts: user/%/edit - remove it from tab and make it an actual menu item

texts:
I am pretty clueless on how drupal handles such things and I can't seem to grasp the context.

I want a menu link to user/%/edit (using menu token already). But as it seems /edit is a 'tab' item of the user/% menu (also saw it in the db). Using theming I have visually removed the unwanted tabs and I've also merged the user/edit form with the profile2 forms I need for extra fields using form_alter.

The problem is that even though I have a menu link called "My Account" linking to user/%/edit,
whenever I click it to go there, the "Edit" menu link appears as active in my main menu instead of the "My Account".

Is there any way to remedy this?

If the question is not clear I will revise it cause it's a pretty confusing issue.

EDIT: to avoid similar answers, the problem is not how to visually remove the tabs, the problem is how to somehow alter or ignore the user/* menu structure so the "Edit" part is not a separate tab anymore and thus it won't show when I click the link that leads to to user/%/edit


texts:
So here's what i would like to achieve:

The "big image" acts like a slideshow. It doesn't need to automatically display the next images.

The red squares are thumbnails from the slideshow.

What I want to do is, when we hover a thumbnail, the "big image" displays it, and when we click on a thumbnail, it opens a colorbox.

I've made lots of researches, but didn't find out how to integrate colorbox with this. So is this possible, and if yes, what would be the easiest solution? (I'm not yet used with theme's template modfying, module creation, functions overriding, but could handle it if well explained :P)

Thank you !


texts: Invalid URL Aliases in Drupal Nested Sites/Subsites - Main 404

texts:
I'm sure my title made no sense! But I'm really struggling with something and could use some assistance.

I inherited a Drupal-based website a few months ago, and it was my first exposure to Drupal.

The way this website is set up is that it actually has three separate Drupal installs. Clean URLs is enabled with aliases set up. I'm sure this was the complete wrong way to set up multi-site, but unfortunately it is this way for now and I'm not confident I could correct it without breaking many things.

www.website.com (1st Drupal Install)

www.website.com/success (2nd Drupal Install)

www.website.com/spa (3rd Drupal Install)

For awhile, everything was working fine. But at some point the URL www.website.com/success/thank_you, started to display a 404 error - but NOT /Success's 404 page - it would be the 404 display page of the base Drupal install! But still show www.website.com/success/thank_you in the URL

Other Aliases on /Success continued to work, etc www.website.com/success/online, www.website.com/success/privacy.

If I typed in a garbage URL, say, www.website.com/success/abcdefg, i would get the 404 page of /Success install like it should, not the base Drupal.

I managed to "fix" this issue by changing the URL Alias of /success/thank_you to /thankyou.

Now last week, it started happening with the other Aliases.

If I go to /success/thankyou it still works properly. If I do /success/online, or /success/privacy, I get the main Drupal's 404 page.

If I remove the Alias, I can do /success/node/20 and see the page. If I change the Alias to say, /success/online2 I can see the page. But if I change it back to /success/online, it does not work.

So, my current thinking has been that this is an issue with the base Drupal install, not the /success Drupal. That the base Drupal is grabbing that URL I am entering for some reason and seeing it's not an alias in that Drupal and failing. But why is it only happening to specific aliases? And why doesn't the base Drupal grab the URL if I type in a garbage one? (/success/abcdefg for example).

Any pointers in the right direction would be greatly appreciated.


texts:
I am using custom form to store email content using variable_set.
Using drupal_mail and hook_mail to send that content using variable_get.
Now in email I want to add image using html.

$pre_body = '
'
$body = variable_get('email_content');
$post_body = '
';
$full_body = $pre_body . $body . $post_body;
$message['body'][] = t('@body', array('@body' => $full_body));

but in email it shows me...

Hello obv
You have placed a bid on lot 'AA' of auction 'Test Curator Email'.
You currently the highest bidder.

how to achieve it...???


texts:
The core user login block does not appear to work.

I have it placed in the Header region (Omega theme if that helps), with the following overrides:

function mytheme_theme(&$existing, $type, $theme, $path) {
   $hooks['user_login_block'] = array(
     'template' => 'templates/user-login-block',
     'render element' => 'form',
   );
   return $hooks;
 }

This lets me use my own tpl file for the login block.

function mytheme_preprocess_user_login_block(&$vars) {
  $vars['name'] = render($vars['form']['name']);
  $vars['pass'] = render($vars['form']['pass']);
  $vars['submit'] = render($vars['form']['actions']['submit']);
  $vars['rendered'] = drupal_render_children($vars['form']);
}

This lets me pass new variables..

Then in the tpl file:

    <?php print $name; ?>
    <?php print $pass; ?>
    <?php print $submit; ?>

    Create an Account | Forgot Password

Except when I login, the page refreshes, and nothing happens. User is not logged in, no error. When I use correct or incorrect credentials, nothing happens.

I used this same approach on a Drupal 6 site and it worked fine. Where am I going wrong?

I disabled Login Destination and Login Toboggan while debugging, no change.


texts: Cross domain cookie for same Drupal installation

texts:
The English translation of my Drupal installation runs on MYSITE.com and my German translation runs on MYSITE.de. Of course, I want my users to be able to switch languages without having to log in again.

I read that there is no way to set cross domain cookies for domain1.com and domain2.com if they point to different websites, only for subdomains 1.domain.com and 2.domain.com. Is there any way to set a cross domain cookie in my case, where both domains point to the same installation?


texts: Shopping cart is not updated after add to cart when you select an attributes

texts:
In my drupal commerce I have a product type. it's name is "Cellphone"

in my product type I have a field named "color" that in field settings I have set this check box "Enable this field to function as an attribute field on Add to Cart forms."
so this field is an attribute.
color has two options. One is red and another is blue.

When I want to create a product display , I make two products for this product display one is blue and another is red.
So in product display, visitor is able to change the product via color attribute.

Now I have made and price attribute for my products. It's name is guarantee and it includes two options. "Type A" that increases price $100 and "Type B" that increases price $200

every thing works well. in product display page and during ordering, when user set color and also set an attribute, price of product change correctly. but after click on "Add to cart" button, the new item in shopping card block doesn't have correct price (it has base price without any attribute effects)
and when user press on F5 and refresh the browser page, shopping card block is corrected

do you know what is the reason and how can I solve this problem ?


texts: How to create user like drop-down filters for a custom module in admin side

texts:
Drupal 7 admin panel, when clicked on people, a form with drop-down filters is visible.

user filters http://www.imagesup.net/?di=914041271981

How can we create above filters in our custom modules ?

I have tried goggling, but when searched filter in Drupal, it returns text filters which replaces text.

I have a custom module in which list of items are show, I want to filter items based on different fields.

Any help would be appreciated, thanks !!


texts: Show block if user has never completed Ubercart checkout

texts:
Part of my website's signup process is the purchase of a product via Ubercart. The signup process directs the user to the checkout page with the product already in their cart. The problem I am having is when users get to the cart and then abandon their cart.

I'd like to add a block to the user profile pages that says "Your profile is not yet complete. Please click here to enter your payment info", and I only want that block to show up for users who have not completed that order process. How can I filter users in that way to make that block show up only for those select users?


texts: Webform Status in Webform Submission Twig Template

texts:
I'd like to use the current open/closed status of a webform in a conditional on the webform-submission-information.html.twig. There is a "webform" variable available to use in the template_preprocess_webform_submission_information function, but all that seems to do is print a link to the webform. When I try to use the usual methods that I'd usually use on a webform object, I just get WSOD. Something tells me that variable isn't actually an object.
For example, perhaps I could get the webform id and use that to figure out the status of the webform...
$form = $vars['webform']['details']['nid']['#value'];

Also, is there a resource for figuring out the pathing to the API is for the Webform? The documentation exists on the Drupal site certainly, but it'd be a lot easier if there was some kind of resource that gave us the path to all these data endpoints. As it stands, even if I figured out the correct function for extracting the webform's ID, I wouldn't have any clue how to find the status (open/closed) endpoint. There are some old d7 articles and issues out there, but it'd be nice if we didn't have to rely on issues and, instead, if there was intuitive documentation.


texts: CCK nodereference is returning empty nid when no node is selected

texts:
For testing purposes I've installed CCK module on vanila drupal,
created new node type and attached CCK nodereference to it.

After creating new node, I've notice in node.tpl.php the following structure:

    [field_my_node_reference] => Array
    (
        [0] => Array
            (
                [nid] =>
                [safe] => Array
                    (
                    )

                [view] =>
            )

    )

As you can probably notice, there is a key $node['field_my_node_reference][0]['nid'] that is null.

In order for me to fully understand CCK - why CCK gives empty keys when nothing is selected?

Any answer is appreciated !


texts: I'd like to let users rank pages (thumbs up/down) and display “most popular” pages in ranked order. What's the best way to do this in Drupal?


texts: How can I stop a field ajax callback from triggering the submit button callback?

texts:
I have a form that looks like this:

$form['text'] = [
  '#type' => 'textfield',
  '#title' => $this->t('Text'),
  '#required' => TRUE,
  '#weight' => 0,
  '#ajax' => [
    'callback' => array($this, 'validateFieldAjax'),
    'event' => 'change',
  ]
];
$form['email'] = [
  '#type' => 'email',
  '#title' => $this->t('Email'),
  '#required' => TRUE,
  '#weight' => 0,
  '#ajax' => [
    'callback' => array($this, 'validateFieldAjax'),
    'event' => 'change',
  ]
];

$form['actions']['submit'] = [
  '#type' => 'submit',
  '#value' => $this->t('Submit'),
  '#attributes' => ['class' => ['use-ajax-submit']],
  '#ajax' => [
    'callback' => '::ajaxAfterSubmitAction',
    'event' => 'click',
  ],
];

What I want to have happen is:

When either field is changed, the callback happens and returns instructions to update the form; I don't want the form's validateForm to fire or for the form to submit.
When the submit button is clicked, the form validates and submits, then the ajaxAfterSubmitAction fires (which may update the form, or do something else depending on whether submit failed or succeeded).

What actually happens is:
  - The validateForm function gets called on every callback
  - When the validateFieldAjax callback happens, the ajaxAfterSubmitAction also happens, even though the button was not clicked. I'm really baffled about what's going on there.

I've seen this question -> How to omit form's validation at AJAX button click?, and tried adding |'#limit_validation_errors' => array(), '#submit' => array()| values to my text and email fields, but it doesn't seem to change anything.

I have found a work around by exploiting the fact that the submitForm action at least only happens after the submit button is clicked, using session variables to track when the 'real' submit action happens, and creating custom Callback Commands that ignore the nonsense returns from the ajaxAfterSubmitAction firing before it should. But I don't understand what's happening, and I'm sure there's a better way to do this. Can anyone help?

Edit: new thing I found out, if I add a 'prevent' => 'click' to the text and email fields, ie

'#ajax' => [
    'callback' => array($this, 'validateFieldAjax'),
    'event' => 'change',
    'prevent' => 'click'
  ]

The ajaxAfterSubmitAction no longer fires after the fields are updated. Which is good, but so confused. What's going on?

Edit: Scratch that last edit, it's gone back to the previous behaviour this morning.


texts:
When doing a custom D7 to D8 migration, i sometimes need to migrate a specific value such as 'fid' (for example file ID of an images) into the

'field_image/target_id'

property. How do I find out which property i can use for D8 fields? By property i mean the target_id part. For example for uid field? The devel module does not seem to be helpful here, or I may be wrong.


texts: How to create Nested Accordion in Drupal 7?

texts:
2015

-- Jan

-- Feb

  -- Link 1

  -- Link 2

2014

-- Jan

-- Feb

  -- Link 1

  -- Link 2

I want same views accordion feature on this listing with expand or collapse feature .

First user select year then month then we show the node title according to month & year .


texts: Load multiple entities with entity_metadata_wrapper

texts:
It's very easy to load entities with entity_metadata_wrapper('node', $nid) - but is there any way to load multiple entities, similar to node_load_multiple()?

I've tried passing in an array instead of a single id, but it gives the error: Invalid data value given.

If there isn't a function for this, is there an efficient way of doing this, or is a looping the only way?


texts: Is there a way I can display one image field if another one does not exist using visibility rules in node template?

texts:
I can do something like this with a text field, because I can compare it to an empty string, but I can't figure out how to do it with an image field.

Visibility rules supports content:exists, but this only applies to the content the rule applies to, not another field.

Is there a way I can display one image field if another one does not exist?


texts:
I'm trying to add attributes to a date form field. The field renders as day month year in separate inputs.

I cannot work out how to add the form alter to these specific inputs.

I've tried variations of the form array as you can see below.

function xxx_form_user_register_alter(&$form, &$form_state, $form_id){

  $form["field_date_of_birth_boxed"][LANGUAGE_NONE]["value"]["day"]["#attributes"]["pattern"] = "\d*";
  $form["field_date_of_birth_boxed"][LANGUAGE_NONE]["value"]["day"]["#attributes"]["maxlength"] = "155";
  $form["field_date_of_birth_boxed"][LANGUAGE_NONE]["value"]["day"]["#attributes"]["placeholder"] = "156";

}

I've ran it through debug on PHPStorm and can see the attributes there but at render they're not displaying.

I've also tried variations on the above array structure.

Any ideas?


texts: Default value for form_system_theme_settings_alter

texts:
I'm trying to set some theme settings, and I can't figure out how to have my settings get their default value, which should be obviously the currently set value.

Here's an example:

$form['navbar_layout'] = array(
    '#type'          => 'radios',
    '#options'       => array(
        0 => 'Logo left, Menu right',
        1 => 'Logo right, Menu left',
    ),
    '#default_value' => theme_get_setting('navbar_layout'),
    '#title'         => t('Navbar\'s Layout'),
    '#description'   => t("Choose the layout of the navbar."),
);

Each time I'll access the theme settings page, no box will be checked, despite the fact theme_get_setting() correctly returns the right value.


texts:
How can i print node/add form inside node.tpl.php?

Tried:

$form = node_add('nodetype');
print drupal_render($form);

But no success.


texts:
I've created a custom field in Display Suite using this code in my module:

function mymodule_ds_fields_info($entity_type) {
$fields = array();

$fields['node']['type_label'] = array(
  'title' => t('Label'),
  'field_type' => DS_FIELD_TYPE_FUNCTION,
  'function' => 'mymodule_ds_field_type_label',
);

function mymodule_ds_field_type_label($field) {

$entity = $field['entity'];
$content = $entity->type;

return $content;
}

Now, I was able to set the content of the field to match my content type, but I also want to set a dynamic class for this field equal to that content type, for example:

$fields['node']['type_label'] = array(
  'title' => t('Label'),
  'field_type' => DS_FIELD_TYPE_FUNCTION,
  'function' => 'mymodule_ds_field_type_label',
  'class' => 'CONTENTTYPE',
);

Or:

function mymodule_ds_field_type_label($field) {

  $entity = $field['entity'];
  $content = $entity->type;
  $class = $entity->type;

So the end result should be something like this:

...

How can I do this?

Thanks in advance.


texts:
I'm trying to echo out the current term name that my node is inside of into my function, but it only keeps echoing out 1 and not the name. This is what I have.

function bartik_process_html(&$variables) {
  // Hook into color.module.
  if (module_exists('color')) {
    _color_html_alter($variables);

    if (drupal_is_front_page()) {
      $variables['head_title'] = implode(' - ', $variables['head_title_array']);
    }
    elseif (node_is_page()) {
      $terms_name = print $term_name->name;
      $variables['head_title'] = implode(' - '.$terms_name.' - ', $variables['head_title_array']);
    }
  }
}

can anyone help?


texts: Drupal 8 - how to run multisite using one database

texts:
I setup Drupal 8 in my localhost, i want to run multisite using one database and one instance (under one drupal installation)
How do i achieve this?

Also, i want the url will work like this :
site1 : http://localhost/site1
site2 : http://localhost/site2

Thank you.


texts: Really strange WSOD after submitting a form/add to cart

texts:
I've read everywhere, but just can't seem to find an answer for my particular problem.

Basically when I click 'add to cart', or 'login'.  I get a white screen of death with absolutely no errors.  Error reporting is on.

For example:

I am on a product page mydomain.com/product
I click add to cart
I am not redirected to the cart page, it just redirects back to mydomain.com/product except the page is completely blank
The form still submits successfully however.  If I navigate to the cart page the item has been successfully added.
After I have viewed the cart page, by manually navigating to it in the browser.  Adding any other item to my cart works as expected.

A similar issue happens when I login to the backend.  At first I get a WSOD, but if I refresh the page it works fine.

Now here is where it gets really damn strange.

I suspected that perhaps it was a cookie issue, so after I logged in I decided to delete the session cookies from my browser.  I was hoping that I could replicate the issue once more.  However, the problem had disappeared, no WSOD even though I had deleted my cookies.

The next day the issue returned.  I logged into the backend and the issue disappeared.  To confirm that the issue had disappeared entirely, not just for me.  I asked a friend on a computer in another building to visit the site and attempt to add an item to cart.  He said it worked fine.

Every morning the issue returns predictably and only when I login to the backend does the issue disappear for everybody for the entire day until the next day.

Has anyone experienced similar issues or have any idea what this could be?  I'm on drupal 6.26 using ubercart


texts:
I am trying to update a module via drush. Referring this link

[root@localhost d7]# drush update
The drush command 'update' could not be found.  Run `drush cache-clear drush` to clear the commandfile cache if you have    [error]
installed new extensions.

But it is giving error that 'update' command could not be found. Can anybody help me with this?


texts:
After updating my Mac from Yosemite to El Capitan, I am noticing drush does not run properly on any of my sites. Doing a simple:

drush status-report

Command core-requirements needs a higher bootstrap level to run - you[error]
will need to invoke drush from a more functional Drupal environment
to run this command.
The drush command 'status-report' could not be executed.             [error]
Drush was not able to start (bootstrap) the Drupal database.         [error]
Hint: This may occur when Drush is trying to:
  * bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
  * connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

This is now happening on all my Drupal sites locally, and yes, I am at the root of the Drupal install directory where this command would normally work. I've updated Composer and made sure that stable Drush 7.0.0 is running. Has anyone else come across this behaviour?

Fortunately, I made a full bootable backup of Yosemite so I will 'simply' roll my Mac back to how it was setup prior to the so-called upgrade of El Capitan. Normally I wait at least a month or two before upgrading to Apple's latest release but I got reckless and now this is the price. Sometimes I just want to switch to Ubuntu full time and say goodbye to the Mac OS.

Using:

Mac OS 10.11
MAMP PRO 3.2.1
Little Snitch 3.6 (mentioning this because of this thread)
Composer version 1.0-dev
Drush 7.0.0

2015-10-17 - Update #################################

First off, thank you for the folks who commented on the original issue. I have decided for better or worse to try again. I updated Yosemite, where Drush, Mamp and everything was working fine, to El Capitan.

I removed drush by editing the .json file for composer by removing the lines for drush and then running composer global update which then finished the job by removing the actual drush files. Composer is up to date, and then drush7 was installed successfully with

composer global require drush/drush:7.0.0

However, once I navigate to a directory with a Drupal install, I am told after running some commands that 'No drupal site was found' and yet, the commands seem to complete regardless. Here are some examples:

drush cron results in the following:

 No Drupal site found, only 'drush' cache was cleared.
 'all' cache was cleared.

drush updb results in the following:

 No database updates required
 No Drupal site found, only 'drush' cache was cleared.
 'all' cache was cleared.

drush dl hacked results in the following:

 Project hacked (7.x-2.0-beta5) downloaded to
 /Users/[me]/Sites/[path]/drupal/sites/all/modules/contrib/hacked

Note there was no 'drupal not found' message on the last command. So, my concern is why the 'No Drupal site found' message is showing up. Here is what my .bash_profile looks like:

export PATH="/Applications/MAMP/bin/php/php5.4.42/bin:$HOME/.composer/vendor/bin:$PATH"
export PATH

export DRUSH_PHP='/Applications/MAMP/bin/php/php5.4.42/bin/php'

export PATH=/usr/local/bin:$PATH

None of these settings were changed from how it was in Yosemite. If anyone can shed some light on these issues, I'd really appreciate it. Thanks again.


texts: How can one Rewrite results of a view using a Group By

texts:
I have created a view and then added a group by a certain field. Normally one would just add a new field then rewrite the results with custom html using replacement patterns.

How would I go about this when I use group by


texts:
I am working on Drupal 8. I have a to display content from a content type on different pages. I am trying to use Views to achieve this.

In the content type I added a field to refer to Pages so that I can create relation between content of content type and Pages (another content type). Basically its like tagging content with page name.

I want to display content from content type created on those pages tagged in the content. I am not able to achieve using views.

Any ideas how this can be done? I have tried contextual filter and relationship but none works.

Thanks


texts:
I'm looking for a working solution, to detect a current 403 or 404 state from within a template (page.tpl.php) in Drupal 7.

Unfortunately, Drupal seems to be unable to handle error pages.


texts: Link field to path (automatically pulling Node Id)

texts:
I have a view "Objects" containing type Object and having fields name and size. I have another view with more features of the Objects called "Details". I set the path of the "Details" view to details/%.

What I want to do is link the name field of the Object in the first View to its details in the latter. In "output this field as a link", what path should I put for it to automatically get that field's Node ID and plug it into the URL so that it goes to its corresponding set of details? Is that not possible? Do I have to link each name manually to its details?


texts: Why are hooks (except hook_help) not working?

texts:
<?php
function webformta_init() {
    dsm('hello world');
}

does absolutely nothing.

<?php
   dsm('hello world');

sets an alert message with the text "hello world".

I've tried wrapping this in several hooks. Hook_load, hook_node_load, you name it.

But somehow, oddly, hook_help seems to be working.

function webformta_help($path, $arg) {
  switch ($path) {
    case "admin/help#webformta":
      return '<p>'.  t("Grades quizzes like a TA. Works with Webform.") .'</p>';
      break;
  }
}

creates a nice little help link in the module list and outputs the text and everything.

What did I screw up?


texts: Allow groups of users to edit a single Webform

texts:
I need to enable groups of users to edit one Webform so that they can collaboratively complete a questionnaire. I am not concerned with two people editing at the same really.

I've seen mentioned the Organic Groups module and the OG Webform module to enable this but as far as I can tell it isn't suited to what I want to achieve.

The other option seems to be to implement hooks in the Webform module to override the user authentication but I'm afraid I wouldn't know where to start with that. How would you define the groups of users and then allow access to the forms based on those groups?

Any help would be massively appreciated!


texts: Why is it better to use event subscribers rather than hooks

texts:
In drupal 8, we now have the ability to use event subscribers. What's the reason for this? Is it to work with the new cache API better?

Recently I had a task of needing to extract data from a node when it was viewed, but hook_node_view() is cached (like nearly everything) in Drupal 8. So I ended up using an event subscriber. Why is using event subscribers a better solution? Is it just that it's more object orientated?


texts: Create a block with sorting in drop down

texts:
Using Organic group module, In the block I want to create sort dropdown as shown in image. Which will allow to sort the data according to various parameters like date, tag, group etc.

How can I achieve it programmatically.


texts: Contextual Links not appearing for blocks

texts:
I have contextual links enabled. I've added

print render($action_links);

to both my page template and every block template I have but it's always blank. Out of desperation, I set permissions to allow even anonymous users. Still nothing.

I read that Devel might mess with contextual links but I don't have it enabled.

EDIT:

<?php print render($title_suffix); ?>
<?php print render($action_links); ?>

<?php echo $block->title; ?>

<?php
   echo preg_replace("/(<)[\/]?[p](>)/is", "", $content);
   ?>


texts:
I have a block manually created through the drupal admin panel.

I would like to override it in order to implement in it an array of data with it's corresponding html.

Is there an easy way to do this?

I also could create the block programmatically with the hook_block instead of using the admin panel.

I don't mind doing it either way, which way do you recommend?


texts: How do I give a root directory to all requests?

texts:
A project I'm working on has a slightly unusual requirement. We have Drupal 9 running inside of Apache and Drupal is currently the only application running on the hostname. Our Drupal 9 installation is installed with composer drupal/recommended-project -- meaning that index.php is located inside of /var/www/html/web/
Everything works as it should, https://example.com/ give the front page and https://example.com/node/1 gives the node with nid of 1.
A portal application that is serving as a public internet proxy for our application wants us to prefix ALL requests with a root context directory. So instead of https://example.com/ we are being asked to use https://example.com/app_name/ and https://example.com/app_name/node/1. Static assets should also be handled with the same root context directory in the front of the path.
I'd like to try and stick to Apache configurations instead of mucking around with the Drupal file directory structure.
Some things I've tried:

Custom implementations of InboundPathProcessorInterface and OutboundPathProcessorInterface
Setting the Apache DocumentRoot configuration to point to /var/www/html instead of /var/www/html/web

For (1): this was obviously overly complicated and doesn't solve the static asset requirements.
For (2): This would require renaming the 'web' directory to 'app_name' and would require additional Apache access restrictions to make sure the true root directory is not accessible -- I don't want any files or directories inside of /var/www/html/ to be accessible. For example, files inside of /var/www/html/vendor/ can be accessed. I know this can be blocked with an .htaccess file, but I'm trying to avoid altering the standard Drupal installation as much as possible. This change might also affect drush or my IDE in odd ways.
Is there any way of configuring Apache to "trick" the browser into using a root directory that doesn't actually exist?


texts: File directory token - image field - node author

texts:
How to setup file directory where the images are saved to use tokens based on node author ?
I have all setup with current user, but this is not good if moderator or admin needs to make a change with content made by user.

Strange is that for automatic node title i can use node author tokens, but not for image field.


texts: Commerce kickstart select country and don't show product

texts: I use commerce kickstat and I have some products on my site. I want to disable add to cart button when user is not form some country.. for example.. USA.. if user is from USA he can see add to cart.. other not


texts: View page not filtering content according to its language

texts:
I used devel to generate dummy content for a content type named recipe, and at the moment I have 10 recipes. 5 in English and 5 in Portuguese.
I create a view(page view) that shows all the recipes when the user goes to /recipes, and select it to render only the recipes in English.

When I visit the url: domainname/recipes I see all the recipes including the ones in Portuguese.

Below is my configuration:

How do I filter out the recipes that are not in English?

UPDATED:
How can I add a menu to that same view?


texts:
Am using the Booking time slots module. The rules tokens that are related to calendar/time return "0"
Examples of the token include: [booking:slot-time], [booking:hour-start] and[booking:min-start]

Please does anyone know a variation, I can use?


texts: How can I link a group of galleries through a single image using Views?

texts: I found a great article titled "How to Create an Image Gallery in Drupal" and at the end the author was sketching the posibility of its intregration with Views.My intention is to display a grid View of single images that represents the full contents (the galleries) that I created thanks to that article,and when you click on each one they take you to its respective group of images.


texts:
I am trying to follow this tutorial, but it does not explain the concept of variant very clearly. It does not provide a definition of it.

Can someone clarify this concept in plain English? What are the practical cases where you would use variants?


texts: Visibility depending on several values of another field

texts:
I'm having a form with two field. And visibility of the one is depending on the values of the other.

    $form['property'] = array(
    '#title' => t('Property'),
    '#type' => 'radios',
    '#options' => array(
        'private' => t('Private'),
        'bail' => t('Bail'),
        'lease' => t('Lease')
    ),
    '#required' => TRUE,
);

$form['bank'] = array(
    '#title' => t('Bank / leasing company'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#states' => array(
            'visible' => array(
                ':input[name="property"]' => array('value' => 'bail'),
            ),
        ),

);

What comes to ':input[name="property"]'. How do I make it visible when "bail" OR "lease" values are set?


texts: Cause for Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: error

texts:
Currently trying to port over a Contrib module and learn the new Drupal 8 architecture.

A google search revealed a possible issue related to this.

The cause could be that there's an underscore in the file name which violates psr-0 naming standards. Looks like i had that before and have renamed it just now and still have that issue after clearing the cache.

What would likely be the cause of the following error?

  Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException:
  You have requested a non-existent service
  "\drupal\form_example\forms\formexampleformone". in
  Symfony\Component\DependencyInjection\Container->get() (line 304 of
  /home/chris/workspace/d8/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php).

The error occurs when i visit /examples/form_example/tutorial/1

form_example.routing.yml

form_example:
  path: 'examples/form_example'
  defaults:
    # _form: '\Drupal\form_example\Forms\FormExampleForm'
    _content: '\Drupal\form_example\Controller\FormExampleController::description'
  requirements:
    _access: 'TRUE'
form_example_tutorial_1:
  path: 'examples/form_example/tutorial/1'
  defaults:
    _form: '\Drupal\form_example\Forms\FormExampleForm'
  requirements:
    _access: 'TRUE'

form_example.module

<?php
function form_example_menu() {
//   $items = array();
//   $items['examples/form_example'] = array(
//     'title' => 'Form Example',
//     'route_name' => 'form_example',
//     'access callback' => TRUE,
//     'expanded' => TRUE,
//   );
  $items['examples/form_example/tutorial'] = array(
    'title' => 'Form Tutorial',
    // 'page callback' => 'drupal_get_form',
    'route_name' => array('form_example_tutorial'),
    'access callback' => TRUE,
    'description' => 'A set of ten tutorials',
    // 'file' => 'form_example_tutorial.inc',
    // 'type' => MENU_NORMAL_ITEM,
  );
  $items['examples/form_example/tutorial/1'] = array(
    'title' => '#1',
    // 'page callback' => 'drupal_get_form',
    'route_name' => array('form_example_tutorial_1'),
    'access callback' => TRUE,
    'description' => 'Tutorial 1: Simplest form',
    // 'type' => MENU_DEFAULT_LOCAL_TASK,
    // 'file' => 'form_example_tutorial.inc',
  );
  return $items;
}

/lib/Drupal/form_example/Forms/FormExampleForm.php

<?php
/**
 * @file
 * Contains \Drupal\form_example\Form\FormExampleForm
 */
namespace Drupal\form_example;

use Drupal\Core\Form\FormInterface;

class FormExampleForm extends FormBase {
// form...
}


texts: File not found while retrieve the path after submit form

texts:
I have upload a csv file. It get uploaded on the physical path but while retrieve the path I get error file found.
File get uploaded in sites/default/files/data_file/myfile.csv
After print variable $data_file_server_path showing path as : /code/sites/default/files/data_file/myfile.csv as I am using pantheon server.
Also I check it file with file_exists() it also enter in the condition
Also File is 0770
I am not sure why it give me error.
Below code I used in controller form
namespace Drupal\data\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

/**
* Form builder for the upload data file form.
*
* @package Drupal\data\Form
*/
class dataUploadForm extends FormBase {
   public function getFormId() {
    return 'data_file_form';
   }

  public function buildForm(array $form, FormStateInterface $form_state) {
$form = [];
$form['data_file'] = [
  '#type' => 'managed_file',
  '#title' => t('Data File:'),
  '#upload_location' => 'public://data_file/',
  '#upload_validators'  => [
    'file_validate_extensions' => ['csv'],
    'file_validate_size' => [25600000],
  ],
  '#required' => TRUE,
];
$form['submit'] = [
  '#type' => 'submit',
  '#value' => $this->t('Process'),
];
return $form;
}
 public function submitForm(array &$form, FormStateInterface $form_state) {
$data_file_id = $form_state->getValue('data_file');
$data_file = file_load($data_file_id[0]);
$data_file_uri = $data_file->getFileUri();
$data_file_path = file_url_transform_relative(file_create_url($data_file_uri));
$data_file_server_path = $_SERVER['DOCUMENT_ROOT'] . $data_file_path;

if (file_exists($data_file_server_path)) {
  $database = \Drupal::database();
  $query = $database->query("TRUNCATE TABLE data");
  $query = $database->query("LOAD DATA LOCAL INFILE '$data_file_server_path'
    INTO TABLE `pantheon`.`data`
    FIELDS TERMINATED BY ','
    ENCLOSED BY '\"'
    LINES TERMINATED BY '\n'
    IGNORE 1 ROWS")->execute();

  drupal_set_message($this->t('File uploaded successfully.'));
}
else {
  drupal_set_message($this->t('Please try again.'));
}
}

}
}


texts: How to export 'Content-Type' data into JSON?

texts:
I'm using Drupal 7 and I've created a content type as 'CONTENT_TABLE', which includes multiple fields (COLUMNS) as such: CONTENT_ID, CONTENT_NAME, LARGE_THUMBNAIL, ZIP_FILE...

I want to export the data (each row of the table) into a JSON. I need to use this JSON as an input for another website.

I have tried to look for Node export module, but I'm not sure how to export the data into JSON which can be used as is.

Expected JSON:

{
   "ContentItems": [
      {
         "CONTENT_ID": "123",
         "CONTENT_NAME": "ABC",
         "LARGE_THUMBNAIL": "C:/LargeThumbnail/ABC.jpg",
         "ZIP_FILE": "C:/LargeThumbnail/ABC.zip"
      },
      {
         "CONTENT_ID": "234",
         "CONTENT_NAME": "PQR",
         "LARGE_THUMBNAIL": "C:/LargeThumbnail/PQR.jpg",
         "ZIP_FILE": "C:/LargeThumbnail/PQR.zip"
      }
   ]
}


texts: How put a product display on the "Shop" not the "Home" page?

texts:
I have created all suggested types and objects for a product display (drupal commerce module) but it only shows on the "Home" page (which I have renamed "News"). I have a page named "Shop" for this purpose i.e. where I want the products to be on. How do I tell drupal to place the product display there?

Test site: http://marius-raphaelius.com/drup

(In fact, how does one edit the content of a page in general?)

Thanks a lot.


texts: Add subquery with count, having, and orderby

texts:
I just started working with Drupal 7 and I'm stuck at something I believe should be really easy (I could easily write it using plain SQL).

I have a query, rather complex (but that's not relevant) which I wanted to extend with hook_views_query_alter. What I need to achieve:

Based on base table users I need to:

Join a table node based on users.uid (many-to-one)
Then join a table node_param on node.id (one-to-one)
select count(node_param.id) WHERE node_param.value is greater than X
Order everything based on that count field

I've done research on Drupal website and stackoverflow, but couldn't find anything that would actually work, everything I've tried ended up with no results at all and I did build the query with SQL that returns results - therefore I believe my altered query gone wrong.

I will really appreciate your help here! :)

P.S. I can only modify this query using this hook!


texts: Insert *whatever* every nth row in Views

texts: I am looking for a solution to insert "something" every nth row in a view.  Technically, that "something" will be an Ad, but in Drupal terms it could be a block, a node, an entity, custom html row...really anything that can point me in the right direction.


texts: How to change a Textfield into a Select list in a Views Exposed Filter

texts:
Figured this question would be asked before, but don't see it.
I have a views exposed filter with a Text Field as one of the filters. I'd like to display this filter as a Select List instead of the standard text input or autocomplete.
Any advice on how to?


texts: How to read JSON from external URL and display in a block?

texts:
I want to load some JSON data from an external URL and display it in a block.

How do I go about that?


texts: First attempt to adding states to a custom Content type

texts:
// sample code
/**
 * Implementation of hook_form_FORM_ID_alter()
 */
function demo_form_sport_node_form_alter(&$form, &$form_state, $form_id) {
    $form['field_winter_sports'] = array(
    '#states' => array(
        'visible' => array(   // action to take.
            ':input[name=field_season]' => array('value' => t('winter')),
        ),
    ),
);

}

i am trying to alter a form from a "sport" node type. my "sport" node type has 2 fields.

field_season List (text)    Check boxes/radio buttons
field_winter_sports List (text) Check boxes/radio buttons

there are two options in field_season, summer or winter.

if someone selects winter in field_season, i want to make field_winter_sports visible, otherwise remain hidden.

with my current code, when i select winter right now, nothing happens.


texts:
I am using the menu block module with panels to add a sidebar menu to each page. It works great, except that where the options for "Starting level will be" are "active menu item" and "children of active menu item". I need one level up, that is, parent of active menu item and that item's siblings. I want to always show one level up, the current level, and the children of the current item.

Is there a way to do this with menu block? Or any other contrib module? Or should I write this and submit a patch to menu block?


texts: Getting error rendering same node in different view mode

texts:
Unsupported operand types in /node/node.module on line 1419

On my site users have the ability to flag a content type (node) as being featured on the right rail.  I then have a view that renders a view mode called card_view of that specific node.  This works great but if you attempt to render that card_view view mode on the same page as the full content view mode you get an error above.  Debugging the error occurs when rendering the full content and not the card_view.  This also occurs when attempting to render it programmatically:

// Error occurs here (snippet from node.module line 1419)
  $node->content += field_attach_view('node', $node, $view_mode, $langcode);

// Error occurs viewing full content and attempting to render same node in a different view mode
$node = node_load($nid);
$node_view = node_view($node, $view_mode = 'card_view', $langcode = NULL);
echo drupal_render($node_view);

If I remove the attempt to render this node in this view mode it works fine, and also if I attempt to render a separate node it works fine as well, it ONLY occurs when rendering the node view mode on that same node full content page.


texts: How do I overwrite Facet API tokens for active items?

texts: I'm using "Facet API" and "Search facets" modules on Drupal 7. I'm trying to change the values of the active items' tokens provided in the search blocks (especially the [facetapi_active:facet-label] token) , I tried to use the "Facet API Bonus" module and the function hook_facet_items_alter with no success, could someone help me? Thanks!


texts: field_groups - adding an inner div wrapper programatically

texts:
I have some older code that used this method to add an inner div containing inline style.

Much like the linked question above. I am using hook_preprocess_node to attempt this.

However, the $variables['content'] array no longer seems to contain the groups in it and I'm not sure exactly what's changed. I haven't managed to find much else on this in the issue queue and elsewhere.


texts:
I have created one menu tab in the node page to show statistics  of the article using my custom module.

I have implemented hook_menu() as follows:

function mymodule_menu() {

    $items = array();

    $items['node/%node/menu_title'] = array(
        'title' => 'Page Title',
        'page callback' => 'get_statstics',
        'page arguments' => array(1),
        'access callback' => TRUE,
        'type' => MENU_LOCAL_TASK,
    );

    return $items;
}

It is working fine. But I wanted only author of the node to have access to this link and also for specific content type. Now it is showing this link to every node and for every user.

How can I restrict it to specific content type and for author only?

-- Many thanks for your time


texts:
I have created Boolean fields. I have set values 0/1 in database and No/Yes as labels to display in UI. But I cannot translate these labels. I have translated strings "Yes" and "No" using UI on link admin/config/regional/translate/translate but it does not work for field labels.

Can anybody help?

thanks Tomas


texts:
I have a taxonomy list like this.

- House
 --Large house
   --- Large white house
   --- Large green house
   --- Large pink house
 --Medium house
 --Small house

I have a view url that looks like this

<url>/categories/large-house

My contextual filter depth is set to 1. So when I go to the above URL it displays all the nodes that have Large house and Large house children attached. What I want to achieve is to exclude all nodes that are attached to the Large house parent term directly and display nodes that are attached to Large house children.

Under Filter Criteria I thought this would work. My thinking is display all nodes except the nodes that have parent term Large house.

(term) Taxonomy term: Parent term (!= 0)

Any help would be great


texts: How to disable the submit button after clicking?

texts:
Drupal doesn't seem to prevent multiple form submits, even on node pages. This QA suggests fixing it on the server side.

How could I disable the submit button after clicking?

Any other solutions?


texts: How to hide or remove field set on user profile page

texts:
I have user relationship installed. When i enable the user relationship node access module, the "Share content" field set appears on my user profile.

Is there a way to hide, remove or change the weight of the field set as I do not like the position it occupies on my user profile?

Thank you.


texts:
I a new Drupal 8 user :) and I have a problem with my view !

The context: I have a content type Car with Brand (Taxonomy term ) and Color (Taxo term)

I want to know if it's possible to have this url:

mywebsite/ => view with all cars

mywebsite/brand => view with all cars for the brand

mywebsite/brand/color => view with all cars for the brand with the color

This is my view

I don't know if it's possbile but I try :)

Thx for you help
And see you soon


texts: Adding a custom button to products-variation-list in article-display backend (see screenshot)

texts:
I added the functionality to duplicate product-variations, using the module commerce_product_clone and some custom functions to link the clone to the article-display after saving.

For convenient use, i need to add a clone-button to every product-variation in article-display @ node/{article-display-id}/edit :

If clicked, the following URL should be called: /admin/commerce/products/{product-variation-id}/clone

I couldn't find any matching hooks or views for this...

We use Drupal 7.59 with Commerce-Kickstart 2.54.


texts: Views simply won't output HTML at all for me in any content types, what to do?

texts:
I have Installed Drupal 7.26 (Default Installation), and on a Fresh Installation, I have Views Module (CTools All Sub Modules Installed) and PathAuto Module installed ONLY.  OK, So I create a Content Type and delete the Body Field that is created by default, and create another Field called Section and have it set to LONG TEXT, than make it filterable in the settings so that the user can select the text format, and have it set to an UNLIMITED amount of areas, with required UNCHECKED.

I than create 1 node using this content type with FULL HTML selected as the text format for each section and save it.

I now go to the Views Module and attempt to use an Unordered List, of Fields and select Content: Section as the field, The formatter is set to Default, I set a filter on it for Content Type and select Is One of That content types name.  I see nothing in the preview at the bottom and so I go ahead and save it anyways as it should show something.  I have the page path set to node so that it shows up on the front page.  However, there is nothing being returned for the output of this view on the Front Page.

No matter what theme I choose, I can not get HTML to output in this view whatsoever.

Is there some sort of settings I have not performed somewhere?  I go to Reports -> Status and everything checks out fine.  All Green sections there.  I go to run Cron, again, no problems whatsoever so it seems.  How to debug this?  Or is this an actual confirmed bug in Views?  Or Drupal?  Or something else?

If I change the type from Fields to Content, it still shows no body content, but now only shows the Title of the Content and links to the Page where it is located at, but on that page, it shows nothing but the title.  How can this be fixed?  OMG, this is a nightmare.  I've been trying to hunt down the problem for days with no luck at all!


texts: Block defined in code not appearing in admin interface

texts:
I have implemented hook_block_info() to define a block inside a custom module 'x'. I have followed the documentation and believe the values in my array are correct. I have cleared all caches multiple times. I have disabled and re-enabled my module. I have tried setting status to both 0 and 1.

What is strange is that if I place a DPM() inside the x_block_info_alter(), I can see the block as an array when I visit the admin page. However, in the actual block list, it's not there!

Is there something wrong with my code that I can't see?

function x_block_info() {
  $blocks['mname'] = array(
    'info' => t('Admin title'),
    'cache' => DRUPAL_NO_CACHE,
    'status' => 1,
  );
  return $blocks;
}


texts: How to create conditional checkboxes that hide each other?

texts:
I have 2 check-boxes.

Checkbox 1: Attend event for 1 day
Checkbox 2: Attend event for 2 days

If a checkbox is selected, I want to hide the other one. I don't want the user to be able to select both. If I create 2 rules, I get a circular reference error which breaks the form.

How do I achieve what I described?


texts: How to add separator option in Form API 'select' element?

texts: Is there a way with the Form API to specify that one or more #options in a 'select' element should be disabled? I would like to insert a separator in my dropdown options that is not a selectable value.


texts: I installed profile2 and i created two different profile types. I used views module to create a table of some fields of user profile types. Now i want to create a link in table to see user whole profile fields in page. I don't know what is the user profile2 link? I also could not see users profile2 field by administrator user.


texts: How to send email to all members when a post is updated by user?

texts:
I am creating  a rules to send an email when a (node with content type update) is updated which has field_og_audience as field and it is placed on the groups page using advanced form block.
I want to send an email when node (with content type update) is updated by user then all the members of the group(selected in the field_og_audience) should recieve an email.


texts: How to prevent node delete for a specific node?

texts:
I want to prevent a specific node from being deleted by anyone except admin. For this specific bundle there are two roles that have full access to the node: admin and manager. A manager can delete any nodes of this content type, but I want one specific node to be locked.

I tried hook_node_delete and it does not work as the delete hook for the specific content type (node) has already run by then.

I tried the Content Access module and setting of permissions per node, but then when I go to the specific node's edit page the 'delete this content' for the role manager is enabled and greyed out.

I also do not want to just remove the action from the edit form as the node can be deleted in a view bulk operation. Hence I need a catch all solution.


texts: How can I set the value of an Address field on one entity with the value of an Address field from another entity?

texts:
I am trying to figure out how to programmatically set an Address field on an entity (Profile) with the value of a different Address field from a different entity (User).

This should be trivial and I have tried this:

function example_user_insert($user) {
  $profile = Profile::create([
    'type' => 'customer',
    'uid' => $user->id(),
    'is_default' => true,
  ]);

  $profile->set('address', $user->field_billing_address);
  $profile->save();
}

Although the profile entity gets saved; the Address field is not filled in and there are no errors generated. I have successfully set pieces of an Address field with its pieces (country, city, etc); but hoping I don't need to do this as it seems like I should be able to just do it as I show above. I have done a similar technique for entity ref fields where I simply do something like:

$node->set('term1', $node2->term2); and it works as expected.


texts: how to set Default time zone and date format

texts: I have user registration page in that I could see Time Zone as in screen shot attached now problem is I want to make it as default time  zone for all users as well Need to use same date format throughout drupal7 i,e in content type views also, can anyone tell me how to achieve this?


texts:
The Global Redirect module has a "deslash" feature. It forces all URLs to not have a trailing slash at the end. If you add a slash at the end of a URL it will redirect you to the correct page.

I'm looking for the opposite of this and would like to have a trailing slash on every URL.

I tried the Trailing Slash module for Drupal 7 but just got a lot of errors. Are there any other methods?

Any help would be greatly appreciated!

Thank you.


texts: How do I add jQuery to specific node form?

texts:
I'm using an Omega sub-theme and I want to do this the correct (best practice) way.

Basically I'd like to add some script so that selects a value in a select box based on a previously selected value in another select box. I have the code, just need to plug it in to my theme now.

However, I only want it to load on node creation forms of node type "X".

Any help greatly appreciated, thank you!


texts: Commerce add to cart form combined products: how to change default product

texts:
How can I set for example the mp3 as first item?
Now it takes the products (product reference) from a product display node and display it in order of product creation.

In this example the "CD" was created before "MP3", but I want to be able to always display MP3 before CD.

I use a view with an add to cart field and the option "Attempt to combine like products on the same line item in the cart." checked.

Solution in my case (thanks Ryan Szrama!):

function mymodule_commerce_product_reference_default_delta_alter(&$delta, $products) {
foreach ($products as $key => $product) {
    if ($product->type == 'audio' && $product->field_audio_medium[LANGUAGE_NONE][0]['value'] == 'mp3') {
        $delta = $key;
    } elseif ($product->type == 'video' && $product->field_video_medium[LANGUAGE_NONE][0]['value'] == 'mp4') {
        $delta = $key;
    }
}

}


texts: broken blocks after Drupal 7 Windows to Linux migration

texts:
I'm in the process of migrating a Drupal 7 site from a development Windows box to a soon to be production Linux box.

The Linux box has all the required dependencies and is running the same version of PHP/mySql/Apache/Tomcat/Solr.

I've copied all of the files over and exported/imported the database.

The first time I went to the page, it loaded fine.  I get my superfish menu and my rotating banner.  However, after I goto a different (any) page, my superfish menu and rotating banner disappear.

I dropped the database and re-imported it, and got the same exact behavior.  First load is fine, subsequent visits the page is broken.

I thought it might be something to do with caching, so I cleared the cache and got the message:

The block Superfish 1 (Superfish) was assigned to the invalid region superfish and has been disabled.
The block View: Rotating Banner was assigned to the invalid region nivoslider and has been disabled.

I tried to export/import the database using the "Backup and Migrate" plugin... no change.

Is there anyway to fix this?  Anyplace I could start looking to see where it's falling apart?


texts: How to use Dompdf with Entity Print without composer?

texts:
I'm trying to make Entity Print work but I'm having issues with configuring the module.

The project I'm working on is two years old and for some reasons, I can't use composer and the module folder is at the project's root. The modules that have been created manually are in modules/custom, those downloaded are in modules/contrib

I downloaded and unzipped dompdf 0.8.1 in my vendor directory, and did the same in modules/contrib for Entity Print.

However, after the installation, when I try to make the module work, I get the message

  "Dompdf is not available because it is not configured. Please install with: composer require "dompdf/dompdf 0.8.0".

I have the choice between TCPDF (v1) that gets a PHP error when activated, that makes me need to reinstall the module if I want to get back to the configuration page, and Php Wkhtmltopdf that can't reach the server X even though I installed every related libraries I could find.

One coworker told me that he managed to make Entity Print work with DomPDF, but he couldn't remember how, even though it had something to do with the autoload.

I can't manage to make the couple solutions I found, and I don't really know what I'm looking for.

Please tell me if you need to see a file's content, I don't really know what I can show you for now.

Thank you in advance


texts: Generating URLs based on taxonomy vocabularies and terms

texts:
I have a Drupal 7 website and I have 1 Vocabulary "Interviews" containing terms Celebrity and Director.

I want my website content to be available at URLs like this:

http://example.com/interviews/celebrity/title

http://example.com/interviews/director/title


texts: I am using Date module. I installed it, and as per my requirement for an event node (start date and end date) it worked good. Few days later I was unable to add or change the date. It was not showing the display pop_up calendar. I uninstalled and installed the same module again, and it worked fine; but after a few days the same problem repeated. Is there any way to troubleshoot the problem?


texts: How remove DIV elements in rendered search form in theme designing

texts:
the rendered search form result in drupal 6 is

<form id="search-theme-form" method="post" accept-charset="UTF-8" action="/drupalcms626/%40q%3Dcontact">

        Search this site:
        <input type="text" class="form-text" title="Enter the terms you wish to search for." value="" size="15" id="edit-search-theme-form-1" name="search_theme_form" maxlength="128">

    <input type="submit" class="form-submit" value="Search" id="edit-submit" name="op">
    <input type="hidden" value="form-40ac94eba9b49795082bf8daf59eae58" id="form-40ac94eba9b49795082bf8daf59eae58" name="form_build_id">
    <input type="hidden" value="e030363baad8b89de124a2d09bcbeaa7" id="edit-search-theme-form-form-token" name="form_token">
    <input type="hidden" value="search_theme_form" id="edit-search-theme-form" name="form_id">

</form>

=======================================
Now I want to remove all DIV tags in rendered result.

I mean

 1.

 2.

 3.

 4.

elements

anybody knows how can I do this via theme functions in template.php or page.tpl.php or modifying other *.tpl.php files.

Please help me.


texts: Is there a way to ouput variables in a custom module?

texts:
I'm updating a custom module and I would like to output the $node and $user variable to see what is in it for a specific key.
The value of this key can be one or multiple strings and I'd like to know how it's made up because I need to look at certain user "roles" to see if the user can view the content or not.
I tried a var_dump and writing them in a file with file_put_contents but I don't see them showing up anywhere.
I'm a noob when it comes to php and it's pretty impossible for me to write this logic without knowing how to properly select the values of the keys in those variables.
Any help is greatly appreciated!


texts: How to filter for a specific delta value in a multi-value field with Views?

texts:
I have a userStats field with multiple integer values on the profile and I would like to have a View that only shows those users where the 9th value of the userStats is higher than 4. I thought this can be implemented with the delta filter on multi-field values, but I cant get it to work.

The accepted answer here suggests that it is possible What is the meaning of the field:delta content type offered in contextual filters in views? .

Is this only working for contextual filters, but not static ones?

SOLUTION

This seems to work: Adding a the userStats field to display and set the value in the multiple field settings (e.g. show 1, start at position 9). This shows not the whole userStats, but only the one delta. In Views Distinct settings (from the views distinct module) on can filter the repeats (as each delta would create a separate row).

In the filter section of Views one can then easily filter for values higher than 4. Finally, one needs to add a filter delta=9 to show only the value of the specific field 9.


texts: I need a function to set a menu item's class to active based on if a keyword is in the URL

texts:
Weird i know but as per the clients request i need to do the following:

if node being view is in a directory like this
/panelist/panelist-name

or this

/moderator/moderator-name

i need to set the a menu link in the main menu to active and also a sidebar menu item too.

now i know how to do the javascript part but i don't know to determine if /panelist/ or /moderator/ are in the URL, and also where i would put such code? i guess in template.php?

i tried doing in Rules but it didn't seem possible (still kind of new though!)

pseudo code would be
    if node being viewed contains 'panelist' or 'moderator' in URL
then
    echo out some javacript or
    set some menu  item class to 'active'

much thanks!


texts:
At present I am working on a demo site. I am pulling in sample images from from lorempixel for place holders. That is working great. In my content type I have an image field and it includes the url to the image like this: http://lorempixel.com/output/people-q-g-605-186-6.jpg

I will be creating views soon and I want to adjust the image size using image styles. How can I apply the image style to the text field that holding the url? Is this possible, if so, how? if not, is there another way to accomplish this?

I don't want to create various image size, just adjust them as they are being referenced.

Thank you in advance.


texts: How to remove a URL from my XML sitemap?

texts:
I have installed the XML sitemap module and included all my articles in the sitemap. By default, also the URL node/add/article is added, but I do not want that since anonymous users cannot visit this page. Google's Search Console tells me that the URL is blocked by robots.txt - which is great - but I want to get rid of the warning messages that show up due to the blocking.

How can I delete the URL node/add/article from my sitemap?


texts: Show content of type A in content of type B based on shared taxonomy term using views

texts:
I want to show content of type A (products) in the middle of contents of type B(Producers), however I do not want to use Node reference since it's an overkill to make it happen with lots of products.

So far I have a Vocabulary which both content type share, so I thought if I choose a single taxonomy term when creating the contents of each type, I can relate them using views to each other based on that shared taxonomy.

Anyways so far no luck, I appreciate any helps.


texts: How to update drupal 7.7 to 7.8 manually?

texts:
I found that there is a warning on my site saying that manual updates of Drupal core is required.

How can I do it safely?


texts: How are current anonymous users calculated?

texts:
I have a site running Drupal 6. When I log in to add new articles, it shows Current Anonymous / Authenticated Users.

How is this number computed?


texts:
I have a blog post content type, with a Computed Field that shows the number of comments on the post.

The field's Computed PHP setting makes a database query to count the number of comments attached to the node. The computed value is not set to be stored in the database, so should be calculated on the fly.

When a new comment is submitted on a blog post, the comment count field does not update automatically. Now, since I'm not storing the value in the database, I'm expecting it to be updated on node view, as per documentation:

  You can also choose whether to store your computed field values in the
  database with other content fields, or have them "calculated" on the
  fly during node views.

The only way I can get the comment count to update is by flushing the cache from the admin menu. So this leaves me with two potential options:

The results of the query in the Computed PHP setting of the field is being cached somehow. Find a way to stop this.
Use hook_comment_insert() to clear the cache when a comment is saved. The problem with this is that the whole cache is cleared which is expensive. I actually tried this and couldn't get cache_clear_all() to trigger for some reason, so I don't feel great about this method.

Any pointers? If indeed Computed Fields are meant to be calculated on node view, what is preventing this from happening?


texts:
I am familiar using ctools and modal forms. But now I have to implement multiple nested modal forms.
I have a link "Edit contact", this opens a modal form. At the top of the form I have another link "Delete contact", which opens a second modal form which asks the user if he/she is sure if he/she wants to delete the contact.
The response of the first modal form (as expected) is in JSON format:

This works nice and easy.
When I click "Delete contact" (second modal form), the response is HTML:

Because of this reponse I get following error:

Help? :)


texts: Translate Drupal's built-in English to another kind of English

texts: I need to translate the American English Drupal core currently provides out of the box to a variation of English. I know I can use string overrides but there are too many that I need to override. Essentially I need to create my own custom language based off english. Suggestions?


texts: Migrate content of cck fields from drupal 5 to 7

texts:
I need to transfer the content of a specific content type with bunch of textfield cck's to new D7 website, the thing is I found lots of ways to do such thing over the internet, I want to know what's the best and easiest and fastest way to do so.

I'm migrating from drupal 5 to 7.


texts: Adding a theme suggestion programatically

texts:
I created a feature module containing only a view and a content type.

Right now my page-node-x.tpl.php and my views-view-y.tpl.php files lie in my themes directory.

Is it possible to move them into my feature module?


texts:
I'm trying to follow the tutorial on multipage user registrations at http://www.grasmash.com/article/building-multistep-registration-form-drupal-7-using-ctools, but I'm doing something wrong. As it's written, if I put function hook_form_user_register_alter(&$form, &form_state) {, it throws me a Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE error; however, if I change the &form_state to &$form_state, it doesn't complain.

HOWEVER

It seems as if this form isn't replacing the existing form. There's a button added to the registration form Create new account (the standard Drupal continue button is still there). The rest of the standard Drupal form is still the same (just username and password fields).

Thanks for your help


texts: Passing a Taxonomy term via URL to add content form a content type in Drupal 7

texts: How can I pass a content type Taxonomy term in the url itself when I have created one node using that content type?


texts: How to force Feeds to import content? (Feeds too lazy to import every minute)

texts:
I've setup Feeds to import content every minutes. All settings was fine.
Feed source contains only 1 rss item, and it changed every 1 or 2 minutes.

When I manually click "Import" tab, it will import nicely. But in many times, Feeds too lazy to import it.

By using cron, Is there any way I can force Feeds to import?


texts: Is it possible to copy purchase orders from site to an updated version of the same site?

texts:
We have this site with Drupal Commerce and Commerce Registration Integration. The only "Product" is a single registration. 4 months ago the site was copied to development and that copy was completely revamped. Recently, I was tasked with putting the revamped development site into production. Initially, I wanted to copy the changes from the development site into production. However, I was advised the changes were so extensive, it would be weeks of work and the client wanted the revamped site live the next day.

So, the revamped site site is now live and I have to find a way to get the 95 registrations that occurred in the last 4 months from the original site to the revamped one.

Yes, this transition has been handled badly. However, if anyone has any suggestions I would be grateful.


texts: Why does my kernel test error with "Install profile will be a mandatory parameter in Drupal 9.0."?

texts:
I've test classes based on KernelTestBase.

Previously everything was working smoothly, now I came back to the project and I'm hit by this error:

  Install profile will be a mandatory parameter in Drupal 9.0.

Drupal version: 8.3.5
PHPUnit version: 4.8.35

phpunit.xml:

<phpunit bootstrap="web/core/tests/bootstrap.php" colors="true"
         beStrictAboutTestsThatDoNotTestAnything="true"
         beStrictAboutOutputDuringTests="true"
         beStrictAboutChangesToGlobalState="true"
         checkForUnintentionallyCoveredCode="false">
<!-- TODO set printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter" once
 https://youtrack.jetbrains.com/issue/WI-24808 is resolved. Drupal provides a
 result printer that links to the html output results for functional tests.
 Unfortunately, this breaks the output of PHPStorm's PHPUnit runner. However, if
 using the command line you can add
 - -printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" to use it (note there
 should be no spaces between the hyphens).
-->
  <php>
    <!-- Set error reporting to E_ALL. -->
    <ini name="error_reporting" value="32767"/>
    <!-- Do not limit the amount of memory tests take to run. -->
    <ini name="memory_limit" value="-1"/>
    <!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
    <env name="SIMPLETEST_BASE_URL" value=""/>
    <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix -->
    <env name="SIMPLETEST_DB" value="mysql://vagrant:vagrant@localhost/vagrant"/>
    <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
    <env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/>
  </php>
  <testsuites>
    <testsuite name="mymod">
      <file>web/modules/custom/mymod/tests/src/Kernel/FooTest.php</file>
    </testsuite>
    <!-- etc -->
  </testsuites>
  <listeners>
    <listener class="\Drupal\Tests\Listeners\DrupalStandardsListener">
    </listener>
  </listeners>
  <!-- Filter for coverage reports. -->
  <filter>
    <whitelist>
      <directory>./web/core/includes</directory>
      <directory>./web/core/lib</directory>
      <directory>./web/core/modules</directory>
      <directory>./web/core/modules</directory>
      <directory>./web/core/sites</directory>
      <!-- By definition test classes have no tests. -->
      <exclude>
        <directory suffix="Test.php">./</directory>
        <directory suffix="TestBase.php">./</directory>
      </exclude>
     </whitelist>
  </filter>
</phpunit>

Test class:

class FooTest extends KernelTestBase {

  protected static $modules = ['foo'];

  public function testFoo() {
    self::assertEquals(2, 2);
  }

}

I'm launching it from PHPStorm via:

  vagrant:///Users/drupality/Develop/drupal/myproj/usr/bin/php
  /home/vagrant/.phpstorm_helpers/phpunit.php --group foo
  --configuration /var/www/myproj/site/phpunit.xml --filter "/::testFoo( .*)?$/" Drupal\Tests\foo\Kernel\FooTest
  /var/www/myproj/site/web/modules/custom/myproj/tests/src/Kernel/FooTest.php

UPDATE

I've updated PHPUnit to 5.7.21 (newest supported by PHPStorm) but still no success.


texts:
I've read through many questions asking this same thing, but I feel like I'm doing what they are suggesting and it's still not working.

I've created a custom module and enabled it. This is my code:

function mymodule_node_view($node, $view_mode, $langcode) {
  if ($view_mode == 'teaser' && $node->type == 'article' && count($node->field_video) > 0) {
    kpr($node);

    $markup = sprintf("<video style='width: 502px; height: 282px;' poster='%s'>\n",
        image_style_url('video_thumbnail', $node->field_video[$node->language][0]['thumbnailfile']->uri)
      );

    foreach($node->field_video[$node->language][0]['playablefiles'] as $video_object) {
      $markup .= sprintf("<source src='%s' type='%s' />\n",
          file_create_url($video_object->uri),
          $video_object->filemime
        );
    }

    $markup .= "</video>";

    $node->content['field_video_embed_code'] = array(
      '#markup' => $markup,
      '#weight' => 10,
      '#type'   => 'markup',
    );

    kpr($node);
  }

}

When I look at the krumo output, I see my changes to the $node object, however, when it renders the new field I'm adding is not included.

What am I doing wrong?

EDIT: I just realized I'm using Display Suite (it's been awhile since I set this site up) which is overriding which fields are shown and in what order. My guess is that DS is getting my modified content, but not showing the additional field because it isn't listed in my teaser fields? I'm not sure.


texts:
What name do I have to give to my image.html.twig so the template only being used in content type "project" because I need to add class to an <img> tag.
I already tried

image--node--field-afbeeldingen--project.html.twig
image--node--field-afbeeldingen.html.twig


texts: Add markup before form output for user-login

texts:
I've created a template override for the user login form (user-login.tpl.php) and want to put some content before the form's elements (e.g, header text and copy). Anything you add in user-login.tpl.php become children elements of <form>. I want my supporting content outside the form structure.

Is there a template suggestion to get higher up in the processing chain or is this only possible using a specific preprocess hook in template.php or a module? Any examples would be greatly appreciated.

Thanks - Jeremy


texts:
Please help find the modules that allows me to create the following scenario

Admin can create a User-A
a. User-A will receive an activation email
After activation User-A will be able to:
a. create User-B with another permissions, which will also recieve an activation email
b. create groups of Users-B
c. assign Users-B to the selected group
d. managing and see only Users-B which he created
e. assign content to the selected group
After activation User-B will have access to the content of the group to which he is assigned.

I will be grateful for an any help.


texts: How to show separate values in Views from multi-value field

texts:
I made Multi-valued field in content type. I created image type of field and let it has unlimited number of images.
Is it possible in Views to show only first image from this field? And only 5th?


texts: Poll choices are not multilanguage supported

texts:
Hi I have installed poll and i18n_auto with gTranslate modules,

Both are cool, But the translation occurs only for Poll title and Poll Body not for choices.

Is it possible to translate the choice please advice.

Thanks,

Edvin.


texts: Selling user accounts with Ubercart module

texts:
A question regarding the registration process.
The project I am currently working on has a 1 step registration form (Drupal default). Upon completion of the form an account is created and the new user is e-mailed with an activation e-mail. At this point they are taken to the payment (ubercart) page to purchase the applicable role for the account.

Issue is, I need the registration form to only be shown either after the account has been paid for OR not to actually create the user until payment has come through.

Is this possible, and if so could you please point me in the right direction?

Thanks!


texts:
I've got a view which generates a query that does multiple joins. This produces a cartesian join, and I need to "convert" the joins to subqueries.

I've looked through documentation, Google search results and other sources, but I am unable to find any decent description of how I can configure Views to do subqueries. I've used hook_views_data() to configure the relationships (which are now carried out as joins). Is it somehow possible to define subqueries through hook_views_data(), or do I need to take another approach?

Any advise appreciated!


texts: jQuery for Drupal 7 Views Search Highlighting

texts:
I'm trying to add highlighting to my Drupal 7 Views-based search interface, so that when a user search for a word, words, or phrase, whatever they searched for is highlighted in the search results.

I decided to use jQuery and specifically this library : highlight.

I put the above jquery in my theme's /js folder and then added the following code to my template.php file:

    // add jquery.highlight-5.js just to views
    function trendtrack_views_pre_render(&$view) {
        drupal_add_js(drupal_get_path('theme', 'trendtrack') .
'/js/jquery.highlight-5.js');
    }

That seems to be loading just fine. I also added the following to my stylesheet:

.highlight { background-color: yellow }

The only thing I'm missing and that I'm unsure of is the jQuery code itself. Does anyone know what I should change in the below jQuery code to make it work with Drupal Views search results?

Note: My search interface is using a variable called 'keys' in the url, appended with whatever the user search for, so for example when a user clicks the submit button to search the url will look something like this:

http://localhost/search?keys=security

Here's the jquery code in question:

    jQuery.fn.highlight = function(pat) {
     function innerHighlight(node, pat) {
      var skip = 0;
      if (node.nodeType == 3) {
       var pos = node.data.toUpperCase().indexOf(pat);
       pos -= (node.data.substr(0, pos).toUpperCase().length -
node.data.substr(0, pos).length);
       if (pos >= 0) {
        var spannode = document.createElement('span');
        spannode.className = 'highlight';
        var middlebit = node.splitText(pos);
        var endbit = middlebit.splitText(pat.length);
        var middleclone = middlebit.cloneNode(true);
        spannode.appendChild(middleclone);
        middlebit.parentNode.replaceChild(spannode, middlebit);
        skip = 1;
       }
      }
      else if (node.nodeType == 1 && node.childNodes &&
!/(script|style)/i.test(node.tagName)) {
       for (var i = 0; i < node.childNodes.length; ++i) {
        i += innerHighlight(node.childNodes[i], pat);
       }
      }
      return skip;
     }
     return this.length && pat && pat.length ? this.each(function() {
      innerHighlight(this, pat.toUpperCase());
     }) : this;
    };


texts: Omega 3.x base theme missing after Drupal upgrade

texts: After upgrading Drupal to 7.4.3, i am missing my Omega 3.x base theme in the ui. My subtheme is still present, but the layout is all messed up. Any idea's?


texts:
After looking into new-relic I found that bean_block_info was taking a high % of total load time. In the code I found that this function loads all the beans on first time access (before leveraging cache on subsequent loads). I have thousands of beans which were created over past few years and many of which may be not in use. Most of the beans are added via panelizers.

Is there a quick way/script to find out which beans are not in use? I will remove them so that the first time load time is improved.


texts: Where is the content of the pop up bubble in my form validation coming from?

texts:
I use the Clientside Validation module for my webforms.

I get a "Please enter an email address" pop up bubble next to the email text field when an incorrect email is entered. I am not quite sure where this is coming from.

I would prefer this functionality instead:

  Submitting the form with an empty email field displays a different
  error message to when an invalid email is entered eg.
  http://validation7.ubu001.attiks.com/node/1?utm_medium=atix&utm_source=cv7b

Can anyone shed some light about it?


texts: I need to use 1 hook from webforms.  Where does this belong? Do I have to make a custom module just to implement 1 hook or is there a more appropriate place?


texts: Add a sticky class to node displayed via View

texts:
How to add class for sticky nodes in Drupal 8, so I can theme views (sticky having different background etc).

I have seen a post that it can be done through Twig, but I cannot understand in which template should I put the lines and frankly...which lines?


texts: Is there a module or part of devel module that will auto populate (with fake data) a Content Type a create a dozen or so nodes?


texts: Any way to convert a page of type X into page of type Y?

texts:
I inserted a webform on a Basic Page. Now, I decided I should have created a dedicated content type to hold that webform.

So now - is there an easy, non-risky way to "migrate" that page to a new content type without the need to recreate it?

I would like to save myself a couple of moments redefining the webform from scratch, but if the db dependencies are too complex, I would rather take that cost rather than risk screwing up the db.


texts: Entity Reference - adding fields to reference?

texts:
I'm using taxonomy and nodes to create a tree structure. Inside the taxonomy term I created an Entity Reference (referencing to nodes). I know this looks like the world upside-down, but for this time this was the easiest way.

Term1 (reference to:) - Node A, Node B, Node C, Node D
Term2 (reference to:) - Node B, Node D, Node E

I want to add custom fields to the node, but with different values for each reference. Let's say I want to add a date field with different values for each reference. Adding a custom field to the content type won't work, because they will be the same for all references.


texts: Find specific node to uninstall a module

texts: I want to uninstall a module but I'm getting the following message. The "Name of Module" field type is used in the following field: node.field_feature_interest. How can I find this node so I can remove their relationship between each other so that I can delete the module?


texts: Views Data Export not showing data export display option in view

texts:
I installed Views Data Export module on a Drupal 7.50 site and it works beautifully. I am trying to incorporate it now into a new website (which happens to be 7.54). I have cleared all the Drupal caches as well as the browser cache and have checked that the module is enabled. I also have Views Excel Export extension installed and enabled on both sites.

I'm completely stumped that this works perfectly on one site and not working on another.. .

Update: I thought I checked the versions, as I installed them on the same day, but somehow, the one on the site that works is an older version (3.1 vs. 3.2).

I tried uninstalling it and installing the older version but it didn't resolve the issue. I also checked permissions but there aren't permissions for this module.

Here is the conversation on Drupal.org with no resolution.


texts: Print key value as a class along with the label for a list field?

texts:
I have a node with a field which is a List (integer). I can print the value in node tpl with the following:

<?php print render($content['field_name']);  ?>

However I also need to style each result differently. For instance one of the options is 'large' and I want to add a background image to every 'large' result.

How can I do this? I was thinking if I could print the key value as a class along with the label the I could easily do the rest with CSS.


texts: Activate an existing menu item through code

texts:
I need to activate an existing menu item through a hook when I'm on a certain page.  To give some context, I have a primary navigation bar which is visible on all pages, and when I'm on a user profile page I want to activate the People menu item.  The path to people is /people.  Any help is appreciated.

Cheers.


texts: How can you unset entity view display component with config override?

texts:
I have an entity view display configuration where I would like to "unset" a component (one of the field). I implement the ConfigFactoryOverrideInterface
with the right service configuration.
Is there a way not just override a configuration array but completely remove one of it's key? (in this case one of the component).

I also found where the return value of this method (loadOverrides) is being processed and unfortunately the NestedArray::merge is used which gives a higher precedent to the original config. (which in the end won't let you to remove a key..)

Any ideas how to solve this? (this has to happen runtime.. the change mustn't be permanent like simply changing it on the UI and save)


texts: for anonymous user, webform not submitted because of private file

texts:
I have one webform which contain the private file field.

As admin user: i can upload the file and submit the form.

As anonymous user: i can upload the file but while saving the form, i am getting 'file field is required'

Uploaded file '/system/files/webform/abc.jpg' present at  '/sites/default/files/private/webform'.

As Anonymous user:
i can access file using '/sites/default/files/private/webform/abc.jpg' but get access denied using '/system/files/webform/abc.jpg' url.

Additional Info:

File Setting:

Private Path : 'sites/default/files/private'

Public Path : 'sites/default/files'

Drupal 7.64

Webform : 7.x-4.18


texts: How can I change the file saving process to wait until file changes have been synchronized on all servers?

texts:
We have a site load balanced behind three servers, and we are using lsync and csync2 to replicate file changes across the servers.  In the past we used a GFS system to handle this, which worked great at fencing the other servers until the files were synchronized.  But we ran into issues with the servers locking up and the site going down when something went wrong.

With lsync and csync2 we are hoping to avoid the lock-up issues.  However, the lag between the file sync is between 5 and 15 seconds for small files, and up to 120 for large file uploads.

Is there a way to change the file saving process, or even the node/entity saving process, to wait until the file has been synchronized on the other servers?  Once the files are synchronized on the other servers the process can continue.

We use both public and private files, and we aggregate CSS and JS.  This question is mainly concerned with the public and private files.


texts: Why is Drupal's CSS aggregation creating four files instead of one?

texts:
Possible Duplicate:
  How does bandwidth optimization work?

I have Drupal's CSS aggregation enabled on a Drupal 7 site. The CSS files are being aggregated, but they are aggregating into four files, not one. I'm not sure why. The media for each file is "all", so they match.

What would cause CSS aggregation to split the files?

The site Zujava.com.


texts:
I'm using the media entity from Drupal core together with the media library, to handle media on my site.

I have Remote Video and Image with crop media types. I'm using the crop and image_widget_crop modules to manually crop images on my site.

Remote video supports YouTube and Vimeo.

Right now the thumbnail is automatically generated, but I want to be able to upload a custom thumbnail. If no custom thumbnail is provided, it will just use the auto generated one.

I found this guide, but it is for Drupal 7.

Has anyone done something similar to this in Drupal 8?


texts:
From Chosen module page:

  This module comes with a Drush make file, which will automatically download the jQuery plugin if you use Drush make to set up your website.

I have Drush Make, but commands like..

 drush dl chosen
 drush en chosen

..don't help.
Should I use drush make ... command instead? Maybe there are other commands for quick libraries download.

P.S. I'm working on already installed copy of Drupal.


texts: How to theme a field group (with div output and css class set)?

texts:
I would like to theme a group of fields that belong to a content type. For example to position all of them at a certain area in the page.

I want to do this in conjunction with the field_group module

I know that it is possible to theme an individual field, by overriding field.tpl.php in your own theme, along with CSS as required. And I have done this successfully.

However I'd like to know if there is something like field-group.tpl.php which I can override in my own theme, similar to how I have done for field.tpl.php.

When editing the field group settings in the Content Type, <div> can be specified for a field group, as well as CSS classes. So I create a field group and specify these things and then add some fields to belong to my field group. However, when I look at the html source output for content of this content type, I cannot see anywhere this extra div is defined nor its groupname. Therefore I don't know how to theme it. Please advise.


texts: Webform Module can't send email from user anonymous

texts:
I'm using Drupal 7 and Webform Module for create contacts forms (This problem also what I have in Pressflow 6).

Only authenticated users can send mail through the form. However, I need that anonymous users can also use the form.

The error is as follows:

Error sending e-mail from sender@email.com to target@mail.edu.pe: SMTP Error: Data not accepted.
SMTP server error: 5.7.1 Sender domain not allowed.

How I can make the form send mail with both roles (authenticated and anonymous)?
How I can avoid spam for users anonymous?

Details

Each time you use the contact form (either anonymous or authenticated) to send an email to the person responsible of receiving these emails.


texts: How to make blocks contextually aware of current webform page

texts:
I have a multipage Webform that lives at a single URL and I would like to place certain blocks depending on which page the Webform is on.

None of the webform hooks give access to page number, and the only way to do so seems to be through a hook_form_alter which afaict is a bit late in the page build to pass information to other modules like Views and Context.

Any ideas how this might be achieved?


texts: Is there a reference by url widget type for term reference field as we have it for node reference field?

texts: Is there a module for term reference as we have "Node reference url widget" module for node reference field. So that I can auto-populates a term reference field with a value from the URL.


texts: import and update drupal webform submission from remote url

texts:
Is it possible to retrieve data from a remote server, pass it to a  Drupal site, and if the corresponding webform is present, to update these values in the database, else, create a new webform submission based on these retrieved data?

1) What modules will I need to do so if it is possible?
2) Any sample codes present already which can help me proceed?

Thanks...


texts: Patch drupal.org project (core/module/theme) with issue fork

texts:
The new fork based merge request (MR) approach is pretty neat to get the patches created/reviewed/merged. However, if you are using the patch via cweagans/composer-patches, we have a few options.
Option 1: we can use the MR  to add the patch like this:
"drupal/message": {
  "3186091": "https://git.drupalcode.org/project/message/-/merge_requests/1.patch"
}

but it means any new change pushed to the fork/branch, would get automatically added. As the patch file gets pulled on composer install.
Option 2:
We could use the fork's branch and commit hash to keep the patch static, but once the MR merged, the fork might get deleted and breaks the build.
Option 3: Obviously we can generate the patch from the MR and upload to the issue comment, but it seems a duplicate effort and hard to keep up with an active core issue (right now, we just need to update the patch file in composer.json or composer.patches.json)
Is there a way to have the current patch file behavior in the new fork based issue queue?
UPDATE: Both option 1 and (probably) option 3 are documented on drupal.org