texts: Different product prices per line item options

texts:
I'm working with Drupal Commerce, and i have a node type called "travel" with a product entity.
This product have some static fields types like "city" which are used to define different prices supplements depending the departure city (Aka NY (+$15  extra transport charge), L.A(+$25  extra transport charge), S.D (+$20 extra transport charge) etc.). These fields are static, that mean i don't have to jump too often in the Store options to add my cities. (But i can set the price in the node edition as it is an option set.)

But i have another field: Range date of Departure/Arrival, this field is dynamic, i may have to set custom entries for each added nodes.

In the example below, my node is a travel to London (base price of $1500).
The departures are: Los Angeles (+$30 e.t.c), New York (+$50  e.t.c), San Diego (+$25  e.t.c).
But in the node i have to set different sojourn range dates:

Available dates:
-2014-01-20 to 2014-01-30
-2014-02-20 to 2014-02-30
-2014-03-20 to 2014-03-30
...

Each of these dates directly alters the travel price. My wish is to set a different travel price per range date like this:

-2014-01-20 to 2014-01-30 ($1600)
-2014-02-20 to 2014-02-30 ($1650)
-2014-03-20 to 2014-03-30 ($1450)

OR
A discount/extra charge to the main sojourn price ($1500) like this:

-2014-01-20 to 2014-01-30 (+$100)
-2014-02-20 to 2014-02-30 (+$150)
-2014-03-20 to 2014-03-30 (-$50)

Of course, those changes are not directly visible on the front-side, the visitor will just see "10 days of travel to London from 2014-03-20 to 2014-03-30 for $1450".

Now the technical problem is not really the front integration, but most likely the back-office configuration. Which product field configuration/combination should i use ?
Remember that prices per dates should be set from the node creation form.

In the first approach, i was thinking about a multi-field field type combined with a sub-option set, but it seem that drupal did not appreciate that combination and doesn't recognize those fields as it mixes html id/classes like hell :/

So i'm now, my head in my hands, awaiting for a Drupal SuperHeroes.

Regards,
Geo


texts: How to change node display according to value of date field

texts:
I have a need to display a node differently once a date field ('subscription expiry') of the node has passed. This is for subscription-based content. Ideally I would like to be able to choose a different Display Suite view when the alter the display of the node when the subscription expiry date is before today.

I have looked at preprocess functions and at altering the node template but have yet to find an elegant solution. The number of fields is quite high: about 35 for the full view and about 15 for the limited view. I have created corresponding DS views but I would like to find how I can alter the view according to the value of the subscription expiry field.

My workaround is to use template_preprocess_field to hide each field I want to restrict, but this seems a bit long-winded.

Any suggestions would be most welcomed!


texts: How can I get the Operations Link Field back?

texts:
I have a custom entity created in code which displays list in collection route. I decided to use a view to show this collection.

I created a new view of type 'Product' (Views shows my custom entity)
I added the fields I need to display
then searched for Operations Links (to add the edit, delete menu)

but it wasn't showing. I can confirm I've used this before in a view of custom entities.
Wat magic do I need to do here?


texts:
I have a block in view that is displaying the user details, i want to display that block in a nodes created by the respective users.

i am successfully using this block in user page now i want it on node page.

please help me.

For another block which is also coming from view is worked fine with this code
Show block on specific pages:

<?php

//Read URL
$path=$_GET['q'];

//If URL is node page

if ( strpos($path,'node')===0){
//Parse URL to get nid
$links=explode("/",$_GET['q']);
$nid=$links[1];

//Load node

$node=node_load($nid);

//Display block only if node is of certain content type
if($node->type=='user_art'){
return TRUE;
}
}

return FALSE;
?>

Thanks


texts: Submitting the user profile edit form is logging me out

texts:
I have a strange issue. I am using Drupal 6. When I am submitting my profile form, it is logging me out.

When I check my database users table, the password field is having null value.

I don't know where to check this issue, to solve it.


texts: Moving the Answers answer form to a block

texts:
I am using Answers 7.x-4.0-rc2. Out of the box, the add answer form for a question is at the bottom of the page. I would like to be able to add this form to a block and put it on the left so that in mobile, it will appear at the top and on a regular screen, it will appear at the left.

I am already using Form Block in other places on the site so I tried that first. I enabled the add answers node form to become a block and placed it to the left sidebar. This created some sort of infinite loop of page not founds. I tailed watchdog to see endless reports of the answer node page not being found once it was loaded. Simple solution but didn't work for complex reasons.

The answers form is attached to the question node via the main theme template, sites/all/modules/contrib/answers/theme/node--answers.tpl.php for the answers module:

<?php if(isset($content['new_answer_form'])): ?>
    <div class="new-answer-form">
      <?php print render($content['new_answer_form']); ?>
    </div>
  <?php endif;?>

I was able to create a subtheme based on a modification to this theme template in which I moved the add answers form to the top of the page instead of the bottom but am still looking for a way to put it on the left for non-mobile via a block or some other act of Drupal magic. Any feedback is appreciated.

I am not using panels and do not wish to install it.
I tried the form block method with and without the form also being attached to the question page via the template


texts: Restrict core to generate taxonomy terms' URLs

texts:
I'm working on very large existing Drupal site that has thousands of nodes, user in it and bunch of Taxonomies as well.

I understand very well that Drupal core generates default URLs (taxonomy/term/tid) as we create a taxonomy term but my requirement is not to so is there a way we can control it?

Updated

Actually, I'm working on SEO of the site so according to the SEO report there are more than 10K redirections to 404 page from the Location taxonomy term pages (URL aliases generated by pathauto module and redirected by custom code to 404). So the owners want to reduce 404 redirections.

I was thinking I can achieve this

By deleting URL aliases of terms so aliases URLs'll not be listed in the google search (would be less SEO friendly) and user'll not try to access, by this way we can reduce 404 redirection.
By deleting taxonomy/term/tid, path to such terms will permanently removed so I'll also help to reduce 404.

What do you suggest?


texts: How to implement a select list that allows for multiple selections?

texts:
I am creating a content type that contains a field of type "Entity/user reference", and for the widget I want the user to be able to select multiple entities.

I installed and tried the Improved Multi Select module, however I did not find it in the widgets list.

Then I installed and tried the Multiple Selects module, I found it in the widgets list, however it does not work the way it should: it works like a normal select list that allows selecting one entity, it is not giving me the option to "add another item".

How can I fix this? Or does anyone know another way for allowing multiple selection?


texts: New module service is dependency on old module service - The service has a dependency on a non-existent service

texts:
I have a new module moduleB. It defines a service that is used in the dependency injection of moduleA.
moduleA is already enabled, its changes are just to the services definition. The info.yml has moduleB as a dependency.
Both moduleA and moduleB are in the core.extension config to be enabled.
moduleB cannot be enabled using config (cim or csim) because the missing dependency from moduleA throws an exception.
How can I get config to enable the missing module before checking the service dependency? Or, how can I restructure to allow the existing module to use the new module service to allow enabling the module through drush ?
Thanks!


texts: How can I disable a single checkbox in a 'checkboxes' FAPI element?

texts:
Title basically says it all, I want to disable a single checkbox of a checkboxes type FAPI element.

I don't want to do if with JavaScript, nor is changing it from checkboxes to multiple checkbox elements an option as the element is provided by another module.

Thoughts?


texts: Drush installed globally via composer as root user, but how to access Drush with ordinary user?

texts:
By following the instructions on the Drush git page:

composer global require drush/drush:6.*

I have Drush up and running (it seems to live in /root/.composer/vendor/drush/drush). But I imagine I shouldn't be running it via root. So how do I run it as my ordinary shell users?

When I try running drush it says command not found. Although it lets me use Composer. I tried installing Drush again through Composer while logged in as ordinary user without any luck. The Drush folder is also inaccessible..


texts: Custom error message + hide generic message

texts:
I'm working with the Brightcove Drupal module, and want to override generic error messages for users when an upload fails. I've added a custom error - but the generic message is still displaying before the custom message as follows:

Notice: Undefined index: widget in brightcove_field_browser_validate() (line 296 of /path/to/sites/all/modules/my_module/my_module/my_module.module).
This video is currently unavailable. Please note, it may take several minutes for large files to finish processing after being uploaded.

I can post code from the module if needed, but wasn't sure if this could be updated globally to always hide this type of message for users while still keeping custom 'user-friendly' messages.

Thanks!


texts: hook_form_alter() "og_group_ref" editable field's #options?

texts:
I've hit a problem using one og_group_ref field over multiple content types. I need to have the field editable for one content type in a view and provide the select list options from another view.

At the moment, I have the editable field in the view showing all nodes for all content types as options which isn't acceptable. A new field isn't an option.

Editable Fields
Content type: course_students
Field: og_group_ref
View: resources > panel_pane_2
View providing nodes: abc > def

I've been away from Drupal for a couple of months and am completely lost so any help with a custom module to give this functionality would be greatly appreciated.

The below image shows the current problem where two content types are in the drop down list. This list instead needs to have nodes provided by a view.


texts:
I've been trying to debug an app where I am utilising ajax and trying to post content via services. However, I can't. What am I missing?

 $.ajax({
      url: 'http://7.webcinizim.com/services/user/token.json',
      type: 'post',
      dataType: 'json',
      success: function(token) {
        console.log(JSON.stringify(token));
        $.ajax({
            url: 'http://7.webcinizim.com/services/user/login.json',
            type: 'post',
            dataType: 'json',
            data: {
              username: "tolga",
              password: "tolga123"
            },
            success: function(user) {
              console.log(JSON.stringify(user));
              $.ajax({
                url: 'http://7.webcinizim.com/services/node.json',
                type: 'post',
                dataType: 'json',
                data: 'node[type]=page&node[title]=Hede',
                success: function() {
                  console.log("Node created");
                },
                error: function(err) {
                  console.log(err);
                }
              });
            });
        }
      });
  }
});

UPDATE: My query looks like this now and I am getting Invalid JSON:

$.ajax({
  url: 'http://7.webcinizim.com/services/user/token.json',
  type: 'post',
  dataType: 'json',
  success: function(token) {
    console.log(JSON.stringify(token));
    localStorage.setItem("token", token.token)
    $.ajax({
      url: 'http://7.webcinizim.com/services/user/login.json',
      type: 'post',
      dataType: 'json',
      data: {
        username: "tolga",
        password: "tolga123"
      },
      success: function(user) {
        console.log(JSON.stringify(user));
        $.ajax({
          url: 'http://7.webcinizim.com/services/node.json',
          type: 'post',
          dataType: 'json',
          data: {
            "node[type]": "page",
            "node[title]": "Hede"
          },
          headers: {
            "X-CSRF-Token": localStorage.getItem("token"),
            "Content-Type": "application/json"
          },
          success: function() {
            console.log("Node created");
          },
          error: function(err) {
            console.log(err);
          }
        });
      },
    });
  },
});


texts: Content editor cannot view unpublished taxonomy terms when editing a node

texts:
We have a custom content type that has a Entity Reference field to a taxonomy vocabulary. The content editor is presented a list of check boxes to select their terms to attach to the node. Some of our terms are published and some aren't. When I am logged in as admin (user 1), I can see ALL of the terms to select from, but when a content editor is logged in, they are only seeing the published terms to select from. We want the editor to still be able to tag content with unpublished terms. I have tried every permission I can think of without just opening it up fully to a content editor. We have content moderation in place so the editors have semi locked down permissions in order to allow a content manager to review and publish the content.
Does anyone know the specific permission that would allow editors to see unpublished taxonomy terms on the node edit page?


texts: Adding different auction prices for same product

texts:
I'm having same issue as krystalcode's issue.

First I created a product. Then added the content as auction product. While adding this content, the base price is considered to be the same as the product. So, do I need to add new product before creating an auction item?

It would be great if farhadhf, the owner of this Commerce Auction module will help.


texts: Need advice to get an approach to do a personalized searcher?

texts:
I have a content type called "Flats" which are Flats to sell' each one of them has a 'price' field (ex. 100 000, 150 000, 200 000) and each one has a 'city' field

I need to put a searcher in the home page of the site with 2 selects input, one for 'price range' (with values like 'lower than 100 000', '100 000 to 150 000, ...) and the other for 'city' (with values like: 'Barcelona', 'Madrid', ...)

The searcher should look for flat with prices within the price range and for the chosen city.

A first sight I think I'll need to create an API Form which once submitted should go to a view passing those 2 arguments (price range and city)  in the url as $_GET values.

Is this a right approach to do this?
Can I use $_GET values as arguments in a view?

Is there any module to do this in a easier way? I don't want to reinvent the wheel...

Thanks


texts:
I have sitemap, and I would like to display the menu in the primary language of the site.  However, as this screenshot shows, some items are still being displayed in English:

How can I fix this?


texts:
I have a form where I need to add a checkboxes field. The purpose of this form is to display some values from the database. I would like to display id from my database table as checkbox' value (when "active" = 1) and url as checkbox' labels.

The database table's structure is the following.

id | uid | hash          | url          | active

1  | 1   | myhashstring1 | example_url  | 1
2  | 1   | myhashstring3 | example_url4 | 1
3  | 1   | myhashstring2 | example_url2 | 0

How can I achieve this?


texts: How to partialy hide a post until some link/button is clicked?

texts:
I have some members on my site who do not follow the rules. What I would like to do to their posts is to hide them (may be using JavaScript) until a visitor clicks a show link or button with a warning message like:

  The source code of this post is not complete and not recommended for download, if you still want to download the source code, kindly click the show link/button to display the description of this post.

When the link/button is clicked, the description (body message) will then be shown.

Any suggestions about how to do this?


texts: Can't Update Contrib Modules via Admin UI

texts:
I'm having a problem with a new Drupal site I'm working on.  I installed Drupal 7.36 and am able to install contributed modules via the admin UI and Drush.  However, I cannot update any contributed modules via the admin UI.  I can update via Drush however.

The error I'm getting is as follows.

  An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging
  information follows. Path: /wcbvi/batch?id=9&op=do StatusText:
  Internal Server Error ResponseText:

I'm running Ubuntu Server 14.04.2 (32-bit) in VirtualBox with Apache 2.4.7 and PHP 5.5.9.  I've also installed Curl, Composer, and Drush.


texts:
I had a content type with title, body(Long text and summary) and image upload field. TinyMCE editor is added to body field. But once i tried to upload an image i am getting this error:

  An error occurred while attempting to process /system/ajax: params is
  undefined.

I changed body Text processing from Filtered text (user selects text format) to Plain text and tried to upload an image. That works fine. But I need the editor for body field. What is causing this error?


texts:
I've created a computed field with some php code in it.

Now I want to use some sql, so I can run this query/php command inside computed field :

$number =db_query('SELECT COUNT(distinct field_percentage_value) FROM content_field_percentage WHERE nid = {nid} and vid = {version} ORDER BY vid DESC');

Edit: In some case when I type nid = ${nid} and vid=${version} and edit a content type, as a result I get a blank page.

It was supposed to grab a nodeID, versionID and order it in descending order, but it doesn't.
Any suggestions?

Thanks,
Michael


texts: How do I customise the header and footer using a page template for a particular content type?

texts:
I have a content type.

I want to customise the node pages for this content type, I've used node--[content-type].tpl.php but I need to use a page template to customise the header and footer and page--[content-type].tpl.php doesn't work.

I've tried page--node.tpl.php, but this changes the home page as well, then i created page--node--[content-type].tpl.php which is not working.

Please help me.

Thanks


texts:
How we can integrate Ubercart Amazon Payments for Drupal 7?

There is a module for Drupal 6 here.


texts: Pre-populate default values into a form to edit a new entity

texts:
In a Drupal 7 site, I have created a new entity called "atomyx_portal_metadata". This entity works great in all respects. I allow people to define their own entity types (much as you can create your own node types).

While allowing someone to fill out a form to enter values for such an entity type (much like filling out the form for an article for example), I use the following code:

// Get the metadata blob for this job
$metadata = atomyx_portal_metadata_load($job->mid);

// Save the metadata entity in our form array so we can pick it up in the validation routine
$form['metadata'] = array(
    '#type' => 'value',
    '#value' => $metadata,
);

// Add form elements for all attached fields
field_attach_form('atomyx_portal_metadata', $metadata, $form['container'], $form_state );

The "field_attach_form" call correctly adds all necessary form elements for editing the form, and I can validate and save those values correctly in the database afterwards. However, the form elements do not contain the default values defined in the field definition and I don't seem to be able to figure out how to correctly fill in the default values of all fields into the form.

I assume I could do this by looping over all fields myself, and trying to figure out with help of the field api what the default value for that field in the given entity-type is, but that seems like a very ... un-field-api-ish way to do it.

Is there something I'm missing? Is there a call in the field attach api that would allow me to have the fields filled in with default values correctly?

Any and all hints greatly appreciated!


texts: How to download and enable module needing to subscribe to rss?

texts: I want to download and install "Node Redirect" module for version 7 of Drupal but I can't find a way to subscribe to rss as needed. What are the steps to follow to download the module?


texts: Drupal and Apache Solr connections over http

texts:
I have installed Apache solr on a VPS. I am trying to connect Drupal 7 using the apachesolr module by specifying
    http://128.199.174.33:8080/solr
as the Solr Server URL. But my site is unable to contact the Solr server.

I should mention that these two servers are in different regions of the world and I am attempting to connect using http. The solr server has no iprules or other firewalls that block incoming connections.

(I am able to connect drupal to apache solr if they are on the same machine.) I am not sure if there is anything worng but it just doesn't seem to connect.


texts: viewing fields with field_view_field after EntityFieldQuery doesn't work

texts:
I'm using an EntityFieldQuery to load a node and try to access some of its fields, but can't seem to get any of the fields. The code is below:

$nodestoload = $query->execute();
$nids = array_keys($nodestoload['node']);
$nodes = entity_load('node', $nids);
print_r($nodes);
$output = field_view_field('node', $nodes, 'suppliername');

However, $output is returning an empty array. I can see that the node loads using the print_r. I've also tried various options (such as replacing 'node' with the actual bundle type). But nothing seems to be working... How do I access fields from a node that I loaded programmatically?


texts: Using Entity metadata wrappers to change field value under hook_node_insert()

texts:
I am trying to change a field value inside both hook_node_insert() and hook_node_update() using EMW. It actually changes the original $node object that is passed to these hook functions but the change doesn't get saved at the end.

function mymodule_node_insert($node) {
  if (!_is_dynamic_type($node->type))
    return;

  $messagew = entity_metadata_wrapper('message', message_create('post', array('uid' => $node->uid)));

  //copy terms
  $nodew = entity_metadata_wrapper('node', $node);
  //below loads a full taxonomy term
  $nodew->field_hidden_type = taxonomy_term_machine_name_load('event', 'hidden_type');

  $messagew->field_hidden_type = $nodew->field_hidden_type->value();//this actually works
  $messagew->save();
}

There are a few questions near to this one actually, but none of them addresses this precisely. This one for example is a very good explanation of the mechanism but its suggestion it not use.

Here, one should not use $nodew->save(), because it causes infinite loop. I also played a little with module weight, that does not help either.

I also tried to change another entity reference field. No use.

I don't want to go with field_attach_update() because it is old-fashioned.


texts: Render a full entire html page from custom module

texts:
I've searched/asked around without success.

I'm creating a custom Drupal 7 module, and I would like to render the code in an empty full template (not a page/node.tpl.php); by full template I mean a template containing the <html> tag.

Since now, I've used the following code but the template is rendered in page.tpl.php (render($page['content'])).

function mymodule_theme() {
  return array(
    'adm_xyz' => array (
      'render element' => 'render',
      'template' => 'adm_xyz', //  template *.tpl.php
    ),
  );
}


texts:
I'm looking for a combination between a standard select list and Taxonomy Term Reference Tree Widget.

I want a select list that has expandable and collapsible parent terms so it's easy to navigate - sure, there are options using shs, etc. but they take up a bit of space when I have five levels, and all I need is the child term from the deepest level to be recorded.

Alternatively, it would be ok to have something like shs that uses the same field when selecting each new level, rather than appending with a new select list each time.

Are there any solutions like this?


texts: Advice needed on approaching to Drupal 6 and jQuery Mobile

texts:
I'm pretty new to this 'world of Drupal', and I've got this project, where I need to build a jQuery Mobile site based on an existing Drupal 6 site.

The mobile site is somewhat different in it's structure, but needs to get some data/content from the original site.

What is the best approach to his project? Should I build the mobile site based on the same Drupal-installation, as the original site? Or should I build a new site using Drupal 7 and then somehow export/distribute content from the original site?

I've read a couple of articles claiming it's quite difficult to upgrade jQuery to version 1.4.4 in Drupal 6, which is needed to run jQuery Mobile. Is that so?

My concern is, that I'm not a PHP Jedi Master (though I know some PHP), and therefore it would be great, if some could tell me, what the best approach is to this.

I found this articles yesterday: http://www.adyax.com/en/tutorials/make-mobile-version-your-drupal-site-using-jquery-mobile-and-some-magic/lets-get-started. Is this what I should be doing?


texts: Double Publish is Required To Update Data When Node is Under High Traffic

texts:
We have a high-volume production site that is running into issues of serving stale data when a node is republished.
Description/Example Of Issue
I go into a node, create a new draft, then make some changes to the "title" and the "body". If I click "publish" while at the same moment there is traffic on the node, the updates will not take effect. Often times, the URL alias will be updated to reflect the new title, but the actual page will not display the new title or the new body. Similarly, when viewing the node on the Admin Content page, it will still show the old title. If we go back in and publish the node a second time, the changes will then appear in the display as expected.
Replicating the Issue
We've been able to replicate this issue by using JMeter to simulate traffic on a page. In JMeter, we created a "Thread Group" with "Number of Threads (users)" set to "2" and "Ramp-up period (seconds)" set to "2", then pointed it to a particular node, and clicked "start". From here, we see the same result of changes not displaying until the node is published a second time.
Steps We've Tried

We are on AWS and have a read/write database and a read-only database. We thought that there might be a delay in synching changes over to the read-only database. We edited the structure to test this theory, and this was not where the problem lies.
We logged out the node data at various hooks within the entity lifecycle to ensure we had the correct data at each step of the way. In doing this, we found that the updated data is present and correct at every step.

Our Current Theories
The problem definitely seems to be caused by caching issues and/or some kind of race condition. In theory, whenever you save a Node, it should invalidate the cache for that node, so the display will reflect the updated data.
The issue seems to lie where the data actually gets written to the database and/or where the cache for the specific node is actually invalidated. This appears to be pretty deep inside of the core functionality for Drupal and we've had difficulty finding good documentation on where and how this happens.


texts: Digest of suggested content based on user activity

texts:
Twitter acquired Summify that employs users' browsing activity, social trends, and other black magic to build email digests of suggested content that are very effective at drawing traffic back to their site.

I know in Drupal it should is relatively easy to build digest emails or suggest content blocks based on content or tags that the user follows, commented on or authored. I'm wondering how to take the next step towards calculating a relevancy score of suggested content based on the user's browsing on the site, and/or based on the activity of other active users (trend makers) on my site.

I'm asking for guidance to accomplish this using any or all of the following approaches:

existing modules that uses browsing activity of authenticated user to score relevancy of a given piece of content. Or something like this.
paid services that support Drupal and preferably have a module to interface easily with Drupal. One of Summify's competitors?
could Apache Solr help in any way?


texts:
For a migration project, we had some links on the main menu stubbed out to an external site. Now I want to update the links with their actual final path. However, I can't do this beforehand, because I don't know what the node ids of the newly-created imported nodes would be.

I want to update the menu links with node ids in my import script, but I haven't found how to do that programmatically. We would like to avoid updating them manually during the final migration.

How can I do this?


texts: Group result and display count in a view

texts:
I want to create a view and group the result like display only 1 record and along with it display the count of the similar records along with it. Can i do it in views with out writing any code. i.e. result should look like

Football (3)

Tennis (6)

Cricket (4)


texts: How to use the dsm( ) Devel function to print the $form array of my form?

texts: I want to use the dsm() function of the Devel module to print the $form array of a form, where the form_id is search_theme_form. How to do that?


texts:
Is there way to use entityQuery in order to select nodes with multiple value date field. For example we have a content type event with a field field_event_date which may contain unlimited number of dates. Is there any way to select all event nodes that occur on a certain day? E.g. we have field_event_date equals to

[
  10.09.2018
  11.09.2018
  13.09.2018
]

the node with this field should be returned for when "10.09.2018", "11.09.2018", "13.09.2018" is passed, and omitted for any other date (including "12.09.2018).


texts: Use rules to assign role based off custom field on user registration

texts:
I have a headless Drupal and I'm trying to figure out how to auto assign a role during registration based off of a custom field (field_is_student) in the registration form.

I am trying to use Rules but I don't know how to access the field to check whether it's true or false. My rule is set to "After saving a new user (rules_entity_insert:user)" and the only options I get in the condition Data Selector are User based.

Here's what I'm using to create my users:

{
    "name": {
        "value": "username"
    },
    "mail": {
        "value": "useremail@email.com"
    },
    "field_is_student":{
        "value": false
    }
}


texts: Setting a View's Menu Item to a Sub-Menu

texts:
I'm using Drupal 7.10 and Views 3.1.

This seems like it should be simple but I can't find an answer. I have a menu structure similar to the following:

Main >
    About Us >
        History
        Contact Us
    Members >
        Wiki
        Tasks

The problem is that tasks is a view page but I can't seem to add the view to anywhere but a direct child of Main, there doesn't seem to be a way to add it so that it is a child of Members.

I can simply add a link to the page by adding another menu item but this causes the sub-menu to disappear so that, in this case Wiki disappears.

Is the only way to do this to add a block and add that block to a page? Or am I missing something?

Thanks!


texts: When to use a preprocess function instead of changing the template

texts:
I am using drupal 7.

I have one query that when to use a preprocess function instead of changing the template files?


texts: How to update a field on menu_link_content (added using menu_item_extras module) entity from node form

texts: I have a checkbox field added to one of the menus using Menu Item Extras module. By default, the checkbox is checked and works as expected when I create a menu item via menu admin UI. however, when I create a menu item via node, the field doesn't get the default behavior (checkbox checked). I also checked the table (menu_link_content__[field_name]) and there is no entry for the menu item added via node/add form.


texts: How to set up a date field based scheduled newsletter with Simplenews?

texts:
On my Drupal 7 site I have on the one hand a news letter set up with the module Simplenews. On the other hand I have a content type with a date field. Now I would like the newsletter being scheduled by the date field. To be more precise:

The news letter should work as a reminder. Two days before the date saved in one of the date fields the news letter should be send.

How would that be possible. Actually I think, this does not work with rules, as there is not any triggering event, that could generate scheduled rule.


texts:
I have a custom module in Drupal and I also have a custom table for storing the details of seminars, such as name, description, date and location.

I am showing the names of the seminars in a left sidebar block; when the user clicks on a seminar name, I want to show its other details (description, location, etc.) in a form (which include a "Submit" button) in a popup modal box.

When the user clicks on the submit button, the user will be joined in the seminar (inserted into database).

How can I use JavaScript/AJAX for this scenario and process form in popup, without refreshing the page?

I have included the jQuery library in my module file using drupal_add_js(); I also installed the Chaos Tools Suite module.


texts: Missing dropdown menus when viewed as a publisher(user)

texts:
I've used ZeroPoint theme, developed a site and it works perfect. Recently, I got to create a new user with specific roles for that I created a "publisher profile" and assigned some roles. Whatever the roles I've assigned are working fine, but the problem is when the website is viewed as a publisher the drop-down menus are missing. To the point, I couldn't see the drop-down for the main-menu links as a publisher and again when as an admin I could see the drop-down links.

The drop-down links appear for anonymous users. While it is not the same for publisher/content creator

`.

I found some part of code in page.tpl.php that deals with main-menu

<?php if ($main_menu || $page['dropdown']): ?>
  <div id="navlinks" class="<?php print menupos() ?>">
  <?php if (!empty($page['dropdown'])) { ?><?php print render($page['dropdown']); ?><?php } ?>
  <?php if (empty($page['dropdown'])) { ?>
  <?php print theme('links__system_main_menu', array(
            'links' => $main_menu,
            'attributes' => array(
              'id' => 'navlist',
              'class' => array('links', 'clearfix'),
            ),
            'heading' => array(
              'text' => t('Main menu'),
              'level' => 'h2',
              'class' => array('element-invisible'),
            ),)); ?><?php } ?>
  </div>
<?php endif; ?>

What might be the problem? I have checked all the user roles and permissions there is no kind of thing that deals with page views. Any Ideas??


texts: How can I define the activity and/or case in a CiviCRM-integrated webform?

texts:
I have a Drupal webform that is integrated to my CiviCRM installation and uses numerous custom fields that are associated with a particular activity type. I want to use the form to allow specific contacts to edit an activity that is part of a pre-existing case.

The contact who will be submitting the webform (contact 1) has an assigned role in the case and a relationship to the case manager. We're using Views to show some data to this contact including a link to the webform. I understand that I can pass a case ID and/or an activity ID into the form via the URL that is presented to the contact in the View, and I can see how I can do this by rewriting the output of one of the Views fields.

The question is: do I need to pass in both the case ID and the activity ID, or is it enough just to pass in the activity ID?

And what should I have as the settings for the case and activity in the CiviCRM tab for the webform?


texts:
Suppose I have a link field for internal images. $node->file_image->uri will for instance return:

internal:/sites/default/files/image/image.jpeg

I need to convert this into an absolute URL for metadata. I can do this manually, of course, but let's see what the usual functions do:

file_create_url() = "https://example.com/internal%3A/sites/default/files/image/image.jpeg"
file_build_uri() = "public://internal:/sites/default/files/image/image.jpeg"
file_create_url(file_build_uri()) = "https://example.com/sites/default/files/internal%3A/sites/default/files/image/image.jpeg"

No cigar, not even close. The new functions?

Url::fromUri()->toString() = "internal:/sites/default/files/image/image.jpeg"
Url::fromUri()->toUriString() = "base:sites/default/files/image/image.jpeg"

So, how to do it without doing it manually, of course? Removing internal: and prepending $base_url is very simple but still a hack.


texts: Twitter Card Preview is failing with twitter:image

texts:
I'm trying to add Twitter Cards to my site so that tweets referencing my blog posts will be expandable and show extra info. I've installed the metatag module, enabled the Metatag: Twitter Cards sub-module as well as patched the Twitter Cards sub-module to fix a problem with it generating <link /> tags instead of <meta /> tags.

When I include a twitter:image tag, the Twitter Card fails, but when I remove it, it works just fine. What am I doing wrong?

<meta property="twitter:url" content="http://liberalgeek.com/content/why-do-atheists-celebrate-christmas" />
<meta property="twitter:card" content="summary" />
<meta property="twitter:description" content="I can&#039;t speak for all atheists, I can only speak for myself, so please leave a comment below and explain why you celebrate Christmas! When I hear someone ask, &quot;Why do atheists celebrate Christmas?&quot; my first thought often is: Better Question: Why do Christians celebrate Christmas?" />
<meta property="twitter:creator" content="@kennywyland" />
<meta property="twitter:title" content="Why do Atheists celebrate Christmas?" />

<!-- the following line causes the problem -->
<meta property="twitter:image" content="http://liberalgeek.com/sites/default/files/styles/large/public/Christmas%20Tree.jpg" />

I have tried <meta property= as well as <meta name= and they behave the same way.

The image is publicly visible, it's large enough without being too large... what is wrong?

To be clearer, by "failing" I mean that Twitter refuses to acknowledge there is a Twitter Card for that URL, so the preview is not shown along with the tweet. When I test this on the twitter card preview page, this is the result I get:

However, when I remove the twitter:image tag and generate the preview again it works just fine and looks like this:

During further testing I found the STRANGEST thing. If I change the domain from liberalgeek.com to www.liberalgeek.com, the Twitter Card successfully generates, although the thumbnail image is a broken image. (That may just be due to high twitter volume, but I'm not sure.)

I want the Twitter card to work, even if they don't include the unnecessary www.

Notice that:

The .htaccess file is the standard one installed with Drupal
I don't think I'm using gzip compression
Apache isn't sending back the wrong headers
The error log doesn't shown any error
The access log shows entries with a return code equal to 200, and a correct content length value, when Twitter tries to access the image

I found a site on my server which twitter handles just fine:

<meta property="twitter:image" content="http://www.geekqi.com/images/StylizedYinYangRedLucida.png" />

But I'm not sure what the difference is between this and all of my other sites.


texts: Why isn't my managed file getting saved?

texts:
Please save me from ripping out the rest of my hair...

I've got a "managed_file" field in a form; nothing special.  When the form is submitted, I run something like the following code to, presumably, catch and save it:

$destination = "public://video_posters";
$file_return = file_save_upload('field_poster_frame', array('file_validate_extensions' => array('jpg jpeg png gif')), $destination, FILE_EXISTS_RENAME);
if ($file_return) {
     $file_return->status = FILE_STATUS_PERMANENT;
     file_save($file_return);
     file_usage_add($file_return, 'my_module', 'node', $some_nid);
}

(There is more testing of $file_return to catch the other cases, and a few other things, but you get the idea.)

What's happening is:

An entry shows up in the file_managed table that is correct except that its uri is temporary://the_file_name.jpg instead of, presumably, public://video_posters/the_file_name.jpg.
The file was indeed uploaded and is in the indicated place in temp storage -- just not where I want it to be.

Am I missing something obvious?  Any things to check on?  This is really driving me over the edge.  Thanks!


texts: Where is the $email_text variable set on ubercart?

texts: With Ubercart, where is the $email_text variable set, the variable that determines whether the "do not reply to this email" should be displayed in the email received by a customer after they place an order.


texts: Saving multipage webforms after each page?

texts: You can create a multipage webform by inserting a pagebreak element. Can you have these webforms save after each page, so that if someone doesn't complete the final page you still get what they entered on previous pages?


texts: How to associate multiple profiles per user with Profile2

texts:
I'm running a Drupal 7 site that has different profile types (created using the Profile2 module). Each user is associated with a profile, so at the time of registration, a potential user can choose a specific profile, and based on that, a different registration page is displayed.

I was wondering, is it possible to allow a normal user (not admin) to associate more than one profile for itself? So that he/she can see the fields of each specific profile to which is associated?

At present, the Profile2 module allow to have one User: one Profile relationship, and only the admin can add multiple profiles to a user. Is there a patch for Profile2 module to permit this kind of feature?
Thank you!


texts: User must click Back button twice after adding item in cart

texts:
I have added Drupal Commerce in an existing D7 site and I use the existing product nodes, in which I have added the Add to cart form. Everything looks nice and works fine, except for one thing. When a user adds an item into the cart and then tries to go back one step by clicking the browser back button, he or she stays on the same page. So the user must click twice to go back one step. The history information about previuos pages, must still be there since one lands on the correct page, after clicking twice.

Maybe I should mention that I use Authcache with Ajax calls to fetch the Cart block on cached pages, but i think this behaviour started before I installed Authcache.

How can I fix this?


texts:
I want to create a tutorial content type, something where people can upload images, title, body, etc into 'steps'; each step would then be linked together.
The users can upload an unlimited number of steps for the entire node. It is very similar to the instructables.com site. How could I achieve that?

By the way, someone did ask a similar question about this using Drupal 6. The suggestions were to use a story book content type, or to use CCK field grouping. I don't understand how to do those things in d7.


texts: Adding Drupal field "subtitle" to page template

texts:
I have created a Content Type called "Happy Days". I have created a field in that called "subtitle".

In my template "page--happy-days.tpl.php", I want the field "subtitle" to show wrapped in an  tag. I attempted:

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

but no luck. Any help would be appreciated.


texts:
I have to modify a contrib module with a custom function. In my case I can't use hooks to extend it.

Is there a best practice, for example renaming the module and placing in sites/default/modules?


texts: PDOException on Article page : Base table or view not found

texts:
In my Drupal site, when I tried to save an article page I'm getting the following error:

  PDOException: SQLSTATE[42S02]: Base table or view not found: 1146
  Table  'novitawe_icpasld.field_revision_field_tags' doesn't exist:
  DELETE FROM   {field_revision_field_tags} WHERE (entity_type =
  :db_condition_placeholder_0) AND (entity_id =
  :db_condition_placeholder_1) AND (revision_id =
  :db_condition_placeholder_2) AND (language IN
  (:db_condition_placeholder_3)) ; Array ( [:db_condition_placeholder_0]
  => node [:db_condition_placeholder_1] => 138 [:db_condition_placeholder_2] => 138  [:db_condition_placeholder_3] =>
  und ) in field_sql_storage_field_storage_write() (line 382 of
  /home7/novitawe/public_html/icpasld/modules/field/modules/field_sql_storage/field_sql_storage.module)

Could anyone please let me know how can I solve this issue without affecting any of my DB because this site is live.
.


texts: WYSIWYG editor on Paragraphs text field?

texts:
How do I enable the WYSIWYG editor on a paragraphs text field in Drupal 8?

Currently, adding a text field (of any type) displays a single line input box.  I'd like this field to be at least a multi line textarea, with preferably, a WYSIWYG editor.  Is there a setting or module I can use to change this ?

EDIT: I should add that the editor works fine in a field on a content type or block.  It does not load for any text type in a paragraphs field.


texts:
Under admin/config/people/accounts, in mails, there is a 'notification of comment' email, where I edited in the following text:

  Hi, [user:name]!

  [comment:author] commented on [comment:node:title].

I took the tokens from "Browse available tokens" below the text field.
When it sends the email to the user, the mail looks like this:

  Hi, [user:name]!

  [comment:author] commented on [comment:node:title].

so the tokens don't work. (In the "account activation" email, the tokens do work).


texts:
I need to define a new input format programmatically, probably as part of my module's hook_install().  I need to write code that duplicates the manual operations described on http://drupal.org/node/778976.

I have not been able to learn how to do this. Any pointers in the right direction will be appreciated.


texts: What's the relative path to a user's profile?

texts:
I've created a clickable block with Views and rewrote the fields with HTML like this:

<a href="user"> some divs... </a>

Clicking the block should refer the logged-in user to his/her profile. As the code mentions, I'm using user as relative link, but a problem occurs when the user clicks the link when he/she is already visiting his/her profile: the link is then turned into mysite/user/user instead of mysite/user.

Using /user doesn't work either, because it redirects the user to localhost/user instead of localhost/mysite/user.

What's the correct way to construct a path that takes into account either being relative or the $base_path?


texts: I created my own view thanks to Views module. How can I check the machine name of that view?


texts: Entity Form: Override Submit Handler with Custom One

texts:
I'm loading a field collection item form inside of a formatter. Below is the function loading the form, which works. However I do not want to call the normal field collection submitForm handler, I want to override the submit handler with my own. I've tried attaching my submit handler, but the field collection submit handler still continues getting called.

I don't want to use a form_alter, I'm trying to keep this in the FormBase or ContentEntityForm class. Does anyone know how I can override the field collection submit handler?

<?php
public function getFCForm(FieldItemInterface $item, $fc_name) {
    $entity = $item->getFieldCollectionItem();
    $displays = EntityViewDisplay::collectRenderDisplays([$entity], 'full');
    $display = $displays[$entity->bundle()];
    foreach ($display->getComponents() as $name => $options) {
      $fields_by_weight[$options['weight']] = $name;
    }
    ksort($fields_by_weight);

    //load fc entity
    $fieldCollection = \Drupal\field_collection\Entity\FieldCollection::load($fc_name);

    $field_collection_item = \Drupal::entityTypeManager()
      ->getStorage('field_collection_item')
      ->create([
        'field_name' => $fieldCollection->id(),
        'host_type' => 'node',
        'revision_id' => 0,
      ]);

    $form = \Drupal::service('entity.form_builder')->getForm($field_collection_item);
    $form['#prefix'] = '
';
    $form['#suffix'] = '
';
    $form['actions']['submit']['#submit']=['::ajaxFormSubmitHandler'];
    $form['actions']['submit']['#ajax_processed'] = TRUE;
    $form['actions']['submit']['#value'] = t('wtf');
    $form['#validate'] = ['::validateForm'];
    $form['#submit'] = ['::ajaxFormSubmitHandler'];

    //custom submit handler not being called?

    return $form;
  }


texts: Is it possible that an older version of a module works when it has not been upgraded to 7 or is it a lost cause to try?


texts:
Context: I created a new content type (press room nodetype) locally and made a feature with it so it is easier to deploy on my dev-stage-prod environments. This works perfectly well. The thing is, is I need to add permissions to some user roles right away in the same deployment process. I can't find the proper way to run some code after the feature-revert-all;

At the moment I put my code in a new module press_room.install.

function press_room_update_7001() {
    module_enable(['press_room_nodetype']); // installs the feature that will add the new content type

    $permission = [
        'edit any press_room content' => true,
    ];
    _add_permission_to_role('myrole',$permission); // too soon, content type not yet created
}

This module is enabled by another .install (homepage).

function homepage_update_7003() {
    module_enable(['press_room']);
}

With this code the new content type is created and the module to preprocess its output is enabled but the permissions are not given. It seems the content type is not (fully) created when the permissions needs to be added, so Drupal skips those lines and do nothing. If I run my code a second time, it works since the content type already exists.

Has anyone a solution to process code after a new content type has been created. What is the proper way to do this? Thank you.


texts: How do I post JSON data to cart and checkout?

texts:
I'm using Drupal commerce services for module for REST API calls, but I don't know how to post JSON to REST service cart and checkout.

The product attributes I have are field_taxo_color and field_taxo_size. How do I include the selected attributes?

The product list JSON is the following.


texts:
I want to show the information of the author in his comment. By default it shows the name and the picture, I want to add:

The number of node and created comments
The number of obtained userpoints.

What code should I use to achieve this?


texts: Is it necessary to connect to drupal database in order to fetch something from database? OR no if I have drupal installed so no need to make connection in any template file in order to fetch data?


texts: How to get drush to work with xdebug -- may have recently broken

texts:
I've been using drush with xdebug for years.  It looks like it broke in the last two weeks, possibly due to modifications made to the core "drush" script (Split 'drush' script into finder, wrapper and launcher stages.). It now dispatches via "pcntl_exec" on Ubuntu, and xdebug never gets control back thereafter.

I've tried reverting drush to the previous commit ("8ab7ad9... Make uli test more resiliant vis-a-vis html tags that may be injected into log messages."), which fixes the xdebug problem, but does not appear to be compatible with RC1 :-(.  So I strongly suspect the addition of pcntl_exec.

Anyone know how to get around this, or do I need to log an issue against drush on their github site?


texts:
Is a module required to submit a form ?
I get a standard form from our designer and try to send it as follow:

<form action="/kontakt" class="sky-form" method="POST" name="kontakt">
  ...
  <input type="submit" class="btn btn-u btn-u-lg" value="Nachricht absenden">
</form>

I have tried different function calls without success

MYTHEME_form_submit(array &$form, FormStateInterface $form_state)
contact_form(array &$form, FormStateInterface $form_state)
contact_form_submit(array &$form, FormStateInterface $form_state)
MYTHEME_contact_form_submit(array &$form, FormStateInterface $form_state)
...

i have to say, that i am a beginner in Drupal 8, so help is very appreciated.

thank you.


texts:
I'm trying to bulk update image alt and title tags for about 1,500 images on a site.

I've tried a number of methods and I will outline them all. I've also tried with the media module enabled and disabled. I think my issue is something to do with not being able to save the changes through to the image itself.

The relevant part of my image array (the image field - called "field_meeme_image" can hold mulitple values) is as follows:

 [field_meeme_image] => Array (
        [und] => Array (
              [0] => Array ( [fid] => 131 [alt] => Test [title] => [width] => 500

Currently I am trying Devel Execute PHP to just change one node as follows:

$node = node_load(63);
$node->log = 'Test2';
$node->field_meeme_image[$node->language][0]['title'] = $node->title;
node_save($node);

Using ['und'][0]['title'] doesn't work either

I also tried using both methods from this post

And neither one worked for me. I have confirmed that VBO is working. For example if I simply set:

$entity->log = $entity->title;
node_save($entity);

The log gets changed fine but if I try:

$entity->field_meeme_image[$entity->language][0]['title'] = $entity->title;
$entity->field_meeme_image['und'][0]['title'] = $entity->title;
node_save($entity);

The change doesn't get saved.

I've even tried using a preprocess function in my template (I've tried everything I can think of)

function footheme_preprocess_node(&$vars) {
    $node = $vars['node'];
    $user = $vars['user'];
    if ($node->type == 'meeme') {
    if (in_array('administrator', array_values($user->roles))) {
        $node->field_meeme_image[$node->language][0]['alt'] = $node->title;
        node_save($node);
        }
    }

This makes the change in the $node array but it doesn't actually show up as the alt tag for the image and it doesn't save.

Any help would be massively appreciated. Cheers.


texts: Feeds module and feed that includes external files as nodes

texts:
I have a feed that includes item content in external xml files. For example, I have a manifest.xml file that has "sections" and each section links to another xml file.. such as:

<rss version="2.0">
<script/>
<channel>
<title>Example</title>
<link>manifest.xml</link>
<pubDate>Fri, 27 Jul 2012 00:00:00 GMT</pubDate>
<lastBuildDate>Wed, 05 Dec 2012 17:04:05 GMT</lastBuildDate>
<item>
<title>Page One</title>
<link>Page_One_Section.xml</link>
<pubDate>Fri, 27 Jul 2012 00:00:00 GMT</pubDate>
</item>
...
</channel>
</rss>

Then in that (section) external file contains lists of nodes whos content is stored in yet another external xml file...such as

<rss version="2.0">
<script/>
<channel>
<title>Page One</title>
<link>Page_One_Section.xml</link>
<pubDate>Fri, 27 Jul 2012 00:00:00 GMT</pubDate>
<lastBuildDate>Wed, 05 Dec 2012 17:04:05 GMT</lastBuildDate>
<item>
<title>Example Story</title>
<link>story.xml</link>
<pubDate>Fri, 27 Jul 2012 00:00:00 GMT</pubDate>
</item>
...
</channel>
</rss>

Now my question is, in this multi-file structure, will the feeds module parse this out-of-the-box, or will I need to get some other add on or create a custom parser??

What other solutions are out there for parsing something like this?


texts:
Drupal 7.x

The search module's indexing maintenance sql query takes a couple of minutes to complete each time cron gets triggered.

SELECT t.word AS realword, i.word FROM search_total t LEFT JOIN search_index i ON t.word = i.word WHERE i.word IS NULL`

Database search info data info:

127k nodes

37m  search_index

1.3m search_total

Search settings:
100 Number of item to index per cron ron

Indexing settings:
2 Minimum word length to index

Search is only enabled for nodes and once indexed, searches are fairly fast. However the actual process of re-indexing takes it's toll in our database server. Do you guys have any suggestions on how to mitigate this problem caused by extremely large websites? How do large websites scale Drupal's built-in search functionality without using additional tools like solr, elatisticsearch, etc.? All indications I'm seeing is to probably throw more hardware at this problem.


texts: How to fix Fivestar/Voting API to make the appearance option selectable?

texts:
I am using Drupal 7.19, and the following modules:

Views 7.x-3.5
Voting API 7.x-2.10
Fivestar 7.x-2.0-alpha2

With older versions of the above modules there is the option of the following field configure setting: "Appearance: Fivestar Stars (display only)." The result is a view displaying Fivestar stars.
The mentioned versions do not give that field configure setting option. The result is a view displaying a number.

The problem was bugging others too. Some solutions are suggested on that page, but none makes sense to me.

I'd like to know how to solve this.


texts: Is there a way to track text-bytes changes Drupal nodes?

texts:
A Drupal security question:

Assuming some people have admin access to your site. How could you know if and how much text they changed in any of the nodes of your site? I'm not talking about going to admin/content and see if some nodes are "Updated" but I'm asking about a way to see change in the number of text bytes; A good example to such tracking would be the Wikipedia article tracking system --- Each time a Wikipedian article changes, you could see the number of bytes changed in it --- If someone adds 219 bytes of text to it, it will be seen in green in the famous "View history" tab. If someone deletes 12 bytes of text from it, it will be seen in red (See attached image from the "View history" tab of a typical wikipedian article to understand me better).

I try to understand if there is a similar mechanism in Drupal that I could use to track byte changes in the nodes of my site, in case someone else enters as admin and change the text of some pages.


texts:
How can I convert this sql query into a Drupal 8 query?

I need all nodes of type 'page' that has not been referenced by nodes of type 'article'. Article content type contains an entity reference field, from where nodes of type 'page' can be referenced.

SELECT *
FROM node_field_data
WHERE type = 'page' AND
node_field_data.nid NOT IN (
   SELECT 1
   FROM node_field_data
   LEFT JOIN node__field_ref
   ON node_field_data.nid = node__field_ref.entity_id
   WHERE type = 'article'
);

I tried with this approach, but it doesn't work:

$sub_result = $this->database->query("
   SELECT 1 FROM {node_field_data} n
   LEFT JOIN {node__field_ref} r
   ON n.nid = r.entity_id
   WHERE n.type = :type",
   ['type' => 'article']
);

$result = $this->database->query("
   SELECT * FROM {node_field_data} n
   WHERE n.type = :type AND n.nid NOT IN :query", [
      'type' => 'page',
      'query' => $sub_result
   ]
);

I get this error:

The website encountered an unexpected error. Please try again later.
Recoverable fatal error: Object of class Drupal\Core\Database\Statement could not be converted to string in Drupal\Core\Database\Statement->execute() (line 59 of core/lib/Drupal/Core/Database/Statement.php).
Drupal\Core\Database\Statement->execute(Array, Array) (Line: 625)
Drupal\Core\Database\Connection->query('
      SELECT * FROM {node_field_data} n
      WHERE n.type = :type AND n.nid NOT IN :sub_result', Array, Array) (Line: 87)
Drupal\Core\Database\Driver\mysql\Connection->query('
      SELECT * FROM {node_field_data} n
      WHERE n.type = :type AND n.nid NOT IN :sub_result', Array) (Line: 141)
...
...
...


texts: Do we have Node Reference : Representative node similar to the Taxonomy term: Representative node

texts:
Using Taxonomy term: Representative node we can get a node that represents a taxonomy term. Similarly is there a way I can get a node that represents a particular node reference field.

Use Case : I have two content types College and Teacher. For each college, I want a teacher who was recently added to the college.


texts: Pages are not searchable by Google anymore

texts:
After migrating my Drupal website to WebHosting, I noticed that my pages aren't searchable by Google. It finds nothing, even though it should clearly find my website. Same thing happens when I want to know the ranking of my website. I haven't used the Pathauto module yet, but I think it should find the domain main page at least.

Do you know where the fault could be?


texts: Entity Field Query - Most efficient way to get authors of nodes

texts:
I have a content type which contains fields which I am filtering my results on. Of these results, I wish to get the email address of the user who authored the node.

Currently I am using an Entity Field Query to get the list of nids. There can be thousands of matching nodes.

To get the email addresses of the authors of the nodes I do a node_load_multiple with the nids of my EFQ, and then a user_load_multiple with the uids of those nodes.

Is there a way to cut out a few of those steps with EFQ? Or will performance not be as big of an issue as I think it is?

Here is a code example:

$query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node')
        ->entityCondition('bundle', 'application')
        ->propertyCondition('status', 1)
        ->fieldCondition('field_one', 'value', $value1)
        ->fieldCondition('field_two', 'tid', $value2)
        ->fieldCondition('field_three', 'tid', NULL, 'IS NOT NULL');
  $result = $query->execute();

  if (isset($result['node'])) {
    $nodes = node_load_multiple(array_keys($result['node']));
    $uids = array();
    foreach ($nodes as $node) {
      $uids[$node->uid] = $node->uid;
    }
    $users = user_load_multiple(array_keys($uids));
  }


texts:
I've built a couple of custom entities in Drupal 8

Vendor, defined as such:

/**
 * Defines the vendor entity.
 *
 * @EntityType(
 *   id = "vendor",
 *   label = @Translation("Vendor"),
 *   module = "vendor",
 *   controllers = {
 *     "storage" = "Drupal\vendor\VendorStorageController",
 *     "render" = "Drupal\Core\Entity\EntityRenderController",
 *     "form" = {
 *       "default" = "Drupal\vendor\VendorFormController",
 *       "delete" = "Drupal\vendor\Form\VendorDeleteForm"
 *     }
 *   },
 *   base_table = "vendor",
 *   uri_callback = "vendor_uri",
 *   translatable = FALSE,
 *   fieldable = TRUE,
 *   entity_keys = {
 *     "id" = "vendor_id",
 *     "uuid" = "uuid",
 *     "label" = "name",
 *     "bundle" = "type"
 *   },
 *   bundle_keys = {
 *     "type" = "type"
 *   },
 *   route_base_path = "admin/vendors/types/manage/{bundle}"
 * )
 */

and VendorType:

/**
 * Defines the vendor type entity.
 *
 * @EntityType(
 *   id = "vendor_type",
 *   label = @Translation("Vendor Type"),
 *   module = "vendor",
 *   controllers = {
 *     "storage" = "Drupal\vendor\VendorTypeStorageController",
 *     "access" = "Drupal\vendor\VendorTypeAccessController",
 *     "list" = "Drupal\Core\Config\Entity\ConfigEntityListController",
 *     "form" = {
 *       "default" = "Drupal\vendor\VendorTypeFormController",
 *       "delete" = "Drupal\vendor\Form\VendorTypeDeleteForm"
 *     }
 *   },
 *   config_prefix = "vendor.type",
 *   entity_keys = {
 *     "id" = "id",
 *     "uuid" = "uuid",
 *     "label" = "label"
 *   }
 * )
 */

VendorType is a config entity and serves as the bundle for Vendor, in exactly the same way that the core Node/NodeType entity types do. I have all the boilerplate code in place mimicking the Node/NodeType relationship.

Everything's up and running, the entities work great in every respect, but I can't figure out a small detail. On the "Content types" admin page, the action links in the right hand column of each row have the "Manage Fields/Manage Display/etc" links, plus the usual "Edit/Delete" as inherited from EntityFormController::actions().

On my VendorType overview form, I only see the Edit and Delete links, not the field-specific ones.

(ignore the missing delete buttons, those particular types can't be deleted; the delete link shows up for manually added types)

I've tried to track it down but it seems like the node module is getting these links added for "free" as it were, without implementing anything explicitly to add them.

What do I need to do to take advantage of this little nicety and get the field-specific links added automatically for my own entity types?


texts:
I realise that having the .htaccess file in the root of my installation is probably the way the program is designed to run, but I was having some difficulties accessing the site, and then fixed the problem by deleting the .htaccess file in the root. But then it made me wonder if this was a good idea to leave my Drupal 7 installation without a .htaccess file in the root at all.

Is there any security or operational problems if I do not have any .htaccess file in drupal root? I imagine that I would have to put it back in order to enable clean URLs.


texts: Responsive Layout of multi-page website in Adaptive Theme

texts:
I've read the book 'responsive web design' by Ethan Marcotte over the week & gone through the documentation on Adaptive Theme website, however, I'm confused about how to take responsive theming forward in Adaptive Theme when I have multiple web pages with their own CSS files.

From the documentation on Adaptive Theming, we have to split the CSS for each layout into its individual file (responsive.smartphone.landscape.css; responsive.desktop.css). Does that mean, we would have the full site CSS in one file for responsive.desktop.css? (! surely thats not right).

The way we have done thus far (in its current form, website is not responsive) is that there are small CSS files for each different regions/ areas of the page. In addition to this, we have custom modules with their own CSS files. How would we go about taking this mass of CSS files & distributing the code into responsive files in Adaptive Theme?


texts: How to create a button on module configuration page that calls a custom php function?

texts:
I am creating a custom module that has a button on the module's configuration page. When the button is clicked, a custom php function (located in the custom_module.module file) needs to run to perform some task.

How can I create a button on the custom module's configuration page that allows me to click the button to manually run the custom php function?


texts: Responsive Grid in Drupal 7 Views with 5 columns

texts:
I'm trying to build a responsive Views grid in Drupal 7 and bootstrap3 sub-theme.
On Views I am using the Responsive Grid module as format.

In my Views format settings I configured the grid to 5 columns.

In order to support 5 columns in bootstrap I made an addition to my less file, according to this article: https://stackoverflow.com/questions/10387740/five-equal-columns-in-twitter-bootstrap in the answer given by lightswitch05.

My HTML markup created by Views would look like this

...

...

...

...

...

It all works just fine for the 5 column grid in Medium devices Desktops (≥992px) using the col-md-2-4 class.

The problem is for Small devices Tablets (≥768px) using col-sm-4 and Extra small devices Phones (<768px) using col-xs-6.

Since class "row" is already wrapping 5 elements when trying to display 3 or 2 grid columns there is either 2 or 1 element out of the grid row.

So the question is: Is it possible to create a responsive grid with 5 column grid for col-md, a 3 column grid for col-sm and 2 column grid for col-xs, in Drupal 7 Views ?


texts:
I'm trying to launch a Quick Start distro on macOS with MAMP:

[519] : php core/scripts/drupal -vvv --verbose  quick-start

 Select an installation profile [Install with commonly used features pre-configured.]:
  [standard  ] Install with commonly used features pre-configured.
  [minimal   ] Build a custom site without pre-configured functionality. Suitable for advanced users.
  [demo_umami] Install an example site that shows off some of Drupal’s capabilities.
 > demo_umami

Creating file: sites/default/settings.php
18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓]
Congratulations, you installed Drupal!
Username: admin
Password: hIuWCqqnaD-TostT
Drupal development server started: <http://127.0.0.1:8888>
This server is not meant for production use.
One time login url: <http://127.0.0.1:8888/user/reset/1/1560664888/oDldybNCOH_0nRc1n4YXZWm2NwEehXnN63rWHq_Isqo/login>
Press Ctrl-C to quit the Drupal development server.
Browser command: open 'http://127.0.0.1:8888/user/reset/1/1560664888/oDldybNCOH_0nRc1n4YXZWm2NwEehXnN63rWHq_Isqo/login?destination=%2F'
Server command: '/Applications/MAMP/bin/php/php7.2.1/bin/php' '-S' '127.0.0.1:8888' '.ht.router.php'

Unfortunately the given URL returns with HTTP error code 500. Also I added -vvv and --verbose no additional error messages are visible.

When I change from MAMP to OS X standard PHP installation the browser shows:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required '.ht.router.php' (include_path='.:') in Unknown on line 0

Actually there's no .ht.router.php from where I started the quick-start command.

Any ideas?


texts: How to choose the default (or any) CKEditor toolbar?

texts: OK, I'm obviously missing something.  I've installed CKEditor into a D7 site, and all's well.  The only problem is I can't figure out how to specify the toolbar that will come up by default in CKEditor-enabled fields.  I've defined a new toolbar in .../ckeditor/ckeditor/ckeditor.config.js, but I haven't found any place in the site's config options (or the code, for that matter) that let me say that I want CKEditor to put up this particular toolbar.  For that matter, I don't see any way to be able to choose the other toolbars in ckeditor.config.js (like DrupalAdvanced and DrupalFull).  Any clarification out there?  Thanks!


texts:
I'm working on a drupal project and part of it is a sort of "tile overview" page. Its a 3x? grid, with a variable length.
|--|--|--|
|--|--|--|
|--|--|--|
|--|--|--|
 .. .. ..
Sort of like that, I hope you can tell what I'm trying to describe.
Each row of 3 is a field_collection.
Now, each field can be either an image field or a text field. I want the user to be able to choose. How would I implement such a feature?
My solution as of now is to have 6 fields per row: one image field and one text field per each single field. Then the user would be told to only fill in one. If he fills in both, one of them gets ignored (php: isset() priority). Obviously this is far from optimal. What I'm looking for is like a radio button functionality so that when the user has a value set for one of the two possible field types, the other one gets disabled. Or just let the user decide first which he wants and then only display that one.
Help would be much appreciated.


texts:
Including the following code:
<?php print 'This page was last modified on ' . date('j F Y', $node->changed);?>

in node.tpl.php displays the correct information on the site. However, I would like to display it in the footer instead at the end of the content so have moved it to page.tpl.php.
The problem with this is that on the homepage the following is being displayed:

This page was last modified on 1 January 1970

Which is clearly incorrect.
In addition, These error messages are displayed on every page:

Notice: Undefined variable: node in include() (line 201 of /home/mysite/public_html/sites/all/themes/mysite/templates/page.tpl.php).
Notice: Trying to get property of non-object in include() (line 201 of /home/mysite/public_html/sites/all/themes/mysite/templates/page.tpl.php).

How do I include the Page last updated text in the footer of every page?


texts:
I am creating an XML feed (domain.com/content_type/feed).

I looked into RSS Publishing and have turned it off, but do see where I can generate an XML feed: Home » Administration » Configuration » Web services

Is this the correct way?


texts:
When I used an exposed filter the filter selection is passed as name/value pair in the url, for example:

members?field_a=valuea&field_b=valueb

How can I set it up to use more of a "pathauto" style url:

members/valuea/valueb


texts: Drush says "DB credentials are invalid," but my credentials in my settings-local.php are valid

texts:
If I run drush cc all or drush --root=/path/to/my/docroot cc all, I get...

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

If I run drush -vd, in amongst the output I see...

  DB credentials are invalid.

But if I run drush status, the DB credentials look OK.

What might be preventing drush from finding my Drupal site and connecting to the database?

The site itself is working fine.

Versions:

Drush 8.3.2
Drupal 7.67

Output of Drush status looks like...

 Drupal version         :  7.67
 Site URI               :  http://default
 Database driver        :  mysql
 Database hostname      :  10.555.92.12
 Database port          :
 Database username      :  Drupal_User
 Database name          :  my_db_name
 PHP executable         :  /usr/bin/php
 PHP configuration      :  /etc/php.ini
 PHP OS                 :  Linux
 Drush script           :  /home/me/.config/composer/vendor/drush/drush/d
                           rush.php
 Drush version          :  8.3.2
 Drush temp directory   :  /tmp
 Drush configuration    :
 Drush alias files      :
 Drupal root            :  /opt/rh/httpd24/root/var/www/html/mysite/docroot
 Drupal Settings File   :  sites/default/settings.php
 Site path              :  sites/default


texts: Is there a browser-side validation passed event I can listen for?

texts:
Is there a JS event that my own custom code can listen for to determine that client-side / browser validation of a form has passed?
i.e. That no messages like this have occurred: "Please fill in this field" because a field was empty.

If there such an event that can be listened to then my own JS could handle the POST submission and then replace the form with a thank you message, in-situ / in place on the same page.
What I don't want to do is have my code run whether the form submission input by the user is valid or not. In other words I don't want to display a thank you message if they've not given valid data. That's why I need an event to say validation passed.
This to me is a better solution to say "thank you" rather than redirecting to content that can itself be indexed and accessed "outside" of the form submit situation, even if a module like rabbit_hole is used.
Looking for a Drupal 8 or 9 solution for myself but tagged with 7 to encourage answers for those who also might want an answer but for Drupal 7.


texts: "Undefined index: link path in menu_link_save() (line 3113 of /includes/menu.inc)"

texts:
I have a new Drupal installation; when I installed my first module, I got the following error:

  Undefined index: link path in menu_link_save() (line 3113 of /includes/menu.inc). error.

I have seen the line 3113 of menu.inc but I don't understand what happened. The error happen every time I install a custom module.

Does anybody know what the problem is?

This is the code I am using.

function froga_menu() {
  $items = array();
  $items['anunciantes'] = array(
    'title' => 'Editar perfil',
    'description' => 'Editar perfil - Anunciante',
    // 'parent' => array('anunciantes'),
    // 'page callback' => 'drupal_get_form',
    // 'page arguments' => array('form_editar_perfil'),
    'access callback' => TRUE,
    'type' => 'MENU_NORMAL_ITEM',
    'menu_name' => 'main-menu',
    'customized' => 1, // Must be 1 in order to not dispaly the link in any language
    'language'  => 'es', // language is required in order to make the item translatable
  );

  $mlid = menu_link_save($menu_item); // You don't need to receive it in a variable
  $ml = menu_link_load($mlid); // I'm loading $mlid just to display the result and verify it

  return $items;
}


texts: Dependency injection or \Drupal class methods?

texts:
Suppose I have an ExampleService  class and I need a service (current_user) to process my logic. So I have implemented my service like this.

The way 1: DI standard Drupal

namespace Drupal\example_service;

use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\Core\Session\AccountProxy;

class ExampleService implements ContainerInjectionInterface {
    /**
   * Drupal\Core\Session\AccountProxy definition.
   *
   * @var \Drupal\Core\Session\AccountProxy
   */
    protected $currentUser;

    public function __construct(AccountProxy $current_user) {
        $this->currentUser = $current_user;
    }

    public static function create(ContainerInterface $container) {
        return new static(
          $container->get('current_user')
        );
    }
}

The way 2: Use global service

namespace Drupal\example_service;

class ExampleService {
    /**
   * Drupal\Core\Session\AccountProxy definition.
   *
   * @var \Drupal\Core\Session\AccountProxy
   */
    protected $currentUser;

    public function __construct(AccountProxy $current_user) {
        $this->currentUser = \Drupal::service('current_user');
    }
}

What is the difference between these methods?
What is better for performance?


texts: Views to display events with single date events and events with date range

texts:
I have a views view that displays a list of events. These events have a start-date and an end-date. I have two exposed filters, one for the start-date and one for the end-date, so that users can select a date range to view events. The page can be seen here:

KODE Calendar page

The filters check that start-date <= selected start-date and that end-date is >= selected end-date. This works if the event spans several days and start- and end-date falls outside the selected dates.

The question is, how can I include events that have start-date and end-date on the same day?

I tried to have another set of filters and use the and/or functionality, but alas, I was not able to reuse the exposed filter.


texts:
I'm using a custom theme but Seven as administration theme.

How can I override the theme function 'theme_node_preview'?

Notice that theme_node_preview is called in the node form, and it's shown in an overlay. So it's part of the admnistration theme.

I tried to used the generic phptemplate_ prefix but this way of overriding theme functions was removed for Drupal 7.
I tried seven_node_preview from a module and also from the template.tpl.php of my custom theme, but didn't work.
I don't want to create a subtheme of Seven only for this.


texts: Generating an absolute node URL from its node id

texts:
I think the question is self explanatory. I got a node ID and I need to create its absolute URL somehow. I can do this but (I think) this won't work every where in the site:

Node Title

Please correct me if I am wrong.

Is there a function that I can give the node id and returns me back the absolute path of it?


texts:
Looking for a way to change between languages on our site, the Drupal 8s LanguageManager doesn't seem to have a straightforward method for this. We cannot use URL-switching, just want to do this through code.

So we want to go from "en" to "fr" for instance. Is there a method like "setCurrentLanguage" available somewhere?


texts:
I've created a custom Block in Drupal 8 from the UI.

Is there a way to add a custom CSS style to this custom block?
Is it possible, like in Views, to click on CSS and type it in?


texts: Expose two filter blocks from the same view using drupal 7 ?

texts:
I'm not sure how to overcome this. So far I have managed to do it by simply duplicating the view, but this is not a good idea.

The view needs to have two exposed filters. These blocks are styled different and sit in different parts of the site, so they need to be independent.

Is it possible to expose two filter blocks from one view?


texts: How do I manage the meta tags 'title', 'description' and 'keywords'?

texts:
I enabled the Panels module and created a panel page for a page in my site.

How do I manage the metatags 'title', 'description' and 'keywords' for a page generated for this panel page?

Any module to do it?

I need it to do it dynamically.


texts: Field validation error on nodereference field during D6 to D7 migration

texts:
I'm migrating a D6 site to D7.

There are several content types that have cck noderefenrce fields that use referenced views for content types that can be referenced.

When I run the migration, I get a field validation error:

  Field validation error for field: field name: this post can't be referenced.

In the CLI, I've used --user=1 to see if it was a permissions problem, but no luck.

Has anyone experienced this? Any hints or suggestions?


texts: Search API and Facets API with multilingual taxonomy

texts:
I have some taxonomy terms and the settings look like this.

All these terms have been translated.

After indexing the content with Search API and Facets API, the facets are not shown with translation.

Why is it happening?


texts: How do I get both published and unpublished records using entity query?

texts:
How can I get both published and unpublished records for a content type using entity field query?

As per documentation we can filter records by status either published or unpublished. But I need all records irrespective of node status whether is published are unpublished.

 <?php $query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'node')
      ->entityCondition('bundle', 'article')
      ->propertyCondition('status', 1) // only one value accepted here
      ->range(0, 1);


texts: Form api AJAX, reload js in #attached 3 times

texts:
I have a simple form api ajax which does nothing special. In the form I have a js file:

 $form['#attached']['library'][] = 'commerce/cart';

In the js file I put a log console:

function ($, Drupal) {
  Drupal.behaviors.cart = {
    attach: function (context, settings) {
      console.log('aaaa');
  }
});

The log console prints 3 times: "aaaa" after the ajax action is over.
As if the file was loaded 3 times.
If you load the page normally, without ajax, the script runs one time


texts: How to add "null" value in elastic search field if data is empty?

texts:
This might be long , but I am trying to make understand my problem. If a field is having empty data then that field is not coming in elastic search index. I want to print something like empty or null in this case.
My use case. I am having a content type "Engagement" which has a field called "Participants" with field type "Paragraph" and it is referenced to another content type called "Stakeholder". So for each engagement we will have multiple stakeholder values. What I need is to get other field values of stakeholders too. In index we have "+" symbol to get that. The problem we will face here is, since some datas or fields will be empty we will not be able to map the stakeholder.
For eg:- Engagement 1 has 3 paragraphs which is stakeholder content type. Now I will get details of these 3 stakeholders in index. But for some stakeholders some field might be empty. So it will be difficult to map each field values.


texts: Different groups of radio buttons with the same name

texts:
I need to create several groups of radio buttons, grouped by a concept (collapsible) but the radio buttons must have the same name so that the form only sends one selected option among all the groups

Group 1
() Radio 1
() Radio 2
() Radio 3
Group 2
() Radio 4
() Radio 5
Group 3
() Radio 6
() Radio 7

I am developing a shipping method of commerce_shipping
This form is for choose a shipping service details, therefore I only generate a part of the form of the checkout page in the function that defines the details of the service, using the commerce_shipping API.
I test to set the #name property for all radio buttons but I lose the form tree, and I need to keep it so that another function can receive the data. Being inside commerce_shipping I do not have absolute control either.

The question is: What Form API elements should I use?

I tested

$form['group_1']  = array (
  '#type' => 'fieldset',
  '#title' => t('Group 1:'),
  '#container' => TRUE,
  '#collapsible' => TRUE,
  '#collapsed' => FALSE,
);
$form['group_1']['radios'][] = array (
  '#title' =>  'Radio 1',
  '#type'=>'radio',
  '#return_value' => '1',
);

But ther resulting radio button name is group_1][radios][0] and the next is group_1][radios][1], as the name is different then they are not part of the same selection


texts:
I'm trying to find out how to set a canonical url on certen pages/articles on a drupal 8 installation.
Metatag module, have the option for setting the canonical URL but is a general setting not specific for every page/article.
Does anybody know how to solve this?
Thank you!


texts: Can I make a search that shows all results, regardless the user's permissions?

texts: We have a knowledge base with very strict user access permissions. We want users to be able to see all pages in search results, even the ones that they can't access. We want users to be able to see if the content they are interested exists and ask for permission.


texts: Downloaded Drupal 8 with composer, now what?

texts:
I'm a complete Drupal newbie trying to install Drupal 8 for the first time on a new server.  I downloaded the software following the instructions in section 3.5 of the User Guide, but there doesn't seem to be a next step.  Section 3.6 seems to be an alternate method of downloading, and nothing in 3.7 seems to be a continuation of 3.5.  How do I get back on track?

Further information:  In 3.7, it says to go to the URL I set up for the site.  When I do this, I get an index of the directory with these files and directories in it:

LICENSE
README.md
composer.json
composer.lock
[DIR] drush/
load.environment.php
[DIR]   logs/
phpunit.xml.dist
[DIR]   scripts/
[DIR]   vendor/
[DIR]   web/

I'm installing on Ubuntu 18.04 with Apache 2.4, MariaDB 10.1 and php 7.2.


texts:
I have dynamic route: from this example

/**
 * @file
 * Contains \Drupal\example\Routing\ExampleRoutes.
 */

namespace Drupal\example\Routing;

use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

/**
 * Defines dynamic routes.
 */
class ExampleRoutes {

public function routes() {
  $route_collection = new RouteCollection();

  $route = new Route(
    // Path to attach this route to:
    '/example',
    // Route defaults:
    array(
      '_controller' => '\Drupal\example\Controller\ExampleController::content',
    '_title' => 'Hello'
  ),
  // Route requirements:
  array(
    '_permission'  => 'access content',
  )
);
// Add the route under the name 'example.content'.
$route_collection->add('example.content', $route);
return $route_collection;
}

}

the problem here is: the route is not automatically updated (or accessible)
until i clear cache, then it works.

question is: how to make the new created route immediately works?
*i try to avoid clear cache command (which i don't think this is the right solution)

Thanks


texts:
I may be running into two conflicting methodologies here.

Basic Drupal theme philosophy is to sub-theme and only change what is different from the sub-theme.

I am using taxonomy hierarchy and theming their views slightly different.

Taxonomy       Theme
--------       -----
Zone           MyBaseTheme
-Arts          ArtsTheme (change the header image)
--Dance        ArtsTheme (change the header image)
---Company1    Comp1Theme (change the header image and menu items)
---Comapny2    Comp2Theme
--Theater      ArtsThee
---Thespians1  Thesp1Theme
---Thespians2  Thesp2Theme
-Sports        SportsTheme
--Boys         SportsTheme
---Football    FootballTheme
---Baseball    BaseballTheme
--Girls        etc
---Field Hockey etc

This would seem to mean the I could subtheme off of zen then only make some minor changes for each.  Common stuff such as font size and spacing would be done in MyBaseTheme.  Zen seems to use a large font for instance so I want to make it smaller.

I could change the banner images in each sub-theme off of MyBase.

So far so good except...

Zen seem to want to use the SASS methodology for CSS coding.

Copying Starter Kit stuff is getting me whole copies of every CSS attribute for every sub-theme.  I don't want copies, I want inheritance.

Anyone ever run into this problem?  Thoughts?


texts:
I've got an issue after I installed entity_token module (Drupal 7)

Now I can't really open admin interface in Drupal that contains tokens.

That is how tokens are displayed without entity_token

That what happens after I install this module

I've google a bit about it and what I only found is that:
https://www.drupal.org/node/1203018
https://www.drupal.org/node/1058912
https://www.drupal.org/project/token_tweaks - sounds like a module that fix this issue (which logically for me sounds really wrong, module that fix another module).

My question is what to do :)
Please suggest if I've to go with module or patch or there is better way to fix it.


texts: Teaser of full html pages without layout

texts:
I have a block/view that shows teasers of the latest 3 articles.. This articles are full html, it contains layout (build with a WYSIWYG)..

On the homepage, I create a block that shows the latest 3 articles.. I can give it CSS-layout..

But because it's build with the WYSIWYG, there are extra html-tags (span, a, p, ...) in the teaser, which can be different every time. The problem is that it overwrites the default layout for the teasers..

I just want to keep the clean text on the frontpage block, and full-html on the detail page. How can I manage it?

Normally I should use strip_tags(); in PHP to remove html.. But how can I do it only for that specific block?


texts:
I want to enable access comments, post comments, and post comments without approval for anonymous using drush.

Fresh install, the table entry look like this:

INSERT INTO `permission` VALUES (2,2,'access comments, access content, post comments, post comments without approval',0);

After access comments, post comments, and post comments without approval enabled for anonymous, it looks like this:

INSERT INTO `permission` VALUES (3,1,'access comments, post comments, post comments without approval, access content',0);
INSERT INTO `permission` VALUES (4,2,'access comments, post comments, post comments without approval, access content',0);

I can use drush variable-set error_level "0" to change error reporting level. But how about above case? It looks more difficult to understand


texts: How to combine views exposed filter with search?

texts:
My client asked me for a single field, that would work 2 ways:

Autocomplete filter based on taxonomy.
If site visitor inputs something that's not in taxonomy, full text search should be performed on content's body, and appropriate info message shown.

That way if user enters category name, he will get hand picked nodes listed, and if anything else, he will at least get some content.

Separately, it's easy. But how to combine these behaviours in one field?


texts: Can I check a file's properties before saving it with system_retrieve_file?

texts:
My understanding of system_retrieve_file is that it saves the file temporarily first. Is it possible to check this file and if it passes, then save it?

I've only used this function like below.

$image = 'http://.jpg';
$file = system_retrieve_file($image, 'public://images/', TRUE, $replace = FILE_EXISTS_REPLACE);

Thanks


texts:
How do I load a view programmatically passing a language attribute?
Tried with module_invoke and views_embed_view but none of them worked;
Data is returned but not filtered by language;

Please advise.
Thank you!


texts:
I installed Drupal Chat just to try it out. I couldn't get it to work and now I can't disable the module.

In /admin/modules, the check box is selected but not enabled. i.e. it is active and I can't deactivate it.

Can anyone help me?

(and, once disabled, how can I un-instal it?)

Update: I forgot to mention that there are no dependencies on the module.


texts: Missing config/default directory error after patching the latest critical vulnerability

texts:
After hearing about the latest Drupal Critical Security warning, I went ahead and updated the following packages in my composer.json file.

drupal/core from 8.5.8 to 8.5.11

drupal/jsonapi from 1.7 to 1.25

drupal/metatag from 1.4 to 1.8

drupal/paragraph from 1.2 to 1.6

The composer installation process went fine, but when I ran drush updatedb I started seeing this error in the output:

$ drush updatedb
The directory /mnt/www/html/my_project/docroot/../config/default does not exist.                   [error]
Requirements check reports errors. Do you wish to continue? (y/n): y
No database updates required

I've never had a config/default directory before so I don't know why it is complaining about it now. I also don't notice any adverse effects in my actual CMS, all the pages and forms seem to be working just as they did before the upgrade. When I run this drush command, I also don't notice any new errors/warnings in the logs.

What is causing this error and how do I resolve it?


texts: Need help with my form with duplicate file and resetting form

texts:
Need help with my form for uploading an image on my theme's settings. I have a form that uploads an image that can be used as a background image. I have two problems with my form: first is how to delete the uploaded file or reset the form and second is an error message appears when uploading the same file again after resetting the theme's settings.

This is my form code I'm using:

<?php function tsaudio_form_system_theme_settings_alter(&$form,&$form_state) {

$form['slideshow'] = array(
'#type' => 'fieldset',
'#title' => t('Background'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);

$bg_path = theme_get_setting('bg_path');if (file_uri_scheme($bg_path) == 'public') {
$bg_path = file_uri_target($bg_path);
}

$form['slideshow']['bg_path'] = array(
'#type' => 'textfield',
'#title' => 'Path to background image',
'#default_value' => $bg_path,
'#disabled' => FALSE,
);

$form['slideshow']['bg_upload'] = array(
'#type' => 'file',
'#title' => 'Upload background image',
'#description' => 'Upload a new image for the background.',
);
$form['reset'] = array(
'#type' => 'markup',
'#markup' => '<input type="reset" value="Reset All Values" class="form-submit">',);

$form['#submit'][] = 'tsaudio_settings_submit';}
function tsaudio_settings_submit($form, &$form_state) {
$settings = array();
// Get the previous value
$previous = 'public://' . $form['slideshow']['bg_path']['#default_value'];

$file = file_save_upload('bg_upload');
if ($file) {
$parts = pathinfo($file->filename);
$destination = 'public://' . $parts['basename'];
$file->status = FILE_STATUS_PERMANENT;

if(file_copy($file, $destination, FILE_EXISTS_REPLACE)) {
  $_POST['bg_path'] = $form_state['values']['bg_path'] = $destination;
  // If new file has a different name than the old one, delete the old
  if ($destination != $previous) {
    drupal_unlink($previous);
  }
}
} else {
// Avoid error when the form is submitted without specifying a new image
$_POST['bg_path'] = $form_state['values']['bg_path'] = $previous;}

}?>

And this is the error message I get when uploading the same file again after resetting the theme's settings to default.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062
Duplicate entry 'temporary://ctrldailybg4_1.jpg' for key 'uri':
INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize,
status, timestamp) VALUES (:db_insert_placeholder_0,
:db_insert_placeholder_1, :db_insert_placeholder_2,
:db_insert_placeholder_3, :db_insert_placeholder_4,
:db_insert_placeholder_5, :db_insert_placeholder_6); Array (
[:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] =>
ctrldailybg4.jpg [:db_insert_placeholder_2] =>
temporary://ctrldailybg4_1.jpg [:db_insert_placeholder_3] =>
image/jpeg [:db_insert_placeholder_4] => 1344028
[:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] =>
1436760809 ) in drupal_write_record() (line 7316 of /homepages
/9/d539887599/htdocs/towersignal_com/includes/common.inc).


texts: View for the user followed by the author of a node

texts: I have installed the Flag module, and I have a view that displays how many followers (flags) an author has. How do I reverse that query, and output how many users that author is following?


texts: List Drush specific add ons, plug ins, extensions, or modules to use drush dl in automated script

texts:
I'm writing a really basic bash script and want use drush dl to download the Drush extras add on.

drush dl drush_extras

But I need to check whether drush extras is installed before I try to install it (and then use it) because it prompts the following text.

  Install location C:\cygwin64\home\USER/.drush/drush_extras already exists. Do you want to overwrite it? (y/n):

How do I determine whether a drush add on/plug in/module (not sure what you call it) exists? So I handle that use case?

I'm trying to automate configuration, starting with assigning blocks to regions, and I have to make it work on Windows (first) and Linux. So I'm using Cygwin and Drush on Windows. There's probably different approaches, but this seems OK.