texts: Same SKU but different product - Drupal Commerce

texts:
I am facing a problem with the Products in a website made with Drupal 7 and Drupal Commerce.

As per the requirement, two admin can create products in the website with Same SKU and same name. But the difference will be the Stock number and the color etc.

As an example,
Product A has SKU: 0001

The 1st admin Creates Product A with Price $10 and stock 10.
The 2nd admin Creates the Same product with Same SKU with Price $20 and stock 5.

Is it possible to do? Or it's better to create new SKU each time? Please suggest.


texts: Sorting rows that appears in multiple groups

texts:
I have a View where rows are grouped by a taxonomy term. The taxonomy term field accepts multiple values, so there could be cases where the same row occurs in more than one group.

For exmaple:

Group #1 - Term A

Node 3
Node 5
Node 7

Group #2 - Term B

Node 3
Node 4
Node 6

The problem I am facing is that in the scenario above, Node 3 has the same weight value in both groups. Therefore, if I change the weight of Node 3 in Group #1, it also gets changed in Group #2.

Is there any way to apply a unique weight to rows that occur in multiple groups?


texts: How can I make a curl type http request after a node submission?

texts:
Basically I have a node type which I've named "rss". Its purpose is exactly as I'm sure you guessed, all of these nodes are available as an rss view at a specific url (ex: http://mysite/rss/feed).

When a node of that type gets created (or updated I suppose) I need to make an http request to a specific url (the details to that are irrelevant to this question).

So lets say I create a new "rss" post on my drupal site, after it gets submitted I need an http request to the url ex: http://myapplication/blog?status=fetch

I know that I can make such a request happen with the visit url function in actions core module, and "trigger" it on node creation (not of a specific type though) but I think it does exactly that, and actually VISITS the url, whereas I just need it to make a curl type request.

I'm also using the scheduler module, so posts of this type can be scheduled, so I would need to trigger the action in sync with the schedule, if it is scheduled to be posted at a certain time/date, that is.

I'm guessing I need to use some sort of hook functionality and make my own module, true? Or is there any other way of doing this?


texts: Get the nid from current URL after the ? for views argument

texts:
I am adding a post to an Organic Group and I want to display a list of all posts to that group below the node add form. The url looks like this:

    node/add/group_post?gids[]=23

I want to add argument that filters the view using the group's id. How can I use the PHP to get that gid?

This is what I have so far, but it's not working.

    $gid = htmlspecialchars($_GET["gids[]"]);
    return $gid;


texts: Attach js file to every page w/term reference widget in Drupal 8

texts:
I have begun trying to port a small, simple module that I maintain to Drupal 8.

It was originally written (not by me) in Drupal 6 and used hook_init() in combination with drupal_add_js() to attach its scripts to every page.

Both hook_init() and drupal_add_js() have been deprecated in Drupal 8. I only really need to attach scripts to pages that have a taxonomy term reference widget (and in fact much of my logic has already been moved into a hook_field_widget_taxonomy_autocomplete_form_alter().) Scripts are now added via #attached which I understand, but since I don't have the $form array or object in hook_field_widget_taxonomy_autocomplete_form_alter() I'm not sure where to add the #attached element.

I'm also not clear if #attached is used instead of or in addition to a *.libraries.yml file. Does every single module with its own script.js need to declare a *.libraries.yml file?

How do I attach my custom js file to every page with a taxonomy term reference widget in Drupal 8?


texts: Ubercart admin invoice: Show attribute prices

texts:
I need to modify my admin invoice template to include each ordered product's base price AND any selected attribute prices.

For example:

  The product Baseball Glove is $50.

  The optional attribute Glove oil is $5.

  When a customer selects the attribute, it makes the total product
  price $55.

Currently, the admin invoice shows just the product's total price along with a list of it's selected attributes. How can I display both the base price ($50) and attribute price ($5) for each ordered product on the invoice? Also, this would need to be scalable to work for products with multiple attributes.

Here is the current code we are working with in the admin invoice:

Products ordered:

<?php foreach ($products as $product): ?>
&emsp;<?php print $product->qty; ?>x <?php print $product->title; ?> (SKU: <?php print $product->model; ?>) - <?php print $product->total_price; ?>

<?php if (!empty($product->data['attributes'])): ?>
<?php foreach ($product->data['attributes'] as $attribute => $option): ?>
&emsp;<?php print t('@options', array('@attribute' => $attribute, '@options' => implode(', ', (array)$option))); ?>

<?php endforeach; ?>
<?php endif; ?>
<?php endforeach; ?>

Which appears like this when rendered:

Products ordered:

1x Baseball glove (SKU: BB-1) - $55.00
Glove oil


texts: Varnish problem, user logged out for a HIT page

texts:
Have someone experienced simmilar problem, I've installed Varnish(v3, on Debian 6, Drupal 7), and also Varnish Drupal module, conigured settings php and vcl, and everything seems to work fine, except Logged-in users sometimes get "logged out", ie when they click on link they are redirected to cached Varnish page (HIT). For pages that are MISS everything is fine.

How can in enforce for logged in user to never hit cached page, thus get logged out?

Administrative pages are working well and never express such behaviour, as i followed few tutorials/setting how to setup vcl and config files.

Thanks!


texts: How do I delete the Edit Delete buttons suddenly showing above pictures?

texts:
All of a sudden when I insert a picture into a page, it shows an edit and a delete button above the image to the end user.  These buttons take you to the default page.  Also, now when I edit a page from the edit button at the top of each page and save, I get the following type of message after a lengthy wait.

Fatal error: Allowed memory size of 356515840 bytes exhausted (tried to allocate 523800 bytes) in /data/www/luna/sites/all/modules/token/token.module on line 767

I can edit and save if I select the page under Content.

See http://lunahq.com/content/luna-rox-v8-simple-smarter


texts:
I am using Drupal 7 and the Backup & Migrate module to restore (or import) a Drupal installation that works fine on a different computer. When I run the import process everything seems to work fine, except that clean URLs seem to break and I don't know why.

These are the steps I've gone through:

I have a Drupal install working fine on Computer 1 (MAMP and Mac Lion OSX).
I push the code to Github and export the database with the Backup & Migrate module.
On Computer 2 (also MAMP and Mac OSX Lion), I import the Github repo and install a clean Drupal site.
At this point, Clean URLs are working for the new install on Computer 2.
On Computer 2, I then go to the Backup & Migrate module and restore the database from Computer 1
The install runs just fine, except that suddenly Clean URLs are broken.
There are no logs that give a new error. The Clean URL test simply fails with no other feedback.

I can only imagine that something in the database is causing this issue since the Backup & Migrate restore should not be changing the .htaccess file, folder permissions, or Apache.

Do you have any idea on why a database restore would break clean URLs?


texts: set_query_operator not having any effect on my WHERE clause construction

texts:
I'm doing a hook_views_query_alter and trying to add a simple OR condition to the end of the existing WHERE clause. I'm using set_group_operator('OR') but when I examine the actual query in the MySQL logs, it still has an AND.

Here's my code:

function mymodule_views_query_alter(&$view, &$query) {
  $display_title = $view->display[$view->current_display]->display_title;
  if ($view->name == 'events' && stristr($display_title, "event")) {
    $query->set_where_group('AND', 'repeating', 'where');
    $query->add_where('repeating', 'node.type', 'event', '=');
    $query->set_group_operator('OR');
  }
}

What I'm seeing in the actual query is:

WHERE (( (node.type = 'event') )
AND ( ___STUFF_THAT_WAS_ALREADY_IN_THE_WHERE_CLAUSE___ )

When what I want/expect would be:

WHERE (( (node.type = 'event') )
OR ( ___STUFF_THAT_WAS_ALREADY_IN_THE_WHERE_CLAUSE___ )

What am I doing wrong? Any suggestions? I'm kinda stumped.

Thanks


texts:
I have built a custom block plugin in Drupal 8. However, I needed to insert some svg elements in the markup, which get all filtered out. Is there a way for me to specify to display the raw output, so that the svg does not get filtered out?

  public function build() {

    return array(
      '#type' => 'markup',
      '#markup' => '
<svg>.....</svg>
',
    );
 }
?>

I have tried adding '#template' => '{{ value|raw }}' and played some with it - but could not get it to work. There must be some way to allow me to insert svg in there...


texts: How to add an 'if' statement for a content type in a custom views-view.tpl.php?

texts:
Is it possible to add an 'if' statement for a content type in a custom views-view.tpl.php?

This is just so I can add text to show if the post in the view is either an 'episode' or an 'announcement'. The content type is called announcement.

I want to do this because I need to identify and style differently based on the post type:

If it's from an episode, it displays the episode number.
If it's an announcement, it says announcement.

So basically something like so:

<?php if (content_type='whatever') {... code goes here ...} ?>

If this is possible, can you provide an example?

Note: I have a custom theme called views-view-field--first-post--block--created.tpl.php and all it has is <?php print $output; ?>. It's called a field content date.

Also, this is what the output of the entire view looks like: stdClass Object ( [node_created] => 1434783086 [node_title] => CTRL Daily Episode 11 [nid] => 11 [node_type] => ctrl_daily ). [node_type] is what I want.


texts: Organising content using Taxonomy and Views

texts:
I'm just starting out with Drupal and I'm interested in how to display my content and organise it in the site.

I can see that creating basic pages I can use the Menu module to add them to the hierarchy of the menu, but is this the only way to organise content?

I'm trying to learn the Views module, which is complicated! But it seems more logical to me to create a custom taxonomy and then use the Views module to display a subsection of that taxonomy.

Is this possible?


texts: Making drupal_goto Ignore ?destination=foo

texts:
I frequently come across cases in my Drupal 6 sites where a user might encounter my module's pages with the ?destination=foo querystring appended to the URL, from previous interactions on the site. Results of this vary from "inconvenient" to "very aggravating."

The default behavior of drupal_goto() checks for the destination parameter first, and disregards the arguments to drupal_goto() if it is present.

Is there a Drupal-native way to use drupal_goto() in a way that ignores destination?

(Yes, I know I can recreate a version of drupal_goto() in a utility function, but I would prefer a Drupal-native solution if one exists)


texts:
I have 2 modules. Let's call them Publisher and Publication for discussion's sake.

Publication module requires Publisher module. Publisher module provides form to edit publisher's data. Publication module provides list of publications with reordering and adding capability, and it can be limited to display only publications by one publisher.

Now, I want to nest publisher's publications form at the bottom of his data edit form. I would prefer to avoid writing same code again - I want to keep validation functions and submit functions as they are now, just have it on one screen, with one submit button.

Subform seems to be unmaintained and buggy at this point and Multiple forms seems to skip validations altogether, that makes both of them unusable for me.


texts: Performance hit from using the Statistics module?

texts:
For a site that we will have 99% of users seeing Varnish/Memcached layers, what is the general performance hit to enabling the core Statistics module? The site may have thousands of visitors daily.

Is it best to just not use it at all? I am of the opinion that it is not worth the database activity.


texts: How to rename the views tabs in user accounts

texts: How do i rename the "view" tab in the user accounts? I want to rename it to Profile. Am using drupal 7 and the zen sub-theme. Any suggestions are welcome.


texts: Automatically creating an organic group for each new user

texts: I would like to automatically create an organic group for each newly registered user. I checked all its settings, no such option with organic groups module, then I checked the rules module but no luck there too.


texts: How do I change the date format depending on Start and End date in Drupal 7

texts:
I have a content type called 'Events' including the fields:

Title
Thumbnail
Date (Can be a start, or both a start and end date)

I have created a view that takes this content type and outputs it as follows:

Exhibition
Thumbnail
17 December 2015 or 17 December 2015 - 23 December 2015

My question is how can I can change the output of the field if the 'Date' field has a start date and an end date.

I am using the Event Calendar Module to create my events.

Can you offer a solution? Thanks in advance.


texts:
To modify some default settings for the Feeds module, I need to set a variable in the $conf array. What is the right way to achieve this?

I've tried adding it in the settings.php file (currently on local), but it doesn't appear in the variable table (even after restarting the server). "Clear all caches" didn't change anything, either. What am I missing?

What I am actually trying to do is to set $conf['feeds_process_limit'] = 15; exactly in the same way as described on http://drupal.org/node/1363094 and http://drupal.org/node/1393450; after adding it to the settings.php file, the result is the same: The amount of imported items isn't being limited.

How can I ensure the variable was set as in the settings file, and not to the default value?


texts: White screen of death in hook form alter

texts:
I have enabled simplenews module in drupal 8 and I am trying to reduce the width of input field from 60 to 30. I am trying to implement form alter hook and have devel module installed. I used  dsm($form_id); to identify form and then in order to identify the form attribute to change, I tried to use dsm($form), dpm($form) and print_r($form) and all these are giving white screen of death.

function custom_newsletter_form_alter(&$form,  $form_state, $form_id) {
  if ($form_id == 'simplenews_subscriptions_block_2138c21c-6453-4b7d-92d6-9407e427a78a') {
    dsm($form);
    dpm($form);
    print_r($form);
  }
}

I have tried different drupal 8 installations both localhosted and web hosted, tried with different themes but I am not able to print form. Is there any other way to identify/target correct form attribute to change like DOM inspecter of firebug?


texts: What is the best way to make some content only available to authenticated users?

texts:
I'm currently trying out Drupal 8, but I'm wondering what is the best way to make some content (content types and some specific nodes) only available to authenticated users?

I'm using 2 content types, private and public, with both using the same taxonomy, but I would like one type to be published public and one private.


texts: Show specific submenu and mark specific item as active when front page or specific node type is opened

texts:
My front page is basically a view that lists teasers of node type article. How can I show a specific submenu and mark one item in this submenu as active (+ its parent) when

1) the front page is opened or

2) any article is opened?

I know 2) can be done with the module "Context Active Trail" and "Context UI", but I want to do it without a module and I think the module can't do 1) anyway.


texts: How to change the product variation auto title pattern in drupal 7 commerce?

texts:
Update

Got it working with Automatic Entity Label

Is it possible to provide a token pattern, just like for the SKU auto generation, for the auto generation of product variation titles? I can only check if they shall be autocompleted, which they should, but their title is always just like the node title.

How can you define/ alter this?


texts: How do you add table column sort functionality to an EntityFieldQuery?

texts:
I have an EntityFieldQuery that gets displayed in a table. How do I add clickable sort-by-column functionality? When I use regular db_select queries I can sort using the following code:

 $query = db_select('tablename', 't')
   ->extend('PagerDefault')
   ->limit(50)
   ->extend('TableSort')

 // ...

 $query = $query->orderByHeader($header)
 $results = $query->execute();

Everything looks good and when the table is displayed I can click on the columns and they are hyperlinks and I can sort just fine. However, now that I have an EntityFieldQuery I can't seem to duplicate the functionality. This is what I have so far:

$header = array(
  'title' => array(
    'data' => t('Date'),
    'type' => 'field',
    'specifier' => array(
      'field' => 'field_articledate',
      'column' => 'value',
    ),
  ),
);
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
  ->entityCondition('bundle', 'article')
  ->propertyCondition('status', 1);

$query = $query->tableSort($header);
$query = $query->pager(100);

$results = $query->execute();

A one-column header appears and it says "Date" as expected, but it is not a clickable hyperlink. What am I doing wrong? What is the correct syntax?


texts: Should I call my function in Drupal custom modules?

texts:
I've been trying to implement  a redirect to user register page if an anonymous user tries to access a specific page. I used the following code in my custom module.

function myregistration_init(){
  global $user;
  if ($user->uid == 0  && $_GET['q'] == 'order_translaton' ) {
    drupal_goto('user/register');
  }
}

However, this code did not work until I wrote myregistration_init() after the function body. I know that in Drupal modules function works automatically without the need to call it. For instance, the following code works without function call:

function myregistration_form_user_register_form_alter(&$form,&$form_state){
$form['#submit'][] = 'myregistration_submit';
function myregistration_submit(&$form,&$form_state) {
$form_state['redirect']= 'order_translaton';
}
}

Please explain how all this works in Drupal modules.


texts:
I have spent 4 days looking for information on many pages without result, I would like to make a view from which to send an email with the information of a node, with view send and user view I can send emails to those I have select.

But my problem is when to send information from the title of the node, the node apparently not sent. From the panel where the view I can show the node to which I Referencing the URL node /% node / my_view, but apparently not saved when sending mail.

I've found a way to call a certain node with [aet: node: title] and [current-page: url: args: value: 1], but does not work [aet: node:% [current-page: url: args: value: 1]: title].

Any ideas?


texts: user login screen is gone after using panels

texts:
I've been trying to login with /user, /?q=user, and /?q=user/login but when I load the pages I can only see my header and nothing else.

This is likely because in the process of trying to learn how to use panels I somehow turned it off.  The default node variant was the first I created, where I put basic header information (site name, slogan, navigation) in the header, body content in the middle, and regular footer content in the footer with the new node-template variant.  As I recall I disabled this page/variant after I realized it applied it to every page and messed up a different system page.  Even though I disabled it and it was fine last time i was on the site, it seems to be back.

Is there any easy way to fix this?  Is there any thing I cut paste into a php file to load my user login block so i can at least get back into my site?


texts: Cannot get subscriptions to send out at correct intervals

texts:
I set up the "subscriptions" module and have set it so that all members of the page have access to a number of panels. One allows them to set the frequency of emails, one allows them to pick and choose which nodes to subscribe to.
The node choice works well, and so does choosing a 'digest' choice for the emails.

The issue I am having is that the notification emails are sent out at what seems to be the first cron event after the new content has been added, which can be a long time if I don't visit the site, but at the same time too soon if someone has chosen a longer interval.

I am currently the only one 'testing' the site so have two users set up with subscriptions. One I have set for once every 3 hours and one 'once per day'.

As Cron was only running when either entering the site or running manually, I also chose to download the module "Ultimate Cron" which I thought would run Cron more often (i have it set to 30 minutes), but it does not seem to be doing this either, although messages are being sent to both users, even if the one asking for a message no more than once per day has already received one in that 24 hour period.

If I don't visit the site, both now get messages at least, but not at the correct intervals.

One of the main organisers of our organisation says she will not join the forum and member site unless there is a way to get notifications once a day, or once a week, and she is trying to push to use Yahoo forums, but I have everything set up the way I like it and so if I can fix this one issue I can then open it up to members of our small society.

Here are some screenshots of my SUBSCRIPTIONS settings.
I have tried to show what I believe is relevant.
I have disabled the other subscription modules which I had tried in the past.
I DO have some messaging modules though (please see "messaging module" image)

UPDATE:
Tested again and still receiving messages on each cron run rather than at the correct intervals.
As mentioned below in a comment, it is likely an issue with the Subscriptions module.

If anyone knows how I may be able to fix settings, or even adjust line code to figure this out then I would be very grateful.

Had already tried notifications etc. but Subscriptions is perfect for what I need (if it worked).

Thank you all.


texts: Show hook_form on specific content type Drupal 7 Programmaticaly

texts:
How can show a form that is created with the drupal _hook form api, on a specific content type? So, as example:

I created new content for the content type 'outside' when I click on save I see the content type like this:

Titel
Date
Description

What I want is a form below this. I created one with a _hook form and it is working an saves data to my database but I have no idea, how can I show them on the same page as my content. It may not show on the content type 'inside'! Now it's a other page the link is /outside-form and only the form shows up there, no content type.

How can I get them below my content on every page that has the content type 'outside'? I have written a own module, but only this is not working/showing up on specific content(type).

Can someone explain it to me?


texts: How do I override the title with the username?

texts:
I am creating a view that will be visible under /user/%/blog, and I am trying to override the view's title with the username (e.g. kiamlaluno's blog), but the description of the field doesn't tell me what I can use to override the title.

I only get I can use Twig syntax, but that doesn't help much.

I used Content: Authored by as contextual filter. I also added author as relationship, but I didn't see any change.

How can I override the title with the name of the user authoring the nodes being shown from the view?


texts: How to add a contextual action link to a View?

texts:
I want to replace the default EntityListBuilder from a custom entity with a View, as it is much quicker to build that list interface with it.

However I want to retain the action button from the EntityListBuilder on the View itself, which is in the links.action.yml:

entity.room.add_form:
  route_name: entity.room.add_form
  title: 'Add Room'
  appears_on:
    - entity.room.collection

Would I just add the view identifier under appears_on? What would the format be for that string?


texts: Custom template for custom page in custom module in D6

texts:
So I know there is a way to specify a custom template for custom content types etc, but if I have a custom module where I am using hook_menu() to add custom pages with a page callback function, how can I specify that the pages I create use a custom template? This particular site is still on Drupal 6, so I would need to know the Drupal 6 method if it's possible

THANKS


texts: Checking if user is logged in and inputting their username

texts:
I have a form on my website and i would like the page to check if the user is logged in, if they aren't, then redirect them to a login page, if they are, then show the form.

When they are submitting the form, how can I get that users username and get that review that they submitted show up on their account?

If you need any more details just comment.

I am using Drupal 7


texts: How to change Search API index field machine name?

texts:
I am using Search API and Search API Solr modules on drupal 7. I have also drupal 8 and drupal 9 sites, and all those sites are indexed on the same solr index. So I need the same machine name for indexed fields on Solr index. For this purpose, I need to change marked machine names.
Solr index field names are generated from those machine names.

For drupal 7 I can't find a field mapping solution like Search API field map module for drupal 8, 9.
Is there any solution to override those fields' machine names in index creation?
Thanks.


texts: Eliminate access to specific user based on url, uid and role

texts:
I'm using D8 and I have a panel page which has as parameter in the URL the uid (mysite/uid). In this page, are loaded different nodes and forms. What I want to do is to eliminate the access only to this user and the admin. It is not a node of a content type so as I can use the existing permissions (edit your own page).

Any idea how to implement this?

I was thinking to use something, maybe hook(?), triggered every time the user tries to access that page and doing some checks like the url and the uid and if the user is not admin or doesn't have the correct uid, throw an AccessDeniedHttpException();


texts: 'File' class not found in submitForm(...) - uploading managed_file

texts:
I have an image field in my custom module's form:

namespace Drupal\my_module\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

use Drupal\Core\Mail\MailManagerInterface;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Html;

class MyModuleForm extends FormBase {

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['image_file'] = array(
      '#type' => 'managed_file',
      '#name' => 'image_file',
      '#title' => t('Block image'),
      '#size' => 40,
      '#description' => t("Image should be less than 400 pixels wide and in JPG format."),
      '#upload_location' => 'public://myimages/'
    );
...

And for submitForm(...) I use:

  public function submitForm(array &$form, FormStateInterface $form_state){
    $image = $form_state->getValue('image_file');
    $file = File::load( $image[0] );
    $file->setPermanent();
    $file->save();
    ...

But when I use the form to submit image I get error (in log):

  Error: Class 'Drupal\my_module\Form\File' not found in ...


texts: Show access denied in custom page without permissions

texts:
I have a requirement where based on user ID displaying the page. If not show Access Denied.
Drupal 7 we have drupal_access_denied().
What is it in Drupal 8?


texts:
I want to use jCarousel plugin or similar. But I do not want to use the module.

Add content will form part of and the carousel will add pictures. How can I do? Does anyone have an idea?


texts: Hello I've created a vocabulary which contains a lot of ingredients can i make it easier to choose them. At the moment it is a long list. If it is somehow possible to make a search form where i can select multiple ingredients it would be great. Modules or other soloutions?


texts: Is it possible to assign attributes to different roles?

texts:
So let's say I have a student role. And I want assign variables to student such as attendance and grade.

Then i want a teacher role that can assign this attendance and grade to their students.

We can pretend that there is only one teacher and there are many students.

How would this be done? I know that you can edit fields under Config->People in drupal 7, but this causes there to be the same fields for all users.

In a similar way, is it possible to have like a "Student Page' where a student sees his/her own grade but not any one else?

I've been trying to find similar function but it seems to not exist.

Thanks


texts: Webform Service module : how to upload files

texts:
I need to create new submissions to a webform using a webservice.

It works well using the Webform Service module, but it seems limited to simple components only (i.e. text...).

Is it possible to upload files with this module?
If no, how could I achieve this by writing a custom module?


texts: How to delete all Taxonomy terms of particular vocabulary using entity_delete_multiple?

texts:
I want to delete all taxonomy terms of particular vocabulary using entity_delete_multiple. For node it is working fine

$result = \Drupal::entityQuery('node')
      ->condition('type', 'page')
      ->execute();
  entity_delete_multiple('node', $result);

If i am changing taxonomy_term and type to tags or any other vocabulary, or replaced type by bundle

$result = \Drupal::entityQuery('taxonomy_term')
      ->condition('type', 'tags')
      ->execute();
  entity_delete_multiple('taxonomy_term', $result);

it is throwing error like this.

  Drupal\Core\Entity\Query\QueryException: 'type' not found in
  Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 304 of
  core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).

And also i need a same query to delete user(s), watchdog and profiles.

Is there any way to do it?


texts:
I have a new view that is coming up with a new issue, there is a "main image" for every entry, and for some reason after loading the page, almost all images break. But what's odd is that when you click on the Title Number or the Image (whichever you want to get to the content), the images in the format of "Original Image" loads almost automatically.

My link is below, let me know if it is something I am not doing right (and can't seem to see it at all)

http://cocemproject.org/pueblo/survey-register

Thanks!

-----------UPDATE---------------

If I stylize the main image as "Original Image", the image shows - but when it is stylized to my new Image Style "125x125" (which is 125px by 125px Scaled & Cropped), it breaks.

-----------UPDATE---------------

I tried a different Image Style that I know works elsewhere on the site, and it doesn't work here. Also, tried the format "Colorbox" just out of curiosity, and it makes the image field image disappear completely, not even a broken picture.

-----------UPDATE---------------

I also right-clicked the broken image and clicked "View Image", it leads me to http://cocemproject.org/pueblo/sites/default/files/styles/125x125/public/DSC_0131_1.jpg?itok=kGUeABuy but there is nothing there.

-----------UPDATE---------------

Now, I have gotten around to looking into my files and it appears that the Styles were never generated for these images.

-----------UPDATE---------------

Saw https://www.drupal.org/node/1109312#comment-10021707 and that clean URLs might be causing this, disabled the module, ran cron, cleared caches. Still no change.

-----------UPDATE---------------

Below are the folders with the permissions. I tried altering them and then flushing caches and running crons (just to hit everything).

-----------------UPDATE------------------------

Turns out that these photos are too large for this site, and Drupal's just giving up on applying the styles to them. What's odd is that this site is technically a complete copy of an old one, just better planned out to incorporate recent changes on the old version. However, I used the exact same styles with the exact same pictures and had no problems. I'm still on the same server, just a different folder. What might be causing this?


texts: Drupal 8 custom place block pop-up result

texts:
When go to Home > Administration  > Structure > Block layout page and click on Place block button, a pop-up appear with too many available blocks. Including some custom block types' content I wish to eliminate from this list.

So my question is it possible this pop-up list only display certain custom block type content, not all of them? Thank you.


texts: Will migrating content types be possible?

texts:
I have a Drupal 7 site with 40 content types. When Drupal 8 will be released than I would like to migrate these content types.

Would this be possible, or would I have to create this content types from scratch?


texts:
I created custom module to display Hello world text in custom page. I did not install drush and composer in my windows machine as I don't have admin access. I have pasted my files below:

example.module

<?php

function example_menu()
{
  // The paths given here need to match the ones in example.routing.yml exactly.
  $items['/mypage/page'] = array(
    'title' => 'First page',
    'description' => 'This is a example page.',
    // The name of the route from example.routing.yml
    'route' => 'example.my_page',
  );
  return $items;
}

example.routing

example.my_page:
  path: '/mypage/page'
  defaults:
    _controller: '\Drupal\example\Controller\ExampleController::mypage'
    _title: 'Hello world'
  requirements:
    _permission: 'access content'

src/Controller/ExampleController.php

<?php

namespace Drupal\example\Controller;

//use Drupal\Core\Controller\ControllerBase;

class ExampleController
{
    public function myPage()
    {
        $element = array('#markup' => 'Hello world!');
        return $element;
    }
}

And I have example.info file as well and the module is enabled. When I run the controller, it says page not found. Can anyone tell me that Am I missed anything in the code?


texts: Improve D8 performance to access a custom REST controller

texts:
Context

I'm currently upgrading a site from Drupal 7 to Drupal 8.

In the D7 version, there was a custom "proxy" module which served back-end services. Requests starting with a /service prefix, such as http://my-drupal-domain/service/service-name?service-args, were redirected to a custom index.php inside a D7 module. This alternative index.php called the minimal Drupal code needed : includes and drupal_bootstrap(). Then, the custom module's function handled the request, sometimes using Drupal native functions (to manipulate users for example) and passing it to the target service. Finally, it returned the service response to the client.

Now I want to migrate this to Drupal 8.

I managed to code a custom REST controller, using a custom route :

my_module.rest_services:
  path: '/service/{endpoint}'
  defaults:
    _controller: '\Drupal\my_module\Controller\ProxyController::index'
  methods: [GET, POST, PUT, DELETE]
  requirements:
    _access: 'TRUE'

The ProxyController, which extends Drupal\Core\Controller\ControllerBase, is basically the same code that handled the requests in the previous site, converted to the OOP-way of D8.

Initial problem

My problem is that, using D8 routes and Symfony2 components, the response time for any request increase proportionally with the number of concurrent users compared to the D7 version. For 20 users, this latency is +1s with D8 than with a D7 minimal bootstrap... That's huge! (see chart below, for the exact same call to D7 with a custom minimal bootstrap and D8).

Is there a way to bypass some of D8 code to redirect requests directly to my controller ? Some sort of "minimal D8 bootstrap".

Or a way to improve D8 routes performance ?

Edit: need to cache file parsing

I just discovered Drupal 8 is not the only responsible for my performance loss! during the request handle process, in my module's code, I read and parse a YAML configuration file, using file_get_contents() and Drupal\Component\Serialization\Yaml::decode(). But Drupal does not cache the value by default : the file is read and parsed on each call. With 20 concurrent users, it can take up to 600ms...

I need to find a way to tell D8 "Read this config file once, parse it and cache the content so you don't have to read it again unless your cache is cleared".


texts:
I have a field field.storage.node.field_create_ic created with type 'calendar_download_type' and it is one of the contributed module (ics_field). Now, in my local environment I deleted the field and likewise uninstalled the module. I exported the latest configuration. Now, when I push everything to server version and try to browse site or run drush commands like cr and cim, it fails with error message:  Uncaught PHP Exception RuntimeException: "Unable to determine class for field type 'calendar_download_type' found in the 'field.storage.node.field_create_ics' configuration" at..."
I can understand the error and it is obvious because the server database still has that field.
Can anyone help me to properly use configuration management with such kind of use case? I can use sql command to delete fields in server database and make it work but I just want to follow the standard way to resolve instead of running sql commands.


texts: How to add a field to an order that only the administrator can view/edit in the orders admin?

texts: I am looking for help in reference to commerce 2, not commerce 1.  The requirement is to add a field (select list) to the order admin area, not the customer order form.  The administrator should be able to input via a select list some additional tracking on an existing order.  However the requirement is to not use the STATE field/functionality.  The requirement is also that this field should not be visible or editable by non-admins.  I know how to add a field to the order through the order types > manage fields but that will create a field for the customer order form (and doesn't even seem editable by admin). Anyone know how to accomplish this?


texts: Prevent Quick Editing on certain DOM elements

texts:
I want to enable quick edit within a block which contains some JS libraries (such as slick). As slick changes the DOM, when I use quick edit it saves this altered DOM and then the slick library doesn't work.

Simplified example:

Saved HTML (pre-page load)

Tile 1

Tile 2

Rendered HTML (page loaded)

Tile 1

Tile 2

As the slick JS code adds the extra DOM content, when the user saves something via quick edit, the extra DOM content is saved to the page. Subsequently, when slick is rendered again by the JS, we get a slider that doesn't work.

Is there a way to prevent quick edit from applying changes to anything within
? Alternatively, is there a place where I can use slick's destroy method to the object before the block changes to edit mode?

Note:

Have tried using Bootstrap's carousel which doesn't alter the DOM but the functionality is too limited to match what slick can provide

Edit:

The JS object resides within a block. I still need to use quick edit to edit the block, but also to protect the JS object


texts:
I am using Drupal 6 and I have installed the Content Profile module.
First I made 3 extra fields, "gender," "seeking gender," and "dob." Now I want to create a multistep that users needs to fill in with other details.

I was wondering how I can do this using content profile module. I have read that this is a very good module in order to customizing user profiles.


texts: How do I remove webforms from content types?

texts:
Currently, our site is built so that anytime a specific type of new content is created, the page automatically includes a form required for the end user.  Due to tracking issues we're having with other software, we would like to remove these automatic forms from this specific resource type so that the resource is no longer gated.

Can anyone explain how I can make this change to my current content type so that we're not forced to create a whole new content type and replacing things systematically?


texts: Determine if an entity is a certain content type

texts:
I'm using drupal 8.

Lets assume the following. I have created a content type called Foo. Using the presave hook(hook_entity_presave), I'm modifying some fields in that content type.

Firstly I want to determine if the entity I'm modifying is a Foo content type.

I've tried using Drupal\Core\Entity\EntityInterface $entity->getEntityType() however the return is object(Drupal\Core\Entity\ContentEntityType). So basically an object.

Since my knowledge of drupal 8 is not that great(yet) I assumed initially that it would return something more quantifiable like a string or something of the sort. Obviously I was wrong.

Secondly I want to NOT modify some fields if the fields already have a value. Again, I assume a simple isset or empty will do the trick. I could be wrong. If there are some other ways to do that, more drupal-like way, I'd be more than happy to understand it better.


texts: How to hide clientside validation error message

texts:
Right now, I am using Clientside Validation. Everything works perfectly. But I would like to remove the error message which I set it showed at the top of the form. In the meantime, I would like to keep the error class which is added to my field input.

I have searched a lot about this but didn't get lucky. I know I might need to modify some code in sites/all/modules/clientside_validation/clientside_validation.js file, but I don't know which part I should touch.

Here is a sample screenshot:

Does anyone have any idea about this?


texts: Are there any downsides of using JS_THEME group by a contrib module?

texts:
I'm currently working on a contrib module with JS logic that in most cases should run last. To achieve that I'm using drupal_add_js with the following options:

['scope' => 'footer', 'group' => JS_THEME, 'weight' => 10,]

During the internal code review I was told that using JS_THEME group in a contrib module is not right, since modules should stay within their scope of JS_DEFAULT and leave JS_THEME for theme JS. Are there really any downsides of using JS_THEME in a contrib module?

From my perspective it is more flexible this way. If a theme developer wants to run custom JS before or after my JS code, they can easily do so with a theme JS or even with a custom module JS. However, if I'm using JS_DEFAULT in my module, the only way for a theme developer to run their JS code before mine, is to add it to JS_DEFAULT group as well which again is counterintuitive.


texts: How to create media image entities like an image field?

texts:
I have been using a content type Article with an Image field to allow users to upload images.  I have decided that I want to use media image entities instead because the images will be re-used on multiple nodes, so it would be better to use a module like Entity Browser to allow admins to pick the images they want to use.

Following this tutorial, I set up Media Entity, Media Entity Image, Embed, and Embed Entity on my site.  I can now add entities from the /media/add/image page.

But, with using this set of modules, the workflow has changed.

Image field on content type workflow

User uploads images in the field when creating a node.

Media entity image + content type/embed workflow

User uploads images.
User creates a node.
User embeds the images on the node.

So actually this new workflow has more steps than the old one.  Is there a way to "embed" creation of media entities as if it was just an image field attached to the content type?


texts: How do you programmatically get the shipping information from a placed order?

texts:
So far I have a working piece of code that sends me an email ($to variable) when a new order has been placed on my drupal 8 commerce.
This is not the email the person that places the order gets.

As part of the body of the email, i was able to find and use variables like a custom attribute, sku, quantity, product name etc...

I realize that in the orderCompleteHandler(), i might have to change what i send as a parameter, instead of $items having to possibly send $order.

But where can i find/how can i get the shipping information, like shipping address, shipping date and the user's that placed the order name : I would like to add them to the email i send.

More importantly is also: how do i find all this info and others by myself? i tried to kint($order) and it either freezes or runs out of memory. I tried dpm($order) and i get 10K lines of info but nothing that is obvious.
I tried to look in those 10k lines for some unique data that i knew was part of the shipping info but it wont show up, most likely because that value will be the return value of a get function.

Basically, how should i look and where should i look if i want various information from the order placed variable aka $order?

Any help in debugging and pointing me in the right direction would be appreciated.

public function orderCompleteHandler(WorkflowTransitionEvent $event) {

        // @var \Drupal\commerce_order\Entity\OrderInterface $order
        $order = $event->getEntity();
        $items = $order->getItems();

        $mail_manager = \Drupal::service('plugin.manager.mail');
        $to = 'myEmail@gmail.com';
        $langcode = \Drupal::currentUser()->getPreferredLangcode();
        $type = 'order_placed';

        $mail_manager->mail('my_custom_order', $type, $to, $langcode, $items, NULL, TRUE);

    }

/**
 * Implements hook_mail()
 * Prepares emails sent by the MailHandler service.
 * Emails are sent within the OrderComplete Event Subscriber.
 */
function my_custom_order_mail($key, &$message, $params) {
    switch($key) {
        case 'order_placed':
            $options = array(
                'langcode' => $message['langcode'],
            );
            // Creating an html formatted email.
            $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed; delsp=yes';
            $message['from'] = 'staff@myCompany';
            $message['subject'] = t('Order @order_number confirmed', array('@order_number' => $params[0]->getOrderId()), $options);

            $entire_email_display = '';
            foreach ($params as $product) {
                // Get the Custom Location.
                $productLocation = $product->getPurchasedEntity()->getAttributeValueIds()['attribute_custom_location'];
                $order_item['sku'] = $product->getPurchasedEntity()->getSku();
                $order_item['quantity'] = (int)$product->getQuantity();
                $order_item['product_name'] = $product->getPurchasedEntity()->getTitle();

                // HERE I BUILT an entire email body and stored in the $entire_email_display.
            }

            $message['body'][] = $entire_email_display;
    }
}


texts: Views: Show only "Grouping Field" headings

texts:
I'm working on customizing a view that is displaying a content type. I need to build an attachment that shows available taxonomy terms on this content type.

In this attachment, I currently have the taxonomy term name displaying as a field for each returned instance of the content type.

Grouping the results by the taxonomy name field produces one instance of each term as an <h3> followed by one instance for each node that was returned:

TAXONOMY TERM 1 (Grouping Title, H3)
    taxonomy term 1 (term on node)
    taxonomy term 1 (term on node)
    taxonomy term 1 (term on node)
TAXONOMY TERM 2 (Grouping Title, H3)
    taxonomy term 2 (term on node)
    taxonomy term 2 (term on node)
    taxonomy term 2 (term on node)

Is there a way to just show the grouping without outputting the additional content? Something like:

TAXONOMY TERM 1 (Grouping Title, H3)
TAXONOMY TERM 2 (Grouping Title, H3)

This would produce exactly what I need but I can't figure out a good way to do this.

I've tried aggregation but this makes exposed filter inheritance for the attachment messy and unreliable.

Thank you!


texts: Drupal 8 function from controller returns html markups only

texts:
I have been creating a table from mysql result , but its printing the html markup only and says controller must return a response . what may be the reason ?

  LogicException: The controller must return a response ((5
  rows)group_nameparent_nameEditDeleteSelect
  itemsL2V9http://192.168.1.236/mailusers/usergroup/edit/6>edithttp://192.168.1.236/mailusers/usergroup/delete/6>delete

    L3v3http://192.168.1.236/mailusers/usergroup/edit/7>edithttp://192.168.1.236/mailusers/usergroup/delete/7>deleteAdminsV6http://192.168.1.236/mailusers/usergroup/edit/8>edithttp://192.168.1.236/mailusers/usergroup/delete/8>deleteL4Vodafonehttp://192.168.1.236/mailusers/usergroup/edit/9>edithttp://192.168.1.236/mailusers/usergroup/delete/9>deleteVCNONetworkhttp://192.168.1.236/mailusers/usergroup/edit/12>edithttp://192.168.1.236/mailusers/usergroup/delete/12>delete given). in
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (line 157 of
    vendor/symfony/http-kernel/HttpKernel.php).


texts:
I search the method to implement apache solr search with og group and search on the content associated with group.

I want that the user can search the content of a specific group or for all group.

Thank


texts: How to resolve message ' Requires: Commerce_checkout (missing)'?

texts:
I have installed the Commerce Checkout Pages module (as the tar.gz file), as shown in this image:

Note the message shown within its description, i.e:

Requires: Commerce_checkout (missing)

Now I want to enable it, but I don't know how I resolve the missing part of the module.

Any help?


texts: Does Drupal automatically unlink() orphaned files?

texts:
Does Drupal 7 have a way to automatically remove images that are no longer linked to an entity, or do they need to be unlinked manually?

For example, how would Drupal react to the following detachment of a file from a node:

$nid = 7;                      //A node containing an image field.
$node = node_load($nid);       //$node->field_image is a populated Imagefield.
$node->field_image = array();  //$node->field_image is set to an empty array.
node_save($node);              //$node is saved.

Will the orphaned fid sit in the files directory indefinitely or will Drupal remove it automatically?


texts: How to place a block in two different regions?

texts:
Working on a project I faced with a problem , in this project the front page looks completely different than the other pages and it consists some regions which are not exist in other pages.

Now the problem is that when I put an instance of a block in a region which only exist in front page then I cant use this block in other pages.Any idea how to solve this problem?


texts: How to add a subquery to a views query without using code

texts:
I need help in writing my MAX() in filter of my files. I have searched everywhere and found that have to write a sub query. Here is my query and I need to put a sub query:

SELECT webform_views_news_webform_798.clipping_type AS webform_views_news_webform_798_clipping_type, webform_views_news_webform_798.news_heading AS webform_views_news_webform_798_news_heading, webform_views_news_webform_798.news_detail AS webform_views_news_webform_798_news_detail, webform_views_news_webform_798.newspaper AS webform_views_news_webform_798_newspaper, webform_views_news_webform_798.news_url AS webform_views_news_webform_798_news_url, webform_submissions.sid AS sid, webform_views_news_webform_798.news_date AS webform_views_news_webform_798_news_date_1, MAX(webform_views_news_webform_798.news_date) AS webform_views_news_webform_798_news_date
FROM
{webform_submissions} webform_submissions
LEFT JOIN {webform_views_news_webform_798} webform_views_news_webform_798 ON webform_submissions.sid = webform_views_news_webform_798.sid
WHERE **(( (webform_views_news_webform_798.news_date LIKE '2013-08-23' ESCAPE '\\') ))**
GROUP BY webform_views_news_webform_798_clipping_type, webform_views_news_webform_798_news_heading, webform_views_news_webform_798_news_detail, webform_views_news_webform_798_newspaper, webform_views_news_webform_798_news_url, sid, webform_views_news_webform_798_news_date_1
ORDER BY webform_views_news_webform_798_news_date_1 DESC

The where clause should be like this:

SELECT webform_views_news_webform_798.clipping_type AS webform_views_news_webform_798_clipping_type, webform_views_news_webform_798.news_heading AS webform_views_news_webform_798_news_heading, webform_views_news_webform_798.news_detail AS webform_views_news_webform_798_news_detail, webform_views_news_webform_798.newspaper AS webform_views_news_webform_798_newspaper, webform_views_news_webform_798.news_url AS webform_views_news_webform_798_news_url, webform_submissions.sid AS sid, webform_views_news_webform_798.news_date AS webform_views_news_webform_798_news_date_1, MAX(webform_views_news_webform_798.news_date) AS webform_views_news_webform_798_news_date
FROM
{webform_submissions} webform_submissions
LEFT JOIN {webform_views_news_webform_798} webform_views_news_webform_798 ON webform_submissions.sid = webform_views_news_webform_798.sid
**WHERE (( (webform_views_news_webform_798.news_date IN (SELECT MAX(news_date) from webform_views_news_webform_798 )) ))**
GROUP BY webform_views_news_webform_798_clipping_type, webform_views_news_webform_798_news_heading, webform_views_news_webform_798_news_detail, webform_views_news_webform_798_newspaper, webform_views_news_webform_798_news_url, sid, webform_views_news_webform_798_news_date_1
ORDER BY webform_views_news_webform_798_news_date_1 DESC

How can I change this easily without using code?


texts: SocialMedia module is not replacing [socialmedia:sm-twitter_username] when sharing to Twitter

texts:
When I use the SocialMedia Twitter button, it opens a new window which displays:

As you can see, the [socialmedia:sm-twitter_username] token is not being replaced.

In the user's profile, there is a tab (which I believe was added by this module) called "Social Profiles" He has entered his Twitter username :

Can anyone tell me why this token isn't being picked up ?


texts: How to replace the button when the user is not authenticated?

texts:
I copied the twig file of my nodes into my theme.

On my nodes there is a flag displayed, but only authenticated users can see it.

Here is my code :

  {{ content.flag_like_group }}

How to replace the flag for unauthenticated users by :

   J'aime


texts: Set default image when file not found (404)

texts: I have many images but when one of them is missing it displays an empty <img>. Is there a method or hook that can be used to display a default image instead this empty <img> tag?


texts: Watchdog messages and string replacement

texts:
Hello I would like to know which of the following ways (or some other) of logging messages is better and why.
I am writing lots of .install files since I create content types and fields programmatically and I often write statements as following:

$t = get_t();
watchdog('mymodule',$t('Field !field_name created.', array('!field_name' => $file_field_name)));

OR

$t = get_t();
watchdog('mymodule',$t('Field !field_name created.'), array('!field_name' => $file_field_name));

Note: in the first example I am doing string replacement in the $t function in the second in the watchdog() function.


texts:
I have the following setup: On my site users can publish ads to sell things. Each ad has at least two taxonomy terms assigned:

Region
Category

Sometimes users navigate via region to a specific ad, sometimes the users navigates via Categoryto a specific ad. Finally the user clicks on the ad and the ad is shown.
Now I want to display a breadcrumb, and this should depend on the way the user navigated down.

Example 1:
If the user has chosen to see a list of regions and then presses "California" he sees all ads. Then he clicks on the ad 988. The breadcrumb now should be:

home>California

Example 2:
If the user has chosen to see a list of categories and then presses "cars" he sees all ads in this category. Then he clicks on the ad 988. The breadcrumb now should be:

home>Cars

Is there a way to complete this?
Or is there a way to create a breadcrumb for the two cases above like that:
home>California>Cars?

thanks for any help and information


texts: How to specify a Rules condition like 'Before creating new content'?

texts:
I need to show an "Add content" link to users but I need to consider user field values to give access to the node form. For example, is the boolean field "Subscription fee paid" is True.

I thought the Rules module could help me. But I can not find any event "Before creating new content", only "Before saving content". Indeed, I do not want users to fill the form before conditions are verified. Because after 5 or 10 minutes of completing a form, it would not be user-friendly to get a warning message like "*you are not allowed to do that!" ...

So I tried Rules link to create a sort of button, with conditions and reactions. For example, in a block, I show the Rules link. When accessed, if conditions are true, I redirect the user to the form. Unfortunately, Drupal uses the Rules link path by default (for example, submit-the-form) and not the redirection page url included in my rule (for example: node/add/article) and finally the page is not found, since nothing is behind the default path.

Well, I guess I am close but still stuck. Any suggestions?

EDIT :
I have tried to create a rule, as suggested by @Pierre.Vriens. Here is the short code.

{ "rules_subscription_check" : {
    "LABEL" : "Subscription check",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "path" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "path_has_alias" : { "source" : "[site:url]\/node\/add\/manuscript-submission" } },
      { "data_is" : { "data" : [ "site:current-user:field-subscribed" ], "value" : "0" } }
    ],
    "DO" : [
      { "drupal_message" : {
          "message" : "Sorry, subscription is needed to add that type of content.",
          "type" : "warning",
          "repeat" : "0"
        }
      },
      { "redirect" : { "url" : "no_access" } }
    ]
  }
}

Unfortunately, an unsubscribed but authentified user can still add content when he clicks on the form link.


texts: Is there a way to add a Mapbox style to Drupal Leaflet?

texts: I have recently upgraded to the latest version of Drupal, and the module 'Leaflet Mapbox' (https://www.drupal.org/project/leaflet_mapbox) is no longer supported.  I was wondering how I would go about adding a Mapbox style to the Drupal Leaflet map?  I have tried following the Mapbox documentation, however, the leaflet map is already a container on drupal so this does not work.


texts:
I am updating my site from Drupal 8.2.1 to 8.2.4, while running update.php I encounter this problem

  The installed schema version does not meet the minimum.
  Your system schema version is -1. Updating directly from a schema version prior to 8000 is not supported. You must migrate your site to Drupal 8 first.

I am unable to proceed any further. What exactly is causing this problem?


texts:
We are running Drupal 7 on NGINX. The config has worked fine except that path aliases are ignored. When we navigate there, we get a "file not found" page instead of a redirection to the node.

Clean URLs work fine -- the site navigation using clean URLs works perfectly. It's just the aliases that are not working. We used this config example as the basis for the setup: https://www.nginx.com/resources/wiki/start/topics/recipes/drupal/

Any ideas on what we're missing?


texts: override 'Edit own content' using taxonomy access

texts:
Can I override 'Edit own content' for a particular role and a particular node using taxonomy access? Or better, can I simply switch off Drupal's built-in access content module and solely rely on the settings of TAC (taxonomy access content module)?

What I'm trying to accomplish here is:

a user creates content, the user works on their own content until they think it's ready for moderation upon which they'll set a taxonomy term to 'finished content'. A moderator now comes into play and checks the content of the user. If they decide to approve the content they set a vocabulary term to 'approved content'. This triggers a rule which sets the locking vocabulary of that node to the term 'Locked'. At this point the author should not be able anymore to edit this content.

The problem is that node access permissions still allows the author to edit their own content. How would you tackle such a problem?
Cheers!


texts: url alias not working when logged in as admin

texts:
When I'm logged in as admin, the urls are un-aliased ("node/24"). When logged out they appear aliased ("about/us"). It might have something to do with the module admin_menu as suggested in a post over at drupal.org – but applying the recommended patch didn't work for me.

https://www.drupal.org/node/1742844

Hope somebody knows a way out? Thank you! t

update: thank you for suggesting to investigate first, if it REALLY is the admin menu – and of course it's not. I switched it off, but same situation. So I guess I'll better do some further 'research' by switching off and on various recently installed modules first…

-closing-


texts: How can I display a form button on top of the form?

texts:
In my custom module, I have added a button to the node edit form, using the following code.

  $form['actions']['my_submit'] = array(
    '#type' => 'submit',
    '#value' => t('My custom action'),
    '#weight' => -1000,
    '#submit' => array('node_form_submit', 'my_custom_node_form_submit')
  );

It is currently displayed either to the left or to the right of the standard "Save" button, depending on the weight value. Is there a way to display it on top of the form, before the first field?


texts:
I know this is simple but can't find the answer. I'm just wanting to put the contents of  user-profile.tpl.php in a block. No extra formatting or anything. Just pull the information and put it in a block. It can either be in my custom module or by creating a block. Thanks for your help!

After trying the initial suggestion, I received this error message:

Fatal error: Unsupported operand types user.module

My user-profile.tpl.php doesn't contain the usual information and I should have mentioned that originally. There's a lot to it but I think the problem is here:

$account = menu_get_object('user');

Since it calls that immediately at the top, it may create a problem. Beyond that, the rest of the user-profile.tpl.php file uses the account variable highlighted above to get a bunch more information.

I'm using the latest version of Drupal which is 7.7 at this time.


texts:
I want to use the Views module to display the top item from a listing.

I've utilized the "Use Pager" to display that one item. But sometimes I want to display the second item, or third item, or X item. I've found the offset option to skip the first item, but the result I get doesn't seem to match. What I get instead is some random item, and not, say, the second item.

Any suggestions?


texts: How to check user by user name is exist in ldap server?

texts:
I am using LDAP as my source for users. This works fine, and everyone can simply log in using their LDAP info, and it will create a Drupal user for that person.
However, one of our requirements is during user registration how to check this user already in ldap server or not , means is there any API by which i can check this user already in ldap server on user registration.


texts:
I have a table View. I want to add a button to each row that is a webform with hidden fields containing data from the row. Clicking on the button executes the webform and returns the user to the row.

e.g. Let's say the rows a types of fruit. I want a button on each row which is "I want this" - clicking on the button will be like submitting a webform, so I can use the webform functionality such as generating emails and having a chronological list of submissions.

If this is not possible with webforms, is there another way to do it?


texts: How to get rid of a style attribute so my nivo slider will show up?

texts:
I am using the Nivo Slider and for some reason it has a style attribute in its div tag that says

style="width: 0px";

I am trying to get rid of this so my slider will appear. I am not sure where this is coming from. I have CSS injector installed, but none of it makes a width: 0px and a grep search throughout the directories doesn't come up with one that will effect the outcome.

Thanks for your help.


texts:
I'm building a website in French as default and only front language but I have to figure out how to do this:

I have administrator and manager roles, both are ok using the french language for both front UI and Admin panels but I also have a role "normal-users" for wich I want to set the default front UI and Admin panels to english by default at registration. How can I do this ?


texts: Without contrib, I want to make everything a user does appear to be by someone else. Any comprehensive hook for that?

texts:
So, I want to give users an entity reference field of users they may act as.

I'm just not sure of what the best way to do that would be.. Is it lots of hook_presaves?

Edit to show general operations

Node creation / edit
The flagging User
Reply posts
All rule conditions / actions ie. "Current User"

I'm beginning to realise this will take a lot of code, which I'm willing to do. I'm just wondering if there's an easy sort of Drupal solution.


texts: How do I get inline tags to wrap nicely?

texts:
Inline tags are presented as a series of
s, with no whitespace in the HTML between them. These elements are styled display:inline, the result of which is an unbreakable string. When you have enough tags this breaks layout. What you want is tags to word-wrap around, but they don't.

The only way I can see to achieve this is by hacking core to insert a space after the field-item items'
s (or after the content before the closing
.

Is there another way? Perhaps a way for a theme to override the formatter function?


texts: pathauto_clean_string and accents from a bootstrap PHP file

texts:
I have a single PHP file which makes a bootstrap of Drupal 7. The code is below. When I try to use pathauto_clean_string in a spanish string with accents (á é ... , etc.) it deletes the character instead of removing the accent using transliteration module (also affects other special chars, obviously). I have included also this module in the bootstrap but cannot have the PHP script to behave exactly as the Drupal site, which is doing properly the transliteration in file names and also from my own custom module.

define('DRUPAL_ROOT','/home/example.com/public_html');
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/sites/all/modules/transliteration/transliteration.inc';
 require_once DRUPAL_ROOT . '/sites/all/modules/pathauto/pathauto.inc';

drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

if(isset($_GET['string'])) echo pathauto_cleanstring(urldecode($_GET['string']));

Result with www.example.com?string=está-cañón : est-can

Result with the same string and module, same function and correct, expected, result: esta-canon


texts: How to list taxonomy terms with custom sort (glossary view)?

texts:
I'm trying to create a taxonomy terms list with glossary view. Normally, everything is working (page view, attachment, contextual filter (glossary view) etc).

My taxonomy terms are full names, such as: Ali Veli, Mehmet Zeki

In glossary view it seperates the letter with the first letter and it seems like that:

A | B | C | ... | M | ... | Z

A

Ali Veli

...

M

Mehmet Zeki

I want to sort all the terms by surnames (last word of term) instead of names (first word of term).

A | B | C | ... | M | ... | Z

V

Veli, Ali

...

Z

Zeki, Mehmet

If I don't use the contextual filter and glossary view I could use Views PHP and do what I want as this:

1. I added the Taxonomy Term: Name field.

2. I added a Global: PHP field.

This is the value code:

$exploded = explode (" ", $row->name);
$exploded_last = array_pop($exploded);
$eachone = $exploded_last .', ' .implode(' ', $exploded);
return $eachone;

This is the output code:

<?php print $value; ?>

3. I added a new Global: PHP sorting field to Sorting Criteria.

This is the sort code:

if ($row1->php < $row2->php) return -1; else return 1;

This method is working good (without contextual filter & glossary view) and gives the results as this:

Veli, Ali

Zeki, Mehmet

How can I use such a method for glossary view?


texts: How to remove field from form and configuration?

texts:
We have a custom module, mymodule that has a form, mymoduleForm with two fields: enabled content types and urls.

We no longer need the enabled content types field on the form and want to remove it from the form and configuration. We do not have either config/install/mymodule.settings.yml and config/schema/mymodule.schema.yml files.

How can we remove the field (enabled content types) from both the form and configuration?

mymoduleForm.php (all lines below we are thinking need to be removed related to enabled_content_types)

public function buildForm(array $form, FormStateInterface $form_state) {
  $mymodule_config = $this->config('mymodule.settings');

  $types = \Drupal::entityTypeManager()
    ->getStorage('node_type')
    ->loadMultiple();

  foreach($types as $type) {
    $content_types[$type->id()] = $type->label();
  }

  $form['enabled_content_types'] = [
    '#type' => 'checkboxes',
    '#title' => $this->t('Enabled Content Types'),
    '#description' => $this->t('content types .'),
    '#default_value' => $config->get('enabled_content_types'),
    '#options' => $content_types,
  ];

  ...

  return parent::buildForm($form, $form_state);
}

public function submitForm(array &$form, FormStateInterface $form_state) {
  $mymodule_config = $this->config('mymodule.settings');
  $mymodule_config
    ->set('enabled_content_types', $form_state->getValue('enabled_content_types'))
    ->set('urls', $form_state->getValue('urls'))
    ->save();

  parent::submitForm($form, $form_state);
}


texts:
Accrding to drupal docs:

The following is an example file listing of a safe configuration showing two files in a site where uploaded files are stored in the "files" directory. In order to see the file permissions set for your setup, go to the command line and type: ls -al.

drwxrwx---  7 www-data    greg-group  4096 2008-01-18 11:02 files/
drwxr-x--- 32 greg-user   www-data    4096 2008-01-18 11:48 modules/
-rw-r-----  1 greg-user   www-data     873 2007-11-13 15:35 index.php

After running the shell given in the doc page,

#!/bin/bash
if [ $(id -u) != 0 ]; then
        printf "This script must be run as root.\n"
        exit 1
fi
drupal_path=${1%/}
drupal_user=${2}
httpd_group="${3:-www-data}"
# Help menu
print_help() {
cat <<-HELP
This script is used to fix permissions of a Drupal installation
you need to provide the following arguments:
1) Path to your Drupal installation.
2) Username of the user that you want to give files/directories ownership.
3) HTTPD group name (defaults to www-data for Apache).
Usage: (sudo) bash ${0##*/} --drupal_path=PATH --drupal_user=USER --httpd_group=GROUP
Example: (sudo) bash ${0##*/} --drupal_path=/usr/local/apache2/htdocs --drupal_user=john --httpd_group=www-data
HELP
exit 0
}
# Parse Command Line Arguments
while [ $# -gt 0 ]; do
        case "$1" in
                --drupal_path=*)
            drupal_path="${1#*=}"
            ;;
        --drupal_user=*)
            drupal_user="${1#*=}"
            ;;
        --httpd_group=*)
            httpd_group="${1#*=}"
            ;;
        --help) print_help;;
        *)
            printf "Invalid argument, run --help for valid arguments.\n";
            exit 1
    esac
    shift
done
if [ -z "${drupal_path}" ] || [ ! -d "${drupal_path}/sites" ] || [ ! -f "${drupal_path}/core/modules/system/system.module" ] && [ ! -f "${drupal_path}/modules/system/system.module" ]; then
    printf "Please provide a valid Drupal path.\n"
    print_help
    exit 1
fi
if [ -z "${drupal_user}" ] || [ $(id -un ${drupal_user} 2> /dev/null) != "${drupal_user}" ]; then
    printf "Please provide a valid user.\n"
    print_help
    exit 1
fi
cd $drupal_path
printf "Changing ownership of all contents of "${drupal_path}":\n user => "${drupal_user}" \t group => "${httpd_group}"\n"
chown -R ${drupal_user}:${httpd_group} .
printf "Changing permissions of all directories inside "${drupal_path}" to "rwxr-x---"...\n"
find . -type d -exec chmod u=rwx,g=rx,o= '{}' \;
printf "Changing permissions of all files inside "${drupal_path}" to "rw-r-----"...\n"
find . -type f -exec chmod u=rw,g=r,o= '{}' \;
printf "Changing permissions of "files" directories in "${drupal_path}/sites" to "rwxrwx---"...\n"
cd sites
find . -type d -name files -exec chmod ug=rwx,o= '{}' \;
printf "Changing permissions of all files inside all "files" directories in "${drupal_path}/sites" to "rw-rw----"...\n"
printf "Changing permissions of all directories inside all "files" directories in "${drupal_path}/sites" to "rwxrwx---"...\n"
for x in ./*/files; do
    find ${x} -type d -exec chmod ug=rwx,o= '{}' \;
    find ${x} -type f -exec chmod ug=rw,o= '{}' \;
done
echo "Done settings proper permissions on files and directories"

bash fix-permissions.sh --drupal_path=your/drupal/path --drupal_user=greg

After running the above script, the Security review module still warns me that:

Some files and directories in your install are writable by the server.

Ironically the doc page also links to the security review module for double check:

  As a quick test to confirm whether your site is secure or not you can
  run the Security Review module.

Does this mean that there is something wrong in the script? or in the security review module alert if false? Or simply there is no consensus in Drupal community about the files permission? Too bad, if it is so.

This can be a huge security hole when the permission to the uploaded files are not set properly. So I am wondering what is the proper permissions for files for a fairly paranoid setup?

Also, should greg be member of www-data group?


texts: How can I list all the terms of a given vocabulary using Views?

texts:
I just need to list all the terms of the "Colors" vocabulary using the Drupal 7 version of Views. I thought it was simple to do it, but I can't find a way to get it.

I can't use contextual filters.


texts: Why does the email body show token instead of invite link?

texts:
I have installed and enabled the invite module. For mailsystem I have used MIME mail system.

When I send an invitation to email it shows site name and site URL but it did not show inviter name and invite accept link. Instead it shows replace tokens [invite:inviter:name] and [invite:invite-accept-link].

While on front end of site, it works fine. But in email body it is not working. See image for more clarity.

Any suggestions?


texts: Path Auto Use Parent Tag, If it doesnt exist use current tag

texts:
OK. I have Pathauto and Token

I have the following Tag Structure:

Drinks > Beer

I want to use path auto to make all nodes tagged with Drinks or Beer to have a URL of /Drinks/[Node:title]

So essentially I can use [node:field-tags:0:parent]/[Node:title] to get it to work correctly for all nodes tagged as Beer.

However if the node is tagged as Drinks then the parent does not exist and it will just return the node title. So in that case I would want to use [node:field-tags:0:name]/[Node:title]

So what I am looking for is something like this (if it exists):

[node:field-tags:0:parent ELSE node:field-tags:0:name]/[Node:title]

I have looked into custom tokens and can't figure it out. I was hoping there was a simple way to do this.


texts: Remove button field of a field generated by AJAX

texts:
This is my custom Drupal module. I have a form containing text fields, each with a button to remove the field from the form. The problem is that the remove button always removes the last field, regardless of which I press,

I am aware of increasing the variable $form['incremento']['telefono'] but I can't find a solution.

/**
 *_permission
 */
function formOnigPreventivoTendaggi_permission() {
    return array(
        'permessi form_onig_preventivo_tendaggi' => array(
            'title' => t('Permetti la creazione del preventivo Tendaggi')
        )
    );
}
/**
 *_menù
 */
function formOnigPreventivoTendaggi_menu() {
    $items = array();
    $items['form/preventivo/tendaggi'] = array(
        'title' => 'Preventivo Onig Tendaggi',
        'access arguments' => array(
            'permessi form_onig_preventivo_tendaggi'
        ),
        'page callback' => 'drupal_get_form',
        'type' => MENU_NORMAL_ITEM,
        'page arguments' => array(
            'formOnigPreventivoTendaggi_form'
        )
    );
    return $items;
}
/**
 *_form
 */
function formOnigPreventivoTendaggi_form($form, &$form_state) {
    $incr = 0;
    if (!isset($form_state['incremento']['telefono'])) {
        $form_state['incremento']['telefono'] = 0;
    }
    $form['telefono'] = array(
        '#type' => 'fieldset',
        '#tree' => TRUE,
        '#prefix' => '
',
        '#suffix' => '
'
    );
    if ($form_state['incremento']['telefono']) {
        for ($i = 0; $i < $form_state['incremento']['telefono']; $i++) {
            $form['telefono'][$i]['campoTelefono']   = array(
                '#title' => t('Telefono'),
                '#type' => 'textfield',
                '#id' => 'campo-telefono' . $i
            );
            $form['telefono'][$i]['eliminaTelefono'] = array(
                '#type' => 'submit',
                '#value' => t('Elimina'),
                '#submit' => array(
                    'funzioneEliminaTelefono'
                ),
                '#id' => 'bottone-elimina-telefono' . $i,
                '#ajax' => array(
                    'callback' => 'chiamataAjax_telefono',
                    'wrapper' => 'telefono'
                )
            );
        }
    }
    $form['aggiungiTelefono'] = array(
        '#type' => 'submit',
        '#value' => t('Aggiungi'),
        '#submit' => array(
            'funzioneAggiungiTelefono'
        ),
        '#ajax' => array(
            'callback' => 'chiamataAjax_telefono',
            'wrapper' => 'telefono'
        ),
    );
    $form['Crea Preventivo']  = array(
        '#value' => t('Submit'),
        '#type' => 'submit'
    );
    return $form;
}
/**
 *AJAX
 */
function chiamataAjax_telefono($form, $form_state) {
    return $form['telefono'];
}
function funzioneAggiungiTelefono($form, &$form_state) {
    $form_state['incremento']['telefono']++;
    $form_state['rebuild'] = TRUE;
}
function funzioneEliminaTelefono($form, &$form_state, &$form_id) {
    if ($form_state['incremento']['telefono'] > 1) {
        $form_state['incremento']['telefono']--;
    }
    $form_state['rebuild'] = TRUE;
}
function formOnigPreventivoTendaggi_form_submit() {

}


texts: How to allow a user with some role to let people to register their new accounts in drupal 7?

texts:
Is it possible to let a user with some role (not an admin) that will decide if somebody can register in drupal?

I know there is an option in admin menu

  Configuration->Account settings Option: Registration and cancellation Who can
  register accounts?

Is there any other option to do it like a module that user has a permission to switch on or off registration new users?


texts: How to get notifications for unpublished content?

texts:
I want to achieve that user can view the unpublished content once they have logged in .

Unpublished content should be displayed as a notification like Topic(1).

How to achieve this ? Is there solution to achieve this?


texts: Embed one entity form into another and save both

texts:
I have a custom entity, that is depending on the user entity. In fact, it is even so depending that I felt it made sense to display my entity form within the user profile form:

The problem I am now having is the following; there are 2 save buttons. And if it is not bad enough, the save button for the user (the lower one) does not even function anymore and white label save button only saves the white label entity.

The form is altered into the user form like this:

function whitelabel_form_user_form_alter(&$form, FormStateInterface $form_state) {

  $whitelabel = WhiteLabel::load(1);

  $whitelabel_form = \Drupal::service('entity.manager')
    ->getFormObject('whitelabel', 'default')
    ->setEntity($whitelabel);

  $form['whitelabel'] = array(
    '#type' => 'details',
    '#title' => t('White label settings'),
    '#open' => TRUE,
    'form' => \Drupal::formBuilder()->getForm($whitelabel_form),
  );
}

I was hoping to shuffle some parameters in the $whitelabel_form array (that used to work in Drupal 7), but that array is enormous and I could not find the submit buttons and handler that I needed.

So the question is, can this be done? And what would be the recommended way of doing it?


texts: How to hide comment section present in render array?

texts:
I have generated an array in Drupal 8 which is created by using viewbuilder in this manner:

 $content = $this->entityManager()->getViewBuilder($entity->getEntityTypeId())>view($entity, 'hardcopy');

And now I want to hide comment section present in this array.

Any idea on how to do this?


texts: What other files belong in the root site folder?

texts:
My employer maintains a server for several Drupal sites. They inherited these sites without having much expertise in Drupal. I'm more front end than back end so my knowledge of hosting is limited. My question relates to the folders that reside in the root folder alongside the Drupal site folders. I could tell that some folders didn't belong, such as 'backups' and 'libraries'. I moved those folders and there was no problem. (By the way I verified that some of these files could be called up in a browser.) There were two remaining folders I am not sure about. The 'logs' folder has server logs but the individual files cannot be called up in an anonymous browser. Does anybody know the rule as to where server log files belong and how to secure them? I do not see an htaccess file in this folder, BTW. The other questionable folder is a folder labelled 'internal', and it has database stuff in it, such as an 'aspnet_client' folder.  I'm afraid to just move this file even though the content is several years old with no recent changes.  That tells me it's not important, but I'm wondering if any server people can tell me this folder doesn't look right, it was probably stored there by mistake at one point as a backup.

Thanks in advance for your help.


texts: Trying to convert db_fetch_object for Drupal 7

texts:
I am trying to convert a line of code from Drupal 6 for Drupal 7

for ($i = 0; $order = db_fetch_object($result); ++$i) {

Above is what it is -- and below is what I made it

for ($i = 0; foreach ($result as $order); ++$i) {

BUT . . . I get a parse error:

  Parse error: syntax error, unexpected 'foreach' (T_FOREACH), expecting
  ';' in / [PATH TO FILE] on line 483

Which is this

for ($i = 0; foreach ($result as $order); ++$i) {

SQL syntax checkers find no error in the syntax - I only a novice


texts: How to make calendar block show site events?

texts: I have a website in which I use the Calendar module in combination with a content type I created. While I manage to achieve the calendar page to show up the events in their dates, how can I make the same for the calendar block? For example when an event has a "from date" of 20 August, I want the calendar block to have that 20 August date as a link to the event.


texts: Get config variable value in hook_block_list_alter

texts:
works I have added a new field to block configuration settings by using the function  hook_form_FORM_ID_alter. I used submit handler to save the variable $form['#submit'][] = mymodule_submit (as block_save function was not called). Its all done till here
Now I am trying to alter the block list based on the condition set in the config field enable_conectivity
function mymodule_block_list_alter(&$blocks) {

    foreach ($blocks as $key => $block) {
       $enable_conectivity =??//How to get the varibale value
        if($enable_conectivity) {
            $blocks[$key]->visibility = BLOCK_CUSTOM_DISABLED;
        }
    }
}

I tried to call function hook_block_view it is not called instead hook_block_view_alter works.

Issue:Saving is affecting all the blocks
function mymodule_submit($form, &$form_state) {
     variable_set('url_to_check', $form_state['values']['url_to_check']);
     variable_set('enable_check', $form_state['values']['enable_check']);
}

hook_form_FORM_ID_alter()
$form['visibility']['mycustom'] = array(
  '#type' => 'fieldset',
  '#title' => t('ConnectCheck'),
  '#collapsible' => TRUE,
  '#collapsed' => TRUE,
  '#group' => 'visibility',
 '#weight' => 20,
);
$form['visibility']['mycustom']['enable_check'] = array(
  '#type' => 'checkbox',
  '#title' => t('Show block only when user can connect to internet'),
  '#default_value' => variable_get('enable_check', FALSE),
);
$form['visibility']['mycustom']['url_to_check'] = array(
   '#type' => 'textfield',
   '#title' => t('Url to check'),
   '#maxlength' => 90,
   '#default_value' => variable_get('url_to_check', 'www.google.com'),
   '#states' => array(
     'visible' => array(
        'input[name="enable_check"]' => array('checked' => TRUE),
    ),
  ),
);

I am trying to disable the block which requires to connect internet.
It should disable to only those user who do not have internet access.


texts: How do I get a user field from an entity reference?

texts:
I'm working with the Twilio module to create a Rule that will send out an SMS message when a user creates a specific piece of content.  Here's how I've got things laid out at the moment.

I have a content type called Office (field_office), which contains the regional office name (imported from LDAP, but that probably doesn't matter.)
I have an entity reference user profile field called field_user_office that links to the Office content type.
I created a content type called Blast Message with an entity reference field called field_office_sms which also links to the Office content type.  When a user wants to create an SMS they create one of these nodes and select one or more offices to send to.

When I set up my rule I'm not seeing the fields exposed as I expected.  I tried adding two Entity has field conditions, Parameter: Entity: [node], Field: field_office_sms and Parameter: Entity: [node], Field: field_mobile_phone, the last of which is the actual mobile number saved in the users' accounts.

How do I navigate from the original content (Blast Message) through the Offices, then to the specific Users who are linked to that office, and ultimately retrieve their mobile phone numbers?


texts:
I am new in Drupal

I have an article website, and it has some category like History, Sport, Graphic, Music and etc.

But when I add some content-type for each of these and when I visit that post, I can't find the URL path of them. for example when I post a new Sport article that it's title is "Ronaldo's regimen" and when I click on save button on drupal, drupal show me an article that its URL is this :

  www.example.com/content/ronaldos-regimen

I need to add a link to my menu for each catagory, something like this:

  Sport | History | Graphic | Music

(I use pathauto module)


texts:
I've created View to display my content and I'm using Quicktabs module https://drupal.org/project/quicktabs to format the output of this view into the tabs.

Is there a way to load content of each tab in the view using AJAX? I can't see any option.


texts: How do I insert a   tag inside the   tag on my main menu

texts:
I have asked exactly this question on Stack Overflow, but it makes more sense to ask it here.

I'm trying to make the text between my tag not display by wrapping it in a and then styling that.

I've added the following function to my template.php file, but I cannot see any difference on the front end; the span just does not appear. (I have cleared my cache.)

Am I using the right function? What am I doing wrong?

function my_theme_link($variables) {
  return '' . ($variables['options']['html'] ? $variables['text'] : check_plain($variables['text'])) . '';
}


texts: How to set configuration value for drush site install?

texts:
I have set a central translations directory(sites/all/translations) for my multisite installation profile so that each site does not have to download translations that were already downloaded.

I have set this via global settings file that I am including in the site's settings file, but it did not helped. Then I have added locale.settings.yml config into the profile, still no change. This works always AFTER the site was installed.

In the site installer there is a condition that checks if the config value for the directory exists in the global config variable, it will use that value or if not it will use the site's own translations directory by default.

So I think that during the installation process using config won't work and the only way is to use the global config variable.

So my question is how I can provide this variable to drush's site install command?

I am talking specifically about this: core/includes/install.core.inc:411

  // Register the file translation service.
  if (isset($GLOBALS['config']['locale.settings']['translation']['path'])) {
    $directory = $GLOBALS['config']['locale.settings']['translation']['path'];
  }
  else {
    $directory = $site_path . '/files/translations';
  }
  $container->set('string_translator.file_translation', new FileTranslation($directory));
  $container->get('string_translation')
    ->addTranslator($container->get('string_translator.file_translation'));


texts: How do I setup multi sites in Drupal 7 using xampp

texts:
I face a problem in multisite with Drupal 7.34. I'm using windows 7 Os. The steps that I followed are:

1. Create a database for all sites : create db of all sites test_db, trial1_db and trial2_db.

2. Install Drupal : I installed the drupal 7.34 as usual and name it test.

3. Tell Windows and Apache about the multiple sites : Open Windows 'hosts' file in a text editor.  Which is typically in /system32/drivers/etc/hosts. And add following lines:

                   127.0.0.1 test
                   127.0.0.1 trial1
                   127.0.0.1 trial2

Now in httpd-vhosts.conf file, which is located in c:/xampp/apache/conf/extra. I append these lines at end of the file:

                   NameVirtualHost *:80
                   <VirtualHost *:80>
                     DocumentRoot "C:/xampp/htdocs"
                     ServerName localhost
                   </VirtualHost>

                   <VirtualHost *:80>
                     DocumentRoot "C:/xampp/htdocs/test"
                     ServerName test
                   </VirtualHost>

                  <VirtualHost *:80>
                     DocumentRoot "C:/xampp/htdocs/test"
                     ServerName trial2
                  </VirtualHost>

                  <VirtualHost *:80>
                     DocumentRoot "C:/xampp/htdocs/test"
                     ServerName trial3
                  </VirtualHost>

and make sured that these are not commented in httpd.conf.

                LoadModule rewrite_module modules/mod_rewrite.so
                Include conf/extra/httpd-vhosts.conf

4. Create directories for the sub-sites: Navigate to c:/xampp/htdocs/test/sites and create the directories 'trial1' and 'trial2'. And copy the default-settings.php file to each directory and rename it to settings.php. And also set the permission of these file. I mean these files are not readonly.

5. Install the sub-sites : In an open browser, navigate to http://trial1 or http://trial1/install.php

But here I got "Object Not Found!".

I followed the these links also.

https://www.drupal.org/node/288126

https://www.drupal.org/node/1682040

http://www.dratek.com/node/77

How do I setup multiple sites with one database in Drupal 7


texts: Using a node reference in Drupal 7, is there a way to tell what the parent node is?

texts:
I have a content type called Movie, it has a node reference to a content type called LeadActor. The LeadActor content type can have node references of its own back to several different Movies nodes.

When I have a page that displays the full content of a Movie, I've changed the node template to have a link to the LeadActor.

When a user uses the link to LeadActor from a Movie page, is there anyway for me to know what Movie the user came from when I'm on the LeadActor page?

I've thought about adding an extra argument to the LeadActor page link - the node id to the Movie, but I was wondering if there might be a cleaner way to handle this.

I'm using Drupal 7 and the node reference (references) module. I've also tried using the corresponding node references module - but so far I haven't been able to understand if this will work.

Thanks for your help.


texts:
Using Views Data Export module, I am generating a CSV file of the latest 10 content. Then on another Drupal site, I am trying to import those nodes with Feeds.

The problem is when I give the url of the generated CSV, Title and Body fields cannot be imported. The nodes are generated, but those two fields are empty. Other fields like tags, date, etc are imported fine.

When I manually download the CSV, put to server via FTP, then make Feeds get the CSV from there, everything works OK.

I also tried the option "Provide as file" from the Views Data Export settings. Not working either.

What is the problem with generated CSV's address?


texts:
I'm about to start theming a Drupal 7 website for the first time. I've watched  Moshe's video, Lia Clark's introduction to theme overrides using context naming, and Franz's talk at Drupalcon Chicago. These are all great, but like everything else in Drupal there must be a thousand different ways to theme now.

What is are the best techniques and practices to theme now in Drupal 7? More specifically, how do I best use hook_page_alter($page)? I'm imagining that after I move all the parts of the page around it will be huge and unwieldy. Are there ways to add a region to a node template?

Edit:

Here is an example of moving a page region that is populated with the Context module while the block module is disabled completely. It was the first way of doing this that came to my mind. Why someone would want to put a region between the links and comments, I don't know. Still it's cool to be able to put stuff there.

In template.php:

function hook_page_alter(&$page){

  $main_content_display = &drupal_static('system_main_content_added', FALSE);

  // Need to beat common.inc drupal_render_page() line 5485 to this
  if (!$main_content_display) {
    $page['content']['system_main'] = drupal_set_page_content();
  }

  if ($node = menu_get_object()) {
    $region_to_embed = $page['sidebar_first'];
      $page['content']['system_main']['nodes'][$node->nid]['#node']->region = $region_to_embed;
    unset($page['sidebar_first']);
  }
}

And in node.tpl.php:

  <?php print render($content['links']); ?>
  <?php if ($node->region): ?>
    <?php print render($node->region); ?>
  <?php endif; ?>
  <?php print render($content['comments']); ?>


texts: How to Display a field only once in a view

texts:
How to display field only once, please find the image.

How can we show image only once in a row.

PS:

We can add as attachment with image and another one with out image, but still there will be two queries ran, that I dont want.
We can make display:block for the first one and display:none for the rest. But this will load all images.


texts:
How do I pass additional values to #element_validate so they can be used for validation?

I'm using hook_form_alter() and Drupal 7.

//Example 1
function my_validation_function($form, &$form_state) {
    //Validation Code
}

I would like to use:

//Example 2
function my_validation_function($form, &$form_state, $additional_values) {
    //Validation Code with access to $additional_values
}

This works for example 1:

$form['field']['#element_validate'] = array('my_validation_function');

How do I pass $additional_values to example 2 using $form['field']['#element_validate']


texts: Not possible to drush sql-sync sqlite to mysql pragma

texts:
I have a local testing setup where I can create drupal sites easily, all running with a sqlite DB.

I want to (firstly) publish the site to a remote server using a script that calls

drush sql-sync @blah.livesite.local @blah.livesite.com --create-db

The problem i ran into is that drush sql-sync does not like to migrate a sqlite DB to a mysql DB as some structural deficites block the transfer. The error message is:

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for
the right syntax to use near 'PRAGMA foreign_keys=OFF' at line 1

I know I maybe can do a sql-dump first, edit some of the lines manually and import that filt into the remote db then.
But I need this procedure quite often and have an automation script for the transfer - it should work fast with no manual editing involved.

Is it not possible to sql-sync from sqlite to mysql generally?

Yes, and I tried dbtng-migrate as well, with help of there. It did not work, I ran into all kind of errors, and I don't want to create another mysql db locally and sync then.

All I want is a simple way to sync my local sqlite drupal install to a remote  mysql one.