texts: How does one pull the value of a field into the html.tpl.php file

texts:
I populated a field on all nodes and all tax terms with a specific value pulled from a taxonomy list.
The field name is the same on both nodes and tax terms. For example field_genre.
How can I pull this value into the html.tpl.php file, on both nodes, tax pages and views pages?


texts: Expose and/or operators in Views exposed filters?

texts:
How do I expose (to the user) the and/or operators in a set of exposed view filters?

In other words, how do I let the user change the way the search filters interact with each other?

I don't see this option in the built-in settings or in the Better Exposed Filters module.


texts: How to define path in anchor tag in blocks?

texts:
I'm working on localhost server and I added an anchor tag like below in block.

Contact

In front page it goes to the path directly, but if it is other than front page, it added the current path also, for example

http://localhost/r4launch/content/contactus

It add the "content" in front of the path, then it return "page not found".

how to define path in anchor tag ? or is that anything I'm missing ?


texts:
I've looked here: https://www.drupal.org/project/views_rules but can't get past 2.2 Add a "Rules" display.

I don't know what that means. I've installed Views Rules but can't find any Rules option anywhere in my Views.


texts: How do I increase time of slide in jcarousel?

texts: I want to increase the timer of the slide by 4 seconds so that each slide should be visible for 4 seconds. How can I do this?


texts: URL redirect module working fine with nodes not with alias url's

texts:
I am new to Drupal. I have installed URL Redirect module and tried the following.

Source URL: testwebsite.com/how

Redirect URL: testwebsite.com/how-to-do

Its get stored with node id instead actual URL.

Source URL: http://www.testwebsite.com/node/123545

Redirect URL: http://www.testwebsite.com/node/134566

When I tried to call with node URL its redirecting fine. But when I call testwebsite.com/how it doesn't redirect.


texts: How to send a vote using Advance Poll and Services Voting Api?

texts:
I need to expose a poll to a mobile app. After doing some research I found out that I could receive the votes, through a web service, using the services_votingapi module, and the go-to poll to use was advpoll, or Advance Poll.

I've made a poll with several choices and added, in a services endpoint, the select_votes and set_votes services for votingapi. What I can't figure out now is how to send a vote using the service? there's some documentation at https://www.drupal.org/node/2145873 but I don't know the correct values to send. How do I know the correct entity ids, etc.?


texts:
How do i programatically reset the values of an AJAX submitted form for Drupal 8? I Want to reset them with an AJAX callback. Here is my current callback. It works because i'm forcing the values to NULL.

      public function resetFormCallback(array &$form, FormStateInterface $form_state) {

          $form_state->clearErrors();
          $form_state->setRebuild(TRUE);

          $form['address']['#value']    = NULL;
          $form['customer']['#value']   = NULL;
          $form['name']['#value']       = NULL;
          $form['email']['#value']      = NULL;
          $form['location']['#value']   = NULL;
          $form['zip_code_1']['#value'] = NULL;
          $form['zip_code_2']['#value'] = NULL;
          $form['phone']['#value']      = NULL;
          $form['subject']['#value']    = NULL;
          $form['message']['#value']    = NULL;

          return $form;
        }


texts:
What would be the best option for achieving following:

I need to have a background color blue under website and the body of the website (including all regions) would be white. Best for demonstrating would be to visit this site

  http://www.prevention.com/health/healthy-living/50-healthiest-eco-spas-america

By default alpha-default-normal-12.css contains rule for body min-width: 960px. I can solve it by changing body width to width:960px and adding margin: 0 auto;.

However after switching to fluid layout, width is taken from my global.css and it of course restricts layout to be fluid.

My question is what would be best way to achieve this without editing other css files. Or is it ok to edit them?


texts:
I am creating a titanium mobile app that consumes and uses Drupal Services. I'm able to create a node but the user is always anonymous. I've tried setting the request headers so that the Authentication is basic.

authstr = 'Basic ' +Titanium.Utils.base64encode('admin'+':'+'password');
xhr.setRequestHeader('Authorization', authstr);
xhr.setRequestHeader("Content-Type","application/json");
xhr.send(JSON.stringify(params));

For some reasons it still gives me;

  Code=3 "Authentication needed"

What is the best way to troubleshoot this? Is it even possible to use sessions in this manner?


texts:
Let's say i have two node types:

Article - with 300x300 photo
News - with 100x100 photo

For now, i can define those two sizes in Image Styles menu and they'll be both created for both content types (so both Article and News will have two images generated - in size 300x300 and 100x100).

My question is - is there any way to set which content type shoud use which image style(s) ? Please note that i'm not interested in generating both of them and displaying just one. It would kill my server and my wallet (i'm using Amazon s3). Thanks in advance.


texts: View does not pick up webform submission is from url

texts:
I have created a block that is to print out the currently displayed webform submission. The problem is that it does not pickup the submission id from the url. It is always displays submission id 11 regardless of what submission you are looking at. Can anyone tell what the problem is how to fix it?

The Details: this is for Drupal 7.19 and using views. My block is set up the following way:

Contextual Filter: Content Nid
Filter: Content NID = 33
Fields: Content NID
        Web submissions: Sid
        Global Custom Text

In global custom text I try and read the nid and sid fields using tokens. The block is only displayed when you view a submission of a specific webform (in this case: webform with node id 33).

Please help as I am desperate here.

Thanks


texts: read webforms fields in a mobile app and write submissions to the site database

texts:
I have a courses site where students take online courses and then take exams and get their certificates.

The courses content type has an entity reference to "Lessons" content type which has a further reference to Exams content type ( Webform).

The progress of user is being stored in a custom table in database.

Now we need to build a native mobile app with login / registration, and taking courses and exams features. (user registration / login  and progress should be synced with site database)

Any ideas to start with? Custom API, web services or reading and writing to database directly.

thanks


texts:
I created a view page; it displays titles and images from the photoset content type. Some of these nodes have a view block.

How can I highlight items on general page with view blocks?
For me it's enough to add some classes to these items.


texts: Export a sqlite database through drupal admin?

texts: I have a drupal site running on sqlite. I'd like to backup the entire sqlite db, but keep running into "reading secure data from server" issues on my server. How do I go about backing up just the sqlite db from within the drupal admin area?


texts:
I need to create a dependent drop down like, with values that are loaded with AJAX depending from the value selected in another dropdown.

What could should I use in Drupal 6 that is equivalent to the following one?

 $form['sandbox_ajax_dropdown']['province'] = array(
    '#title' => t('Province'),
    '#type' => 'select',
    '#options' => _load_province(),
    '#ajax' => array(
      'event'=>'change',
      'callback' =>'sandbox_ajax_dropdown_city',
      'wrapper' => 'city-wrapper',
    ),
  );


texts: allow only the author of the comment node

texts:
I want to make an option to subscribe to news within the node, node - it's maintenance team that adds news. I decided to do with the comments as flag in this case does not fit. Everything seemed to be fine, I can add the required fields in the form of comments and install the Node notify that and give the ability to subscribe to a node. But then the question I give the ability to add comments to the author node and not the whole role, and I need to limit the addition of the comment and make only the author can add nodes. anonymous and everyone else can only view and subscribe.
Sorry for my English. Thanks for any help!


texts: How Can I Enable a Multi-Lingual Catalog Block on Drupal 6.32 + Ubercart 6.x-2.13

texts:
Description of Problem

No matter what I try, I cannot get my Ubercart Catalog Block to change languages when I use the Language Switcher.  You can test this behaviour for yourself at:

holistichorsecare.com/zh/products/aromadog-arf-ritis-pain-relief-1oz

Regardless of the language context (English or Chinese, "en" or "zh-hant"), the shopping cart block on the left margin of the page, under all circumstances, displays this text:

Shopping cart

There are no products in your shopping cart.

0 Items   Total: HK$ 0.00

Go ahead and give it a try.  Load the page and click on English or Chinese as they appear in the page header.  The shopping cart block does not change languages- and I'd like it to.

The Localization Files are Installed - I Think...

I've installed the following localization strings packages using the Administration front end and they appeared to be loaded correctly.

ubercart-6.x-2.13.zh-hant.po
uc_ajax_cart-6.x-1.0.zh-hant.po

Checking out the Module Code

Looking into:

holistichorsecare.com/www/content/sites/all/modules/ubercart/uc_cart/translations/zh-hant

I see the following entry around line 1926:

msgid "There are no products in your shopping cart."
msgstr "ä½ (å¦³)ç
                 è³¼ç©è»è£¡æ²æä»»ä½åå."

(the garbled text is the multi-byte characters breaking up in my shell)

Looking into

holistichorsecare.com/www/content/sites/all/modules/ubercart/uc_cart/cart.module

I see the following call around line 706:

$output = '
'. t('There are no products in your shopping cart.') .'
';

So it appears that there is a call to t() to translate the string, but none is forthcoming from whatever system there is that serves up the alternatives.

Can someone please tell me where I need to go in the administration front end to enable localization/translation for the shopping cart block (ajax cart) in Ubercart?

I'm thinking I just missed a check box somewhere to turn on the translation, or have to tell Drupal/Ubercart that the strings in the Shopping Cart Block are to be translated, but I don't know where to go or how to do this.

P.S.:  When I called i18n_get_lang() in troubleshooting code I got the right answer back (i.e. "en" or "zh-hant"), so the system knows what language context it is in.

Thank you.


texts:
To avoid bulk private messaging by spammers in busy Drupal 6 community site, I'd like to limit the messages an authenticated user can send out in certain time span.
I saw Private Message Limits but it is still in dev since 2011 hence it may  not be ready for production. So I'm wondering what is the best way to apply the limit? Thanks


texts:
$result = db_query("SELECT {node}.title, {content_type_answer}.field_question_nid, {content_type_answer}.nid FROM {node}, {content_type_answer} ORDER by nid ASC LIMIT %d, %d", 0, 3);
while($ref = db_fetch_object($otvet)) {
    $otvets[] = array($ref->field_question_nid, $ref->nid, $ref->title);
}

I have 2 content types: 1. question, 2. answer.
In {content_type_answer} i have a nodereference field - field_question_nid that gives me the node id of the referenced question and {content_type_answer}.nid - gives me the answer node id.

But the problem is in title, {content_type_answer} table doesn't has a title row. In a code above i've succesfully selected title row from {node} table :D But how to make condition - i need only {node}.title from nodes which have {content_type_answer}.nid?


texts: How to load a taxonomy term (or entity) by field value?

texts:
To load a taxonomy term programatically you can use EntityFieldQuery.

<?php

// Get taxonomy term by field value
$section_vocab = taxonomy_vocabulary_machine_name_load('section');

if($section_vocab) {
  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'taxonomy_term')
    ->propertyCondition('vid', $section_vocab->vid);
  $result = $query->execute();

  ...

}

However, that doesn't load the taxonomy term fields. Adding a field condition to the query$query->fieldCondition('field_id', 'value', '123'); to the query doesn't work as the result is always empty.

Bad solution

So the solution using EntityFieldQuery that I found here https://www.drupal.org/node/1517744 works, but it requires looping through all the terms in the vocabulary (in the worst case) which has a high cost.

<?php

// Get taxonomy term by field value
$section_vocab = taxonomy_vocabulary_machine_name_load('section');

$sectionID = NULL;

if($section_vocab) {
  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'taxonomy_term')
    ->propertyCondition('vid', $section_vocab->vid)
  $result = $query->execute();

  if (!empty($result['taxonomy_term'])) {
    // To load all terms.
    $terms = taxonomy_term_load_multiple(array_keys($result['taxonomy_term']));

    // Look up for the first term with the field value that we want.
    foreach ($terms as $term) {
      // Stop looking if we find it
      $value = $term->field_id['und'][0]['value'];
      if ($value == $IDtoFind){
        $termID = $term->tid;
        break;
      }
    }

  }
}

If the taxonomy term has a field with machine field_id, how can you load the taxonomy terms with a specific value for it?


texts: What is the command that replaces 'drush variable-set'?

texts:
In Drupal 8 the Drush command drush variable-set no longer works.

From reading (here) it appears that Drupal 8 has a new "configuration" system that replaces the old (Drupal <=7) "variables". But what is the new Drush command to achieve the same ends?

Specifically I want to convert the commands:

drush variable-set site_mail someone@email.com
drush variable-set update_notify_emails someone@email.com

to the new Drupal8/Drush8 equivalent...


texts: How to set up webhooks with the Mailchimp module

texts:
I just installed the newest version of the MC module into my D7 instance and was wondering how I can enable webhooks for the lists that I have within the lists tab.

I have already set up a test list on the MC side and created an API key and I see the list populating on the Drupal side so I have that working just fine.

When I go to enable the webhooks feature on my list on the D7 side I get this msg:

You can change this setting back from the mailchimp administrative UI. I then click on enable hooks. Its working to do something but then get hit with: Unable to perform webhook action "enable" for list my-test-list.

I also see that I need to enter a callback URL on the MC side but I'm confused as to what link I need to use there.


texts: How do I call the menu_rebuild function in Drupal 7?

texts:
I would like to call the menu_rebuild() function, but I am not sure of where exactly paste the code snippet.

I can't find the update.php file anywhere in my local instance.

The reason I would like to attempt this is that I deleted all the nodes, but they are still appearing under the menu structure.


texts: How to preprocess output of $user_picture in Drupal 7?

texts:
By default user picture output markup looks like this:

I need change markup of user picture output to something like this:

Remove unnecessary markup. But question is how?

I have read:

The user-profile.tpl.php file won´t be recognized in my Drupal 7 installation

Changing user picture HTML output on user profile

Will be very appriciate for helping me out.


texts: Show name of country in Views summary when using Countries module

texts:
I am using the Countries module (7.x-2.0-beta2) with Drupal 7.12. A Country field is part of a node and a View of all these nodes looks like this:

Place1     United States
Place2     Mexico
Place3     United States
Place4     Canada
Place5     Mexico

The Views summary, with Country field as contextual filter/argument results in the following:

CA (1)
MX (2)
US (2)

I want to get the default or full country name rather than 2-character ISO country code in the summary, but have not managed that despite trying different country field configurations.

I have Googled and not been able fo find a solution. Note that I am using the Countries module, not the Location module. Location:Countries works fine, but I am migrating from Location to Geofield.

Is there a way to obtain the country name instead of country code in the summary?  Preferably without writing code, but I will take all solutions. Thanks.


texts: Is entittyfieldquery result can be loaded into select list?

texts:
Trying to populate select list in VBO action form (basically could be anyform) and using enityfieldquery to get list. By this methods $result object contains node arrays.

Can this array can be loaded into select list directly? or we need to apply node_load_multiple on $results array.

Reason why I am asking is, there are many field and for the select list, only title and nid is enough right?

Are there any workaround for this?


texts:
Is there a way in drupal 7 where you can change a value of a field from the comment form of that node you are commenting on? At the moment I have a comment form within a node which has the same field as that node. When I change that value, it does not update the nodes field but only changes the comment form's field.

Thanks for your help in advance!


texts: How to send user to the billing information page immediately after logging in?

texts: I am creating a subscription site using Drupal commerce. My site uses logintoboggan  to login a user after creating an account. I am planning to create an order programmatically and then redirect the user to the page where they can enter their credit card information and billing information. I have not figured out how to redirect them to that page yet. Any help would be appreciated.


texts: How do I move the "Login or Register to Post Comments" links?

texts:
I would like to move the "Login or Register to Post Comments" link from above the comments to below the comments, yet above the comment form.

I have the link variable available in the preprocess_node hook and I can unset it there, but when I try to add it as a variable with another name, it's not available in comment-wrapper.tpl.php.

I guess I'm asking what the Drupal way is to pass this variable from the node to comment-wrapper.tpl.php. It's important that we copy the variable value instead of manually creating the links in so we have the same value for the login and register links regardless of whether another module has acted/changed them.


texts: system.site.yml not installing correct site settings

texts:
performing D8 install through a custom profile, added a system.site.yml like:

name: 'Portal Manager'
mail: cms-admin@example.com
slogan: ''
page:
 403: ''
 404: ''
 front: /user
admin_compact_mode: false
weight_select_max: 100
langcode: en
default_langcode: en

Its "siblings" system.date and system.cron for example set the correct values upon installation, but the site frontpage and email stays the default..

Any piece of advice?

, thank you


texts: How to migrate a Drupal 7 website to Drupal 8?

texts:
I have installed the Drupal core 7 and worked with it. Now I want to migrate it in Drupal core 8.

I tried a lot of steps already, like replace core files and folders from version 8 to version 7. But it's not working.

Any suggestions about how to upgrade?


texts:
I need to clean up file names on upload. Both for image fields, other file fields and IMCE file manager. The transliteration module is not yet ported to Drupal 8 and the community does not seem to agree on how to implement the core transliteration in Drupal 8.

Do I have to make a custom module for this, or is there a simpler way?

Right now, Drupal 8 seems to allow both spaces and special characters in filenames. I know about the module File (Field) Paths, but it will have to be set up for every file field on every content type. I don't think it will work with IMCE.


texts:
I have created a routing URL like

login.compnay_login_form:
  path: '/u/{company_name}/login'
  defaults:
    _controller: '\Drupal\login\Controller\LoginController::login_form'
    _title: 'Login'
  requirements:
    _permission: 'access content

This works with http://example.com/u/testcompany/login

But I want the URL like http://example.com/testcompany/login for that I write the below routing

login.compnay_login_form:
  path: '/{company_name}/login'
  defaults:
    _controller: '\Drupal\login\Controller\LoginController::login_form'
    _title: 'Login'
  requirements:
    _permission: 'access content'

but it's not working.

Please let me know if any other way to achieve this.

http://example.com/testcompany/login

should call to

http://example.com/u/testcompany/login

may be through htaccess or any other way?


texts:
We are using Drupal 8 and trying to solve this problem: A form shall be presented to website visitors that asks them to submit questions (in our case: concerning nutrition) and give some structured background information like the region the user comes from etc.

The submitted information shall then be transformed into a node of a given content type to make it easier for the editorial staff to edit that question in the backend, add an answer to it and publish the whole thing.

The forms shall be used by anonymous users and we do not want to let them create nodes directly via /node/add - for security reasons on one hand and with regard to the complexity of the creation form which is not needed at that point on the other hand.

I have read this: How to create a node with submissions of a webform? but I am not sure whether that would be a solution to our task. It says: "Hide the toolbar for other users and give them permission to add new content. Lastly, adapt the node form to your needs with a template file and style it with CSS." Would I have to expose parts of the backend to anonymous users and give them the right to create new nodes? We would like to avoid that due to security concerns.


texts: JSON format for creating users with custom fields using services

texts:
I am using Services module to register new users. My registration form has some custom fields like text field, radio buttons and select list. The following is the data I am sending:

{
"name" : "testapi",
"mail" : "test@test.com",
"pass" : "testapi",
"field_name" : {
"und" : [ { "value" : "Prashant TestAPI" } ]
},
"field_contact_no" : {
"und" : [{ "value" : "9898989898" }]
},
"field_user_sex " : {
"und" : [ { "value" : "male" } ]
},
"field_role_s_ " : {
"und" : [ {"value" : "developer"}, { "value" : "tester" } ]
}
}

The other fields like username, password, email and name(textfield) goes through fine but the sex is a radio button and role is a checkbox, those are not getting populated.

If there a specific way of handling those form types?

Update:
I was able to get it to work with the following code.

{
"name" : "apiuser",
"mail" : “apiuser@example.com",
"pass" : "testapi",
"field_name" : {
"und" : [ { "value" : "Prashant TestAPI" } ]
},
"field_contact_no" : {
"und" : [{ "value" : "9898989898" }]
},
"field_user_sex" : {
"und" : "male"
},
"field_role_s_" : {
"und" : ["developer","other"]
}
}


texts:
When users search a member profile using Views autocomplete exposed filter text field, is it possible to link the result values? Suppose we are searching some 'XY' user. The results appear as autocomplete drop-down. When we click on them, we are redirected to the member's description page.

Is linking to autocomplete results possible?


texts: Function for showing thumbnails for nodes with imce

texts:
I am looking for a function, to show thumbnails for nodes.
There are some sized defined in imce and I want to show on of these.

This is my current function which puts out only the large Version of the Image:

if (isset($content['field_image'])) {
    echo render($content['field_image']);
}

What would be a correct Drupal 7 conform function the show the 'medium' thumbnail in the node template?


texts: How to get file fid value in paragraph and view templates

texts:
Hi i am trying to access file fid value in paragraph twig template file but cant access it. Though I can print file uri but I need to access fid of the file

Here is my code in paragraph.pdfdocument.html.twig for printing file uri

{{ file_url(paragraph.field_brochure_file.entity.fileuri) }}

Same way I can print the file url in views template but not able to access fid  in views-view-fields--my_view.html.twig file

{{ fields.field_upload_pdf_file.content }}


texts: Displaying two Content Types in a single view

texts:
I have searched on this topic and have seen a number of answers, but they all seem rather complex for what (I think) is something straight-forward.

Our not-for-profit holds a monthly meeting. There are two primary program elements at the meeting: Presentation and Panel. A meeting will always have exactly one Panel and between zero and two Presentations.

I have created Content Types for Presentation and Panel. Presentation has the fields: Title, Date, Presenter, and Description. Panel has the fields: Title, Date, and Description. I would like to create a view which outputs the following:
Date
Panel->Title
Panel->Description
Presentation->Title
Presentation->Presenter
Presentation->Description

Where the Presentation block is hidden if there are none and repeated if there are two.

I believe the Filter Criteria are set correctly -  Content: Type (in Panel, Presentation)

Under Format->Setting, I grouped by Date.

The problem is that I cannot control the output - the fields all appear, but I cannot order them as desired nor can I format them as desired. The reason, I think, is that the field have the same name in the two Content Types, thus I do not seem to be able to address either directly.

I did try a PHP control to try to see what was happening. I basically created variables for each of the five outputs I want and printed them. Each date resulted in two calls to the print statements: the first print shows nothing for the Panel variables and has the proper values for the Presentation variables, whereas the second print shows nothing for the Presentation variables and has the proper values for the Panel variables. (What puzzles me is that I was only expecting a single print due to the grouping...)

I would appreciate your providing me with some guidance.

Thank you.


texts: Can i reduce my taxonomy menu to a top ten list?

texts: I have generated a taxonomy menu out of one of my vocabularies.  But the menu has way too many items.  I would like to shorted it based on number of nodes attached per term so that i can reduce the menu to the top 10 or 20 and implement a show all link...


texts:
I created a module that looks up some taxonomy terms using taxonomy_get_tree() does some stuff with it and then passes it to a template file.
In that template file i want to display them sorted according to some parameters.

The sorting stuff and all works fine but in the end i would just like to display the term using its standard template. But i can't get this to work, i have the entire term object and what i thought i had to do was something like:

theme('node', array('elements' => array('#view_mode' => 'teaser', '#node' => $term)));

but the array needs a lot more items then i can provide, so isn't there an easier way?


texts: Convert Existing Body Fields To CCK Text Fields

texts:
Hello i have a Content Type that has been using a body field. Now i was wanting to use a CCK text field instead. Is there a way i can convert existing node body fields for this content type to my new cck field?

Thanks

(drupal 6)


texts: Multi-value checkbox within content type

texts:
I simply want to make a multivalue field within my venue content type (music venue)

funky, cool, dive, swank, disco etc.

I want to be able to select those when adding a venue, and then have it display everyone that was checked. I cannot figure this out!


texts: Drupal 7 subtheme location best practice

texts:
I currently have an Omega subtheme located as a subdirectory of the .../sites/all/themes/omega.  I think this location was a requirement for Drupal 6.  Now that we're on Drupal 7, I'm looking for the best practice on where this subtheme should be located.  Does it make sense to add it to .../sites/all/modules/custom/ or maybe create a new directory like .../sites/all/modules/themes/.

Any best practice advice would be great.

Thanks


texts:
I'm building a Drupal 8 site that has a stock quote on every page.  The data for the quote comes from a database.  The requirement is that the stock quote data be refreshed every five minutes and I've nailed down the database update portion of the process.

The other content on each page is highly static and I do not want to refresh the cache every five minutes.  Our Drupal config has cache set at one hour.  We also have Varnish to deal with.

Is it possible to exclude just this one block from cache?  I've tried using the preprocess hook to set max-age:

function mytheme_preprocess_block(&$vars) {
    if($vars['derivative_plugin_id'] == 'stocktickerblock') {
        $vars['#cache']['max-age'] = 0;
    }
}

But this doesn't seem to work.

Thank you


texts: I would like to show Taxonomy menu on Page view ,so i could select different taxonomy terms to show related items with it.It has to exactly like following  link www.techmusicschool.co.uk/courses/index.php


texts: How to display hierarchical listing using Views?

texts:
Using views, I'd like to display a grouping of content, something like the following:

(category name for 1-3)
1. FIRST TOP-LEVEL ITEM
2. OTHER TOP-LEVEL ITEM
3. OTHER TOP-LEVEL ITEM
  3a. CHILD 1 of #3 ITEM
  3b. CHILD 2 of #3 ITEM
    - CHILD 1 of #3b ITEM
(category name for 4-5)
4. OTHER TOP-LEVEL ITEM
5. OTHER TOP-LEVEL ITEM
(category name for 6)
6. OTHER TOP-LEVEL ITEM

Using the Views Tree module, I can at least get the heirarchical relationships to work. However, I lose the ability to 'group' all the parent (top-level) items by their category (a taxonomy term).

If I don't use Views Tree, I can categorize all the items and group them under their respective categories, but I can't display the items heirarchically (I define the parent items using node references (References module for D7)).

Has anyone encountered the need to sort a view like this, and if so, how?? I'm at my wit's end trying to do these two kinds of sorts with Views (I'm really stretching my programming abilities here).


texts:
I was looking in the error logs, and I realized that users cannot view submissions of webforms. I then realized that the webform views webform_analysis, webform_results, and webform_submissions were missing when looking at /admin/structure/views.

For reference, the code that errored out is in views/includes/admin.inc line 2117:

$test = views_get_view($view->name);
if (!$form_state['values']['name_override']) {
  if ($test && $test->type != t('Default')) {
    form_set_error('', t('A view by that name already exists; please choose a different name'));
  }
}
else {
  if ($test->vid) {            // ERROR HERE ($test is NULL)
    $view->vid = $test->vid;
  }
}

If I look on my development environment, they are there on that page. In addition, they are there in both development and production on the file system (the default views files are there, like webform\views\default_views\webform_analysis.inc and so on) and the webform module is enabled. I imported the views as a temporary fix. On production it says the views are in the "Database", while in dev it says "Database Overriding Code" after importing, while before it said "In Code".

I looked at a DB backup in dev from before I imported, and I do not see the issue I see in production. The views are there.

What could cause those (and only those 3) default views to suddenly be completely missing "in code" despite the files being there? And is there a way to get them back to being "in code" rather than in the database (since that's where they are after I imported them)?

Update: I don't have the problem anymore. Perhaps restarting PHP or nginx fixed it? I really have no idea. If anyone experiences the problem and can figure it out, definitely enlighten us.


texts:
I'm attempting to use the token filter programmatically inside a .theme file like so.

function mytheme_preprocess_block(&$vars){
  $token = Drupal::token();
  $vars['label'] = $token->replace('[node:title]');
}

I looked at https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Utility%21Token.php/function/Token%3A%3Areplace/8.2.x for information.
However when I output $vars['label'] all it produces is [node:title] as if no replacement occurred at all. How would I programmatically initiate the token filter?

UPDATE: As a test I attempted using another method of token to make sure anything was happening at all by using $token->scan('[node:title]'); and it did spit out

  array(1) { ["node"]=> array(1) { ["title"]=> string(12) "[node:title]"
  } }

So I know I invoked the token class properly at least

UPDATE: It appears that the token replace was working it just didn't recognize [node:title]. Using [site:name] did produce the expected result. How would I be able to get [node:title] to work? Do I need to supply it with that data?


texts: Update select list options on form submission

texts:
I have a views exposed form which is submitted through ajax.

I have two select list fields. Selectlist Field 1 and Selectlist Field 2.

The form has been submitted on Selecting an option in Selectlist Field 2. So I want to remove some options of field Selectlist Field 1 on this form submission.

I tried the following code.

    if (!empty($form_state['input']['Selectlist_Field_2'])) {
      foreach ($form_state['input']['Selectlist_Field_2'] as $value) {
        $nids = get_nids($value);
        foreach ($form['Selectlist_Field_1']['#options'] as $key => $value) {
          if(in_array($key, $nids)) {
            unset($form['Selectlist_Field_1']['#options'][$key]);
          }
       }
     }
  }

I write the above code in form_alter. But it did not update the Selectlist Field 1 options in the form. I have print out the Selectlist Field 1 options outside foreach and inside the if statement and it prints the updated options.

But don't know why the field is not update in the form on the site.

Am I doing something wrong? Is there any other method?


texts:
I have a setup with views PDF which send email after creating a node. (This works)

For logging purpose I would like the PDF added to my node in a filefield.
Is there a rule action/php code  available to add the saved PDF to the filefield.


texts: I have big data in hook_uninstall(). How to handle this data? Can I use batch in hook_uninstall()?


texts: Adding a region to the individual item pages under a node in the gallery assist module

texts:
I'm trying to force a region into the individual item pages of a node that's using the gallery assist module to be able to display blocks.

I started off making a context and adding the gallery assist content type the context to be able to blocks to the nodes of gallery

but the regions only being added to the main node page and not being added to the individual items pages under the node

for example:

www.testsite.com/gallery-type/main-node-page-title - This is the main node gallery item page looks

www.testsite.com/gallery-type/main-node-page-title/image1 - And this is how the individual items pages under the node are setup

www.testsite.com/gallery-type/main-node-page-title/image2

www.testsite.com/gallery-type/mmain-node-page-title/image3

so is there anyway a region can be added to the individual item pages programmatically, in the admin area or module wise?

This is also the output for the individual item pages:

function theme_gallery_assist_item($item = array()) {

  $output .= '
'."\n";
  $output .= '
nid .'" class="node">'."\n";

  $output .= '
'."\n";
  $output .= '

'. $item->title .'

'."\n";

  $output .= '
'. $item->links .'
'."\n";

  $output .= '
'."\n";

  $output .= '
'."\n";
  if ($item->top == 1 || $item->top == 3) {

   $output .= '
nodetype .' ga-pager clear-block">'. $item->pager .'
'."\n";
  }

$output .= '
nodetype .' ga-image-display" style="'. $item->size_parameters .';'. $item->extra_styles . $item->img_extra_styles .'">'."\n";

  $output .= $_GET['links'] == 'on' ? $item->adm_link : '';

  $output .= $item->img;

  $output .= '
';
  if ($item->top == 0 || $item->top == 3) $output .= '
nodetype .' ga-pager clear-block">'. $item->pager .'
'."\n";

  $output .= empty($item->copyright) ? '' : '
nodetype .' gallery-item-copyright" style="'. $item->boxes_width .';'. $item->extra_styles .'">&copy; '. $item->copyright .'
'."\n";
  if ($item->ptitle) {

  $output .= '
nodetype .' gallery-item-caption-title" style="'. $item->boxes_width .';'. $item->extra_styles .'">'. $item->ptitle .'
'."\n";
  }
  if ($item->pdescription) {

  $output .= '
nodetype .' gallery-item-caption-text" style="'. $item->boxes_width .';'. $item->extra_styles .'">'. $item->pdescription .'
'."\n";
  }
  if ($item->allow_download == 1) {

  $output .= '
nodetype .' gallery-item-download-link" style="'. $item->boxes_width .';'. $item->extra_styles .'">download_path .'">Download
'."\n";
  }

  $output .= '
'."\n";
  $output .= '
'."\n";
  $output .= '
'."\n";
  return $output;
}


texts:
My requirement is that in my custom content type page, I need to add fields that link to facebook and twitter. This is easily do-able as two textboxes which contain the hyperlinks to the two site urls. However the way I want it is that, if there is a facebook URL added, in the display it should show a facebook icon clicking on which will take the user to the facebook URL, same with twitter. (It is not for sharing my page content in facebook, but for redirecting the user to facebook link provided - same with twitter)

I would like these two to be two standard fields in the content type so that added links to these two will trigger this behaviour. If the textboxes are empty, the icons will not show up.

Any pointers on how this can be achieved? I looked at the various social share modules in drupal, but most of them are for sharing/tweeting the page inside which they are added.

I appreciate any help...


texts:
I've been creating my very first module and have got some help here earlier. Now the issue is this: my module only list a maximum of ten (10) nodes.

The module is like a taxonomy term list, which shows nodes with a certain term. Althoug I have hundreds of nodes, and they each have the correct term, no term page shows more then 10 nodes.

If one node is removed, another one gets listed, so the error is somewhere else - but where?

Shortned down code:

function my_module_cmp($a, $b) {
  $a = (array) $a;
  $b = (array) $b;

  return strcmp($a['name'], $b['name']);
}

$term = taxonomy_term_load($tid);
$name = taxonomy_term_title($term);

drupal_set_title($name);

$terms = taxonomy_get_tree(10,0,1);

usort($terms, "my_module_cmp");

$counter = 0;
$result = taxonomy_select_nodes($tid);

foreach($result as $nid) {
  $node = node_load($nid);
  $alias = drupal_get_path_alias("node/$nid");
  $form['company_wrapper'][$nid]['title'] = array (
    '#markup' => '
' . $node->title . '
',
  );

  $counter++;
}


texts: How to enable block "overlay" with a gear

texts:
How to enable the gear in the top-right corner of a block in Drupal 7 as shown in the screenshot below?

I have several Drupal 7 installations with Bartik theme and only one of them has it and I can not find, where to enable it for the others.


texts: Form behavior when form creation data changes

texts:
I've a form which shown from values in the database.

Now next day user fills it in and submits it. But the underlying data has already changed in the database.

I can see that in the validation handler form_state contains data from the form prepared after it is submitted but which contains updated values from other users, while the data submitted by the user is based on 1 day old data and he/she is not aware of changed data.

How does Drupal form behave in the scenario?

For example:

 I load a form and I see one row of data
 Another user comes and adds a new row of data
 I submit 1 row of data I see after checking on the checkbox
 FAPI now rebuilds the form but it now finds two rows instead of one
 In validation handler it sees two rows of data(but I submitted seeing single row)

→ Assume each row is 1 checkbox + textfield

Now I want to give error and ask the user to reload the form and submit again


texts: Module for extracting information from remote site?

texts:
I want to give user better experience when filling in forms. They are prompted to fill information about some product, like price, description, image, etc...

My idea is that I'll let them just copy & paste URL to (for example) amazon and the website will itself pre-fill all the fields (price, description, ...).

So I would basically need set of regular expressions per field, per remote site. This is not a problem, I can cover 90% of our user daily used websites. If this mechanism fails, then user still will be able to fill the information manually.

My problem is that I cannot find any drupal module that is capable of doing something like this. Does anyone know how to (simply) achieve this goal? Or do I have to write a module for this?


texts: Create single exposed filter that does OR filter based on two fields D7 - Views 3

texts:
I have a content type teams and a content type games. Games has two node reference fields: home-team and away-team (that both reference content type teams). I want to create a single exposed filter teams that filters to games where either home-team or away-team matches the selected team.

For those with more experience hacking views - what approach would you take? Should I extend a handler to do this (views_handler_filter_in_operator)? Any pointers?

Or run a db_query and pass the results to a views alter hook?

Any input appreciated.


texts: I want to send mail on webform submission to selected users. Suppose I'm user and admin must select users from my account that if I submit webform, then how many user's can get that notifications of my webform submission via mail?


texts: Adding missing Input Formats after Minimal Install

texts: After a minimal install (v7.22) I've only got the 'plain text' input format and am missing the 'filtered HTML' and 'full HTML' formats. Is there a way to have just the missing formats installed or do I need to manually add them? If I have to manually fill in the details where can I get the information them as after searching I cannot find any details on this.


texts:
On my Drupal 7 site, I am using the Prepopulate module to pre-fill a field based on a parameter in the URL for authenticated users.

An example of a URL is:

  http://website.com/node/add/content-type?edit[field_test][value]=123456

When accessing the URL as an anonymous user, Context shows the login block.

After logging in, it redirects the user back the same URL BUT without the prepopulate info.

Simply something like:

  http://website.com/node/add/content-type

Is there anything that can be done so that the information in the URL is not lost after logging in?


texts: I want to install the eComma 7.x-1.x Drupal module, providing word-wise annotation features. However, its installation instructions do not work in my environment, probably because I have also Panelizer installed and something has to be done different then.


texts:
I have a content type called "Document" where i have a "file" field so i can upload files. I also have comments enable where another users can add a comment and also upload more files.

Whats i would like to do is have a table of all uploaded file in a single table at the bottom of the node.

In Views i am unable to get files upload from the node and comments in one views. Can anyone help with this?

using Drupal 7

Thanks


texts: Print out the contents of node object in a node template

texts: How do I print out the contents of the $node object in a node template in a way that is easily readable. I thought that <?php dpr($node);?> would do it but that doesn't seem to work in my template.


texts: How can I prevent a custom block from rewriting HTML?

texts:
I have a self-contained widget written by a third party that consists of HTML, JS, and CSS. I've dumped it into a custom block with Full HTML (and verified the Full HTML settings are loose enough that they shouldn't conflict with the markup). Also, I'm using CKEditor. When I save the custom block, it turns
 into
&nbsp;
 so that the widget doesn't even get an opportunity to render.
Is there a workaround for this? Is my only alternative to create a custom module?


texts:
I have two pages, on the first page, the user types in an ID. Using hook_form_alter, I then override the submit function and add my own functionality that will then grab information from a database about the id, such as their name and email.

It then directs the user to a second page with empty fields asking for name, email etc. My question is, what is the easiest way I auto-fill these fields with the data fetched previously?

thanks!


texts: After changing a webform multi-select field to single-select, submissions made pre-change show only the first selection

texts:
I've created a webform in Drupal 7 with a component drop-down list.  I selected 'multiple' for multiple selections.  Now, I need to unselect 'multiple' giving users just one choice of the drop-down list.

Now, when viewing the submission data, the past data w/ multiple choices only show the topmost choice.  How can I have the past data show the multiple choices despite I'm allowing only one choice in the component?


texts:
I'm running a D7 core update and all but one database updates pass. The one that doesn't pass gives me the following error message:

Failed: DatabaseSchemaObjectDoesNotExistException: Cannot add field erg_field_data_field_carousel_slide_url.field_carousel_slide_url: table doesn't exist. in DatabaseSchema_mysql->addField() (line 325 of /Applications/MAMP/htdocs/my_site/includes/database/mysql/schema.inc).

I tried running a registry-rebuild, but I still get that error when I ran the update again.

I do have a table in my database called erg_field_data_field_carousel_slide_url. Why would the update be looking for the same table name, but with part of it repeated and appended? And is there any fix?

EDIT: So turns out there was an update for the Bootstrap Carousel module, of course. I'm new to running regular updates, so can anyone provide helpful information about what in schema.inc actually causes this behavior?


texts:
I am creating a custom module that allows for users to create blog posts that will be private and related to a project. So I created a new content_type called "tasker_blog" that just has a title and body. The user goes to view their projects and clicks a link which takes them to 'tasker_project/%/blog' % being the id of the project. I have the form being displayed correctly but when I submit the form I have two problems,
  1) the title is lost on submit
  2) getting this error: EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids().

Here is the code I have written (some non-relevant parts taken out).

function tasker_project_menu() {
    $items = array();

    $items['tasker_project/%/blog'] = array(
        'title' => 'Private Blog Post',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('tasker_project_blog_form',1),
        'access arguments' => array('view tasker projects'),
        'type' => MENU_CALLBACK,
    );

    return $items;
}

function tasker_project_blog_form($form, &$form_state) {
    drupal_add_css(drupal_get_path('module', 'tasker_project') . '/tasker_project.css');
    global $user;
    module_load_include('inc', 'node', 'node.pages');
    $node = (object) array(
        'uid' => $user->uid,
        'name' => (isset($user->name) ? $user->name : ''),
        'type' => 'tasker_blog',
        'language' => 'und',
    );
    node_object_prepare($node);

    $form = drupal_get_form('tasker_blog_node_form',$node);
    $form['hidden_project_id'] = array(
        '#type' => 'hidden',
        '#value' => arg(1),
    );

    return $form;
}

If I submit with nothing else added I get the error I mentioned above. If I add this (using Kint to display variables):

function tasker_project_node_validate($node, $form, &$form_state) {
    s($_REQUEST);
    s($form_state['values']);
    die();
}

$_REQUEST array output:

array (9) (
    'title' => string (4) "test"
    'body' => array (1) (
        'und' => array (1) (
             array (2) (
                'format' => string (13) "filtered_html"
                'value' => string (13) "
test

"
            )
        )
    )
    'changed' => string (0) ""
    'form_build_id' => string (48) "form-eKWwyFlBOzi4LsajaAiEZBG7J0uOSI1UDVIhiDomeJE"
    'form_token' => string (43) "N421-IiWecixBJGbxTHGcJAIrd6ZutzAW0LAtVSsrJ4"
    'form_id' => string (24) "tasker_project_blog_form"
    'hidden_project_id' => string (2) "10"
    'additional_settings__active_tab' => string (0) ""
    'op' => string (4) "Save"
)

$form_state['values'] array output:

array (27) (
    'nid' => NULL
    'vid' => NULL
    'uid' => string (1) "5"
    'created' => integer 1347038959
    'type' => string (11) "tasker_blog"
    'language' => string (3) "und"
    'changed' => string (0) ""
    'title' => string (0) ""
    'additional_settings__active_tab' => string (0) ""
    'revision' => bool FALSE
    'log' => string (0) ""
    'name' => string (10) "ndenlinger"
    'date' => string (0) ""
    'status' => integer 0
    'promote' => integer 0
    'sticky' => integer 0
    'submit' => string (4) "Save"
    'preview' => string (7) "Preview"
    'body' => array (1) (
        'und' => array (1) (
             array (3) (
                'summary' => string (0) ""
                'format' => string (13) "filtered_html"
                'value' => string (13) "
test

"
            )
        )
    )
    //...MORE HERE REMOVED SINCE NOT RELEVANT
)

So I'm not sure if the two problems are related or not. Once the node is saved I am going to add a row to a custom table that store the nid and the project_id.


texts: HTML inside mini-pager navigation control labels

texts:
I'm trying to customize the output of the mini-pager controller (the "next" and "previous" link with arrows) in a view.
Actually, it is possible to insert custom text for "previous"-link in the view pager options, in the "tag" section.
I tried to add inside the form (for a test), this:

The resulting output is

&lt;i class="icon-chevron-right"&gt;&lt;/i&gt;

So actually I think it filters HTML.
Do you think it's possible to include HTML?


texts:
I added a global math expression field to a views(table display) i just want to sub two fields values,but the the result it's not exact what i want.
Example for that(9000 - 5000 = 4).
How can i change the format or something like that to convert the result to 4000?
Thanks.


texts:
I have a hook_form_alter in a module, and it should be firing, but it appears it's not. I've cleared caches and rebuilt the registry. Is there someplace in the database or somewhere else where I can see if my hook is registed? FWIW here is my hook:

/**
 * Implements hook_form_alter
 */
function my_module_form_alter(&$form, &$form_state, $form_id) {
  drupal_set_message($form_id);
}


texts: How do I change template file for the user registration form?

texts: I want to use a different template file for the registration form, but I don't want to use page--user--register.html.twig because in this case I should rewrite all the page structure. We had user-register.tpl.php in Drupal 7, but I couldn't find the theme name in Drupal 8.


texts: fivestar module js breaking my custom js

texts: My problem is when I use five star module on any page my js gets break on that particular page. I don't know what I am doing wrong


texts: Command to install Drupal 9 with Composer

texts:
The latest version of Drupal 8 can be installed via Composer with the following command:

composer create-project drupal/recommended-project mynewproject

What is the equivalent command to install the latest version of Drupal 9 (beta1)?


texts: Get default image directory with styles large?

texts:
My images are saved in folder

sites/all/default/files/styles/large/public/field/image

But to make this future save i dont want to hardwire the path? Is there a drupal function to get the images in a proper way?
I played around with

image_style_url(uri)

But i just need the default dir to pass it to javascript, I dont have image uris yet...

Thanks a lot!


texts:
I have an .htaccess file with Options Indexes FollowSymLinks, my /apache2/sites_available/default file also has these options and AllowOverride All.

If I do these things outside of Drupal it's working (if I go to a directory without an index file, I see a file directory listing), but inside Drupal I'm getting

  The requested page "/sites/default/files/" could not be found.

Also, I am able to to access files within the files directory. For example if I went to /sites/default/files/someFile.pdf... it would be able to access it fine. I want to have it so that if I link to a directory within the files directory and that directory does not have an index file... it will display a directory listing of all the files/folders within. Something like:

http://3.bp.blogspot.com/_rhuioznu6Us/TBmeWAr_G2I/AAAAAAAAAFE/tKCclPXdq2M/s1600/apache.png

I think Drupal is doing something based on the fact that I get my Drupal headers above the message that the page couldn't be found. How do I stop this?

The files below show some of the things I've tried...

apache2/sites_available/default contains:

DocumentRoot /var/www/default
<Directory />
  Options Indexes FollowSymLinks
  AllowOverride All
</Directory>

<Directory /var/www/default/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory>

default/files/.htaccess contains

Options +FollowSymLinks
Options +Indexes
RewriteEngine Off


texts: Looking for a function that searches for nodes

texts: Is there a function in Drupal-7 that looks or searches for nodes that match some criteria (e.g. promoted nodes, published nodes, nodes of a specific content type), rather than using Views?


texts: is form API support uploading of 2 gb of data toftp

texts:
I have one application there we have to upload 2 to 3 gb of data in zip format.
So i wonder drupal support any ftp or sftp client integration in drupal or other approaches is available in drupal please guide


texts:
How can I create a menu link for main-menu which has related subitems?

For example in main-menu I have Home  About  Products and for the Products menu item I want it to put all categories as subitems: Products -> Shoes -> Shirts ...

Is there a hook or an example so you can achieve this?


texts: Drupal 8 - Alter page attachments AFTER form submit

texts:
How do you add a library to page attachments (or perform any other alteration) only AFTER form submission?

Long explanation:

I have a very simple contact form which redirects to the frontpage after submission and displays a "Thank you" message.

I need to trigger custom JS events for Google AdWords integration after form submission. In theory this is very simple, just implement hook_page_bottom and attach library with custom JS code.

However, this library should only be attached after form submission and I can't figure out how to detect whether a page load comes from a form submission. My first attempt was to implement hook_form_alter and add a custom submit handler. However, this submit handler is only fired right after form submission, but not in the next page load, which means that my library doesn't get attached.

What is the Drupal way of this?


texts: Delete or unpublish content from old migration, if source rows no longer exist

texts:
I am using Migrate API to import products from a CSV file that is updated every week or so.

Every time the CSV file is updated,

new products may be introduced
existing products may be modified
old products may disappear

Migrate currently does not seem to have a mechanism to remove or unpublish orphan content from the site, where the source record no longer exists.

See e.g.

Migrate module FAQ: "A negative number means the current source has fewer records than we have cumulatively imported from the source. This could mean that records have been deleted on the source side (there is no built-in support for deleting destination records based on the absence of the corresponding source record)."
Issue #2809433: Migrate support for deleting items no longer in the incoming data, an issue currently in "Needs work".

What kind of solution or workaround could be used to deal with this old content?

"Deal with" could mean one of the following:

Delete "old" entities from the site.
Unpublish "old" entities.
Have a property or field that tells us when an entity was last seen in a migrate source record. This would allow e.g. to filter such entities in Views.

Notes

Please consider that migrations do not always process the complete source data. E.g. you could use the --limit parameter, or manually stop the migration, before all source rows are processed. Of course the typical nightly or weekly migration will process the complete source data. But manual migration runs often do not.

Also consider that a migration will usually not update rows that are unchanged. If we would store a "last import date" in a field, this would cause a lot more entity_save() operations, so it would significantly slow down migrations.


texts: Site flashes intermediate 'Redirecting to ...' page

texts:
On a local development site an intermediate 'Redirecting to ...' page flashes for a second before rendering the correct page. This seems to be happening at various places, even on cron run page.

The culprit may be slow page load. On web profiler I briefly spot a 303 response before the correct page is displayed. Is there a way to fix/debug this?


texts: How to download the projects within a distribution using git, not just the distribution itself?

texts: I've set $options['package-handler'] = 'git_drupalorg'; set in my .drushrc.php file. Now when I run drush make for a distribution (in this case, the 7.x-3.x-dev release of Commons), the distribution itself gets checked out using git, but not the individual projects (modules and themes) within it. How do I also get those projects checked out as individual git repositories? I'm assuming submodules come into play, but what exactly do I need to do to get that working?


texts: Problems arising while adding a new content type

texts:
In my website, I have created 42 different content types. I want to add one more content type. I can create the content type, but I am unable to add content in it.

After creating a new content type, when I click on the link of the new content type, the whole site CSS is getting scattered. After deleting the new content type everything is getting normal.
Secondly, if add any new module the same problem is arising.

I have looked into this matter, and I found that in there are no new database table created when added a nee content type, or installing a new module.

May you please suggest me what could be the problem?


texts: Content export and import / content deployment

texts:
It's easy to deploy configuration of content types, views and so on...

What are the options for deployment of content (nodes) between different environments?


texts: Custom form from user registration form not showing new fields in D7

texts:
I am trying to build a new form from the user registration form and while the user reg parts are appearing the new fields are not. Any ideas? The code is below. I tried having the fields in the primary array level AND under the account parameter.

When the array prints out it shows the parameters are there. So I am having trouble figuring out why it is not working. I am used to doing this in Drupal 6. But in Drupal 7 it is not cooperating.

function custom_reg_company_registration() {
  return drupal_get_form('custom_reg_company_form');
}

function custom_reg_company_form($form, &$form_state) {
  $form = user_register_form($form, $form_state);

  $form['company_name'] = array(
    '#type' => 'textfield',
    '#title' => 'Company Name',
    '#maxlength' => 60,
    '#description' => 'The name of your company.',
    '#required' => 1,
    '#attributes' => array(
      'class' => array(0 => 'company_name'),
    ),
    '#default_value' => '',
    '#access' => 1,
    '#weight' => -10,
  );

  $form['primary_phone'] = array(
    '#type' => 'textfield',
    '#title' => 'Primary Phone',
    '#maxlength' => 30,
    '#description' => 'The primary phone number for your company.',
    '#required' => 1,
    '#attributes' => array(
      'class' => array(0 => 'primary_phone'),
    ),
    '#default_value' => '',
    '#access' => 1,
    '#weight' => -10,
  );

  $form['secondary_phone'] = array(
    '#type' => 'textfield',
    '#title' => 'Secondary Phone',
    '#maxlength' => 30,
    '#description' => 'The secondary phone number for your company.',
    '#required' => 0,
    '#attributes' => array(
      'class' => array(0 => 'secondary_phone'),
    ),
    '#default_value' => '',
    '#access' => 1,
    '#weight' => -10,
  );

  $form['company_type'] = array(
    '#type' => 'radios',
    '#title' => 'Company Type',
    '#maxlength' => 30,
    '#description' => 'The type of company you are setting up.',
    '#required' => 1,
    '#default_value' => 0,
    '#weight' => -10,
    '#options' => array(
      0 => 'Carrier',
      1 => 'Broker & FF',
      2 => 'Shipper',
    ),
  );

  $form['#action'] = url('register/company');

  echo "<pre>" . print_r($form, true) . "</pre>";

  return $form;
}


texts: Can't run database update script, webforms not display webform tab

texts:
We are running Drupal 7.69 under PHP 7.3.13 on Bluehost. Not sure what happened, but when I try to browse to update.php to perform database updates, I get the prompts as expected to update the database and code, and click Continue, but then it just goes back to the home page with no error message displayed.

Webform 7x-4.22 is installed and had been working. When I browse to a node that has a web form, or attempt to create a new web form, I have the standard tabs, including the text lead in), but no tabs displaying for fields for the form.

When I click on Permissions under Modules for Webform, it shows all of the field types checked, and it appears to configured as it has before.

The only errors that I see in the error log seem to be variations on

Warning: Use of undefined constant Y - assumed 'Y' (this will throw an Error in a future version of PHP) in eval() (line 19 of /home3/drenched/public_html/modules/php/php.module(80) : eval()'d code).

Any suggestions on where to look? Kind of desperate to solve this.


texts: How to get field collection value in tpl file in drupal 7?

texts:
I have created a content type and take field collection for some field. Within field collection I have taken 4 select box. Now I need to get these select box value in content type tpl file. For this I am using this code : $wrapper = entity_metadata_wrapper('node', $node_data);

but its not giving me select box option value.


texts:
This is my form class:

<?php
/**
 * Created by PhpStorm.
 * User: haris
 * Date: 2/23/18
 * Time: 2:43 PM
 */

namespace Drupal\poet_plugin\Form;

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

class PoetForm extends FormBase
{
    public function getFormId() {
        return 'poet_plugin_form';
    }

    /**
     * {@inheritdoc}
     */
    public function buildForm(array $form, FormStateInterface $form_state) {
        $form['frost_url'] = array(
            '#type' => 'textfield', //you can find a list of available types in the form api
            '#title' => 'Frost URL',
            '#size' => 50,
            '#maxlength' => 1000,
            '#required' => TRUE, //make this field required
        );
        $form['token'] = array(
            '#type' => 'textfield', //you can find a list of available types in the form api
            '#title' => 'Frost Token',
            '#size' => 50,
            '#maxlength' => 1000,
            '#required' => TRUE, //make this field required
        );

        $form['save'] = array(
            '#type' => 'submit',
            '#input' => TRUE,
            '#value' => 'save',

        );
        return $form;
    }

    /**
     * {@inheritdoc}
     */
    public function validateForm(array &$form, FormStateInterface $form_state) {

    }

    /**
     * {@inheritdoc}
     */
    public function submitForm(array &$form, FormStateInterface $form_state) {
        $url=$form_state->getValue('frost_url');
        $token=$form_state->getValue('token');
        $connection = \Drupal::database();
        $connection->insert('token_url',['frost_url' => $url,'token'=> $token]);

    }
}

When I submit the form the submitForm function does not get called. What I am missing here?


texts: Views: how to override a linked "Content: Title" field's href programmatically?

texts:
I would like to override a Views-generated block's "Content: Title" field's href path (linked to nodes with "Link this field to the original piece of content") to append a query string ($_GET['page']).

An example:

this is the generated link:

Blabla

I would like this one:

Blabla

I would like to override the path and append a query string before it gets rendered as an HTML-link ().

How should I do this? I think Views uses views_handler_field_node::render_link() and views_handler_field::render_as_link() which calls function l() or sg. like that which should be overridden. Of course, overriding theme_link() for modifying ALL the links is not a good way.

Here's an export of the simplest possible block view for Articles with pager id 3; the titles are linked:
http://pastebin.com/tmq0kZwT
I want to override the title links of this list to append a query string (to remember the actual pager when clicking on a node).


texts:
I need to add a custom function to the Confirm Order button on a Commerce Checkout form. I can't figure out how to call it. The button ID is #edit-continue and its displayed text is Confirm Order. I thought this would show up in the $form[submit] array, but that array is empty. So I checked $form['buttons']['continue']['#submit'], which  seems to be where Drupal Commerce stores the submit functions.
I created a module and two functions.
function MYMODULE_form_commerce_checkout_form_checkout_alter($form, $form_state, $form_id){
   drupal_set_message('ALTERING CHECKING OUT! THIS WORKS' . $form_id);
   $form['buttons']['continue']['#value'] = 'Send Me A Quote!';
   $form['buttons']['continue']['#submit'][] = 'MYMODULE_submit';

function MYMODULE_submit_function($form, &$form_state) {
  die('Triggered submit');
}

drupal_set_message() shows the message, but the submit function isn't invoked, and the text in the button is not altered. So clearly, the problem is that I am not targeting the button properly. How do I "address" that button?
To make it clearer, I need to overload that button, not replace the commerce checkout functionality.
PS: I have no access to the console or Devel. So I'm limited to debugging with var_dump().


texts:
The project it's in Drupal 8.2

Hello, when a user fill the profile and Save  ( /user/id/edit) the page it's reloaded with the new data in the same url, but I want to redirect the user to /user/id

This code should work:

function custom_user_form_user_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {

  $form_state->setRedirect('user.page');
}

But it doesn't work, any idea what's going on?

Thanks


texts:
I define variables in template.php file preprocess_page but it come undefined in tpl.php files. What can be a problem? Here is code

template.php file

$user_profile = profile2_load_by_user($uid, 'user_profile');
$vars['user_profile'] = $user_profile;

tpl.php file

print_r($user_profile);


texts: How do I render a submit button so that it's disabled initially and enabled by JavaScript?

texts:
We have a form that includes a React JS frontend component. The component collects some required information, which the React component then supplies to the backend by populating a hidden form field.

To ensure that a user cannot bypass entering the required data through the component, we need to satisfy the following requirements:

Before the React component loads, the "Submit" button needs to be disabled. This ensures that a user can't submit the form just by disabling JS or just clicking the button before the page finishes loading.
After the React component loads, any time that the required values get cleared, the "Submit" button needs to be disabled.
Once the required values are supplied, the "Submit" button should be enabled.
It must not be possible to submit the form if the hidden value is empty.

I've tried rendering the form like this:

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form = [];

    $form['selected_values'] = [
      '#type' => 'hidden',
    ];

    $form['actions'] = [
      '#type'   => 'actions',
      '#weight' => 100,
    ];

    $form['actions']['submit'] = [
      '#type'         => 'submit',
      '#value'        => $this->t('Submit'),
      '#button_type'  => 'primary',
      '#disabled'     => TRUE, // Controlled by JS on the frontend
    ];

    return $form;
  }

And then in JavaScript, I have an onValueChange() event callback that looks like this:

function onValueChange(value) {
  if (value.trim() === '') {
    $(submitButton).prop('disabled', true);
  }
  else {
    $(submitButton)
      .prop('disabled', false)
      .removeClass('is-disabled');
  }
}

I also tried:

  public function buildForm(array $form, FormStateInterface $form_state) {
    $form = [];

    $selected_values = form_state->getValue('selected_values');

    $form['selected_values'] = [
      '#type' => 'hidden',
    ];

    $form['actions'] = [
      '#type'   => 'actions',
      '#weight' => 100,
    ];

    $form['actions']['submit'] = [
      '#type'         => 'submit',
      '#value'        => $this->t('Submit'),
      '#button_type'  => 'primary',
      '#disabled'     => !empty($selected_values),
    ];

    return $form;
  }

Both of these approaches demonstrate the same problem -- clicking the "Submit" doesn't submit the form; it just seems to rebuild the form. With the second approach, it looks like the incoming selected values are always empty during the form render; they don't get applied to the form state until after the form is constructed.

How can we ensure that the "Submit" button starts out disabled, while requiring the necessary values?


texts: How to disable breadcrumbs for certain pages?

texts:
How can I just disable breadcrumbs for certain pages on drupal 8?

There is a module for this on D7, is it easy in D8?


texts: How can I prevent HTML tags getting rendered as plain text?

texts:
I have my data from SQL with table HTML tags e.g. <tr> and <td>.
When I render it in Views it displaying all the HTML table tags without rendering it.
I put some code in .module file to pass this data using hook_views_post_execute I tried all the solution but nothing seems to work.
My views field is not rendering as table.


texts: How do I override the "Home" breadcrumb in a Bootstrap sub-theme?

texts: We are using a Bootstrap sub-theme with Drupal. I want the first link in the breadcrumb to say something other than "Home". How can I change that?


texts: Drush commands report "hostname: Name or service not known"

texts:
Many Drush commands are reporting this error once or more:

  hostname: Name or service not known

The commands seem to run fine, though.

This is Drupal 7 running on a local development environment on OpenSUSE 13.1.
The status reported by Drush is the following one. (I have edited out username and password.)

  Drupal version:  7.34
   Site URI:  http://default
   Database driver:  mysql
   Database username:
   Database name:
   Database:  Connected
   Drupal bootstrap:  Successful
   Drupal user:  Anonymous
   Default theme:  zen
   Administration theme:  seven
   PHP executable:  /usr/bin/php
   PHP configuration:  /etc/php5/cli/php.ini
   PHP OS:  Linux
   Drush version:  6.2.0
   Drush configuration:
   Drush alias files:
   Drupal root:  /srv/www/htdocs
   Site path:  sites/default
   File directory path:  sites/default/files
   Private file directory path: ../files/private
   Temporary file directory path: /tmp

Running "drush up --debug" shows the error message:

  Cache MISS cid: 6.2.0-alias-path--c4cc2b4982c6401ca3d49ce3d0e075b4
  hostname: Name or service not known

How can I fix this error message?


texts:
I can not understand how to use migrate_extras and for example how to use geofield migrate extra support.

I have create a Migration class that work. In my "source" I have 2 "fields" called latitudine and longitudine. I have follow the instruction that I have found in geofiled.inc:

$geo_arguments = array(
  'lat' => array('source_field' => 'latitudine'),
  'lon' => array('source_field' => 'longitudine'),
);
// The geometry type should be passed in as the primary value.
$this->addFieldMapping('field_coordinate', 'Point')->arguments($geo_arguments);
// Since the excerpt is mapped via an argument, add a null mapping so it's
// not flagged as unmapped.
$this->addFieldMapping(NULL, 'latitudine');
$this->addFieldMapping(NULL, 'longitudine');

But my "test node" is created (via migrate) without "geofileld" field (field_coordinate). But if I comment the lines above and insert this function:

public function prepare($node, stdClass $current_row) {
  $node->field_coordinate = array(LANGUAGE_NONE => array(0 => array(
    'geom' => 'POINT ('.$current_row->longitudine." ".$current_row->latitudine.')',
    'geo_type' => 'point',
    'lat' => $current_row->latitudine,
             'lon' => $current_row->longitudine,
             'left' => $current_row->longitudine,
             'top' => $current_row->latitudine,
             'right' =>$current_row->longitudine,
            'bottom' => $current_row->latitudine,
   )));
}

"geofield field" is "created".

Where is my error?


texts:
I use getsentry  for my Django deployments. It's awesome for automatically emailing me when a user experiences a bug in the code, and sending me the stack trace for any exceptions that occur.

Does Drupal have anything equivalent? I've seen the Drupal Sentry plugin but it doesn't look like it's under active development.

What's the best way of monitoring bugs in production for Drupal?


texts: Get URLs of taxonomies terms in Link field

texts:
I am having a link field in drupal 8. It can accept both internal and external links with autocomplete feature. But it works only with nodes means with content but i want to use it with taxonomy terms as well.

How can i achieve this ?
Any Help


texts: Find user profile page link from database

texts:
I know the link structure of a user page .
Like
For admin,it is example.com/users/admin
But I want to know from database how can I find the link? or which table contains the link?


texts: Is the rules event "Before saving a user account" applied every time a user edits their account?

texts:
I would like to apply a rule that allows existing users whose email addresses come from a certain domain to continue using their existing accounts, but to prevent the creation of future accounts from these domains.

I have configured my rule to react on the After saving a new user account event, but I'm unsure as to whether to have it react also on Before saving a user account.

Does saving here refer to only to account creation, or also to account updates such as a password change?


texts: How do I enable CORS on Service endpoint?

texts:
I tried to call a Drupal service endpoint, exposed by the Services module, using ionic which is built on Cordova.  I ran 'ionic serve', so it wasn't serving from the file system but had an actual localhost and port url.  I then installed the CORS module and I'm a bit confused by what I need to include.
My endpoint is http://example.com/api/v1/
It is a REST based server and I only enabled JSON.
       I want to get data from the site to load into a mobile app - such as an Android - a hybrid app (meaning coded in HTML/JS and packaged with ionic).

The documentation is a bit confusing to me.  It reads

  "A list of paths and corresponding domains to enable for CORS. Multiple entries should be separated by a comma. Enter one value per line separated by a pipe, in this order:"

  Internal path

  Access-Control-Allow-Origin. Use  to echo back the Origin header.

  Access-Control-Allow-Methods

  Access-Control-Allow-Headers

  Access-Control-Allow-Credentials

  Examples:

  *|http://example.com

  api|http://example.com:8080 http://example.com

  api/*|<mirror>,https://example.com

  api/*|<mirror>|POST|Content-Type,Authorization|true

Do I include Access-Control-Allow-Origin|api/*|http://example.com, or is the domain supposed to represent the domain that can call my service?

Maybe I just need Internal Path and not anything else. None of the examples uses Access-Control-All-*. I don't plan to do more than GET requests at this time.


texts:
How would I go about adding html/css into this module e.g. to place the different form items into a table, so i could have a column with one field entry the next column with another entry, and then rows below with other entry fields. I noticed when i put an image into the module it appears on every page on the website too?

 function form_example_menu(){
   $items = array();
   $items['form_example'] = array(
   'title' => 'My example form',
   'type' => MENU_NORMAL_ITEM,
   'access arguments' => array('access form_example'),
   'page callback' => 'drupal_get_form',
   'page arguments' => array ('form_example_form'),
     );
 return $items;
  }

function form_example_form($form, &$form_state){

    $form['mytextfield'] = array (
    '#type' => 'textfield',
    '#title' => t('My text field'),
    '#size' => 60,
    '#maxlength' =>128,
    '#required' => TRUE,
     );

 $form['mytext'] = array (
   '#type' => 'textarea',
   '#title' => t('My text area'),
   '#description' => t('enter some text.'),
   '#defauly value' => '',
   '#required' => TRUE,
  );

 $form['submit'] = array(
   '#type' => 'submit',
   '#value' => t('Add an item'),
 );
return $form;
}


texts:
I want to add new option "Own Company" into "Options" select in View filter settings form:

This is filter of entityreference field.
Also I want to have opportunity alter views query with this value.

I tried with form_alter but I can't save chosen value.

Also I wanted to write own views child class that will handle entityreference filter settings. But I can't find dafault handler in hook_views_data_alter.

Also saw that views filter select in entityreference module is made with ctools plugins system. Filter settings form might be plugable but I can't manage to do it.

Has anybody altered views filter settings form?


texts: How to style the help text that appears at the top of pages?

texts: I'm using the "Piano" theme, and I just don't like the way it displays the help text that would normally appear as a red box when there's an error or a green box for information or to indicate that something processed successfully. I really just want it to be back to normal because right now it's easy to miss and it kind of blends in to the rest of the text.


texts: Drupal 8 Permission to see Structure > Menu

texts:
Drupal 8. I want a user with a certain role to be able to see and administer menu items /admin/structure/menu/manage/main

On the permissions page /admin/people/permissions I have 'Administer menus and menu items' checked. This worked in Drupal 7.

I can get to the /admin/structure/menu/manage/main page if I manually type in in the browser.

But the 'Structure' button/link does not appear in the toolbar for that role. It shows up for me when am logged in as User/1

How do I get the 'Structure' in the Toolbar? Am I choosing the wrong permission? Am I missing one?


texts: How do you prevent twig variable from last instance of template overriding those that go before it?

texts:
I am creating a module that will allow editors to display nodes as "cards" using the summary from the node for the card text and a field (field_hero) as a background image to the card, the user can then click-thru to the actual content from the card.  The editor can also define, via the layout builder the colour behind the text for the card and also where the text appears (top, left, right, bottom).

If I add several of these cards to a page using the layout builder, all of the cards use the values for position and colour from the last instance placed on the page.

My code block plugin code is:

  public function build() {
if ($entity_id = $this->configuration['entity']) {
  if (($entity = $this->entityStorage->load($entity_id)) && $entity->access('view')) {
    $render_controller = \Drupal::entityTypeManager()->getViewBuilder($entity->getEntityTypeId());
    $view_mode = isset($this->configuration['view_mode']) ? $this->configuration['view_mode'] : 'default';

    if (isset($this->configuration['card_colour'])) {
      $entity->card_colour = $this->configuration['card_colour'];
    }
    if (isset($this->configuration['card_layout'])) {
      $entity->card_layout = $this->configuration['card_layout'];
    }

    return $render_controller->view($entity, $view_mode);
  }
}

return [];

}

And my twig template is (ignore the empty url() in the style attribute):

{%
    set classes = [
        'node-card',
        'card-' ~ node.card_layout|clean_class,
        node.card_colour|clean_class,
        'clearfix'
    ]
%}
<article{{ attributes.addClass(classes) }}>
    <div{{ content_attributes.addClass('bg-img', 'clearfix') }} style="background-image: url()">
        <div class="summary">
            {{ content.body }}
        </div>
    </div>
</article>


texts: Private files get Access Denied for any non-admin role but only on server

texts:
Very odd problem. I have a bundle where a user uploads a file to a private file field. When viewing the bundle; they see the file listed and can see it is linked to the file; but when clicking the file, they get Access Denied. This is on a CentOS 7 server.

The part which makes this odd is that the site is version controlled and the same code is running on my local Windows development machine. I just grabbed a copy of the server db and installed on my local. So, technically, the sites should be identical. On my local, the user is able to view the private file.

Normally this would lead me to think it is a server issue; but, anyone with Administrator role can view the file. This suggests it is something controlled by Drupal.

On the server I have created a virgin bundle with only a single new file field; and the problem persists. So it appears to not be bundle or site config related.


texts:
I have created a webform in Drupal. It has a pagebreak after every question.

What I want to achieve is the following: When someone clicks on a radio button, the next question should slide up without the user clicking the next page button.

I have tried with theming, but I am not very experienced with Drupal, PHP, or jQuery.

This is the link to my webform.


texts: Bootstrap.inc error appearing on website

texts:
When I go to my database website at kctd.org/community, I get this error:

  Fatal error: require_once() [function.require]: Failed opening required '/home/kctd/public_html/community/sites/all/modules/views/modules/translation/views_handler_filter_node_language.inc' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/kctd/public_html/community/includes/bootstrap.inc on line 3069

I have no idea what that means. The last action I did was extending the result of my view filter to include user's email. When I clicked save, this popped up. I cannot log in to even switch to maintenance mode.

What can I do?


texts: user_login_finalize() logins the user, but I remain anonymous

texts:
I'm using user_login_finalize() in my code to login a user (right before the review page), and this works because I can see the log in drush watchdog-list. However, it only works behind the scenes: the browser session remains anonymous. The browser has a new anonymous session though.

It's almost like a new PHP thread is spawned for the user instead of using the old one (thus, Drupal logs the user and spawns a new thread, so the user is still anonymous even though Drupal has logged the old user). I don't know whether it does that, but that's what it looks like.

I know this doesn't help you per se, but I'd like at least to know how to debug that. I'm really lost there.

FWIW, here is the drush watchdog-show 66341 for the login:

 Wid        :  66341
 Type       :  user
 Message    :  Session opened for dsdsdsdsdsdsdsdsdsd@sdsdsds.com.
 Severity   :  notice
 Location   :  http://test.lxc:81/checkout/11
 Referer    :  http://test.lxc:81/checkout/11
 Hostname   :  192.168.120.1
 Date       :  08/oct 16:20
 Username   :  dsdsdsdsdsdsdsdsdsd@sdsdsds.com

More information: I'm using the following code where I call user_login_finalize:

global $user;

$account = new stdClass();
$account->is_new = TRUE;

$edit = array(
  // More to come later, but this is the only constraint
  'name' => 'some random name',
);

$user = user_save($account, $edit);

// Checking $user here, it has the correct UID of a new user.

user_login_finalize();


texts: Show Percentage In The Piechart As A Field

texts:
I have a piechart which displays the attendance ratio.
It shows present percentage and absent percentage.
I want the present percentage as a field in a view.
To display the piechart,I am using the following modules
1.Views
2.Charts
3.Google Chart Tools


texts: Good looking contributed themes for Drupal 6

texts:
I am looking for good looking contributed themes fro Drupal 6. Drupal.org is filled with themes, although several of them lack support even for the most used modules (taxonomy, search, comment) and many are table based or written through bad and horrible practices.

What I would like to see are modern themes with great typography, grids, good coding practices, based on starter themes, making good use of CSS3 features, supporting other modules. I know it's hard to see a theme with all of those qualities, but try to match at least two of these.


texts: Displaying multiple fields in referenced webform option?

texts:
First I have a content type Quiz option which represents one option (answer) for a webform question (field).

Then I have a (entity reference) view which is collecting specific number of nodes in this type. I got one argument to that view, which represents question id and when passed I'm getting all possible answers for that question.

And then I got a webform, where I have field of entity checkbox type where all options are referenced with that view. So webform field options are set like:

Type of item to reference: Content
Reference method: Views: Filter by an entity reference view
View used to select the entities: my view
View arguments: that question id

And all this works well - I'm getting the possible options from that view and as option titles node titles are displayed.

Basically if I create new node in "Quiz option" and select for it question id i.e. 1 then view referencing those node will also display it when question id 1 is passed and since question in my webform is using that view new option will appear as a new option under that option.

Now what I need is to display another field (image field) beside that title as part of an webform option. I've added image field to my content type. Then I adjusted my view so it also displays the image. But problem is that webform is still displaying only node title. New image field is ignored. Checked on "Display options" of my content type, but image field is not hidden there. So must be that webform module is responsible - it's displaying only referenced node title no matter what used view is returning.

Is there a way do configure my webform field to display this extra field for field options instead of only node titles?


texts: How to hide homepage link from menu once logged in?

texts:
I have a "home" link on my primary navigation menu. Once the user is logged in, the home link is irrelevant and I don't wish to show it.

I've set the access control permissions for the "home" page to only show for "anonymous user", but it's still visible in the menu once logged in. I'm guessing that authenticated users can see everything anonymous ones can, even if they don't have the box ticked. Is there some way around this?

I'm aware of "menu per role", but I read that it's better to set the permission of your content directly and let Drupal hide/show where appropriate, so I'd like to avoid using menu per role if possible.


texts: Need numeric sort in views: like 1 2 3 4 not 1 10 11... 19 2 20

texts: I have created view of views or you can say a page of teasers where the teasers are itself views(global views field) and the page is generated as view too. there is a custom field a/c no (in teaser)which I want to sort ascending but it sort like 1 10 11 12 ... 19 2 20... and so on. After using natural view sort it is sorting like 19 53 35 20 54 21 etc, why it is happening and why the natural sort is not working? It does not relate with taxonomy.. I am just wondering that if normal sort is working in view of views then why is not natural sort working to that?


texts: I have a field within a field collection that I need indexed. It's not showing up in the /admin/config/search/search_api/index/solr_node_index/fields page. I tried using this to try to add it myself, but I don't really know how to reference it. I know that the field collection is just an array of id numbers that you can reference, but I need to reference the actual field. Any help is appreciated.


texts:
I have a parent theme as a basis for a multisite installation. Right now, I'm working on a child theme which has to have some custom templates. Here's my preprocess function in my child theme:

$orig = $vars['theme_hook_suggestions'];
$manual = array('page__node', 'page__node__%', 'page__node__96', 'page__gallery', 'page__drisco_gallery');

dpm(array_diff($manual, $orig));
dpm($manual);
dpm($orig);
$vars['theme_hook_suggestions'] = $manual; // Loads my page--gallery.tpl.php template and works as expected.
$vars['theme_hook_suggestions'] = $orig; // Ignores my template, just uses page.tpl.php

The template only loads if I create the array by hand, even though it's apparently identical to the one already there. Here is what dpm() outputs:

... (Array, 0 elements)

... (Array, 5 elements)
    0 (String, 10 characters ) page__node
    1 (String, 13 characters ) page__node__%
    2 (String, 14 characters ) page__node__96
    3 (String, 13 characters ) page__gallery
    4 (String, 20 characters ) page__drisco_gallery

... (Array, 5 elements)
    0 (String, 10 characters ) page__node
    1 (String, 13 characters ) page__node__%
    2 (String, 14 characters ) page__node__96
    3 (String, 13 characters ) page__gallery
    4 (String, 20 characters ) page__drisco_gallery

Does anyone have a clue of what I'm doing wrong?


texts: Views and empty parameter in Path to link

texts:
I know my title isn't explicit, but i will explain my problem. I created a view that displays me all documents(content) of my website, some documents are linked to a project(content) via entity reference, and in my view I display a link to a document. if there is a project the link looks like : node/100?project=5 . If there is no project the link needs to look like : node/100.

So in my view I added field excluded from display with the id of the project, and a second field which is the id of the node document and I rewrite the link  to :

node/[nid]?project=[field_doc_project]

My problem is: This works fine for document with projects only. good url: node/100?project=5 bad url, without project: node/100?project=.

Can I check in view if the project id exists and rewrite the url to node/100?

thanks


texts: How to set webform to show previous submissions to users?

texts: I've got a webform I'm maintaining, and I'm not sure how to expose or suppress the "View Previous Submissions" link on a per=role basis. The previous submissions link is visible to the admin, but it's not visible to the user. I've looked at the role based permissions the webform settings but nothing looks obvious.


texts: update user data without a form from a module

texts:
in my drupal system i use the basic_wemail module along with a custom module i created that creates a postfix mail alias for a new user, so we can provide users with free email addresses as part of the service.

The basic_webmail module has a user form where a user can input their email address and logins for the module to save the email credentials as serialised user data. Since we dont want users to update this information and only to use the email credentials created by our custom postfix integration, but user_update(), user_insert() and user_presave() all work on a form submit, is there another way to pragmatically update a users serialised data?


texts: How do I remove DEC 31 from a date field?

texts:
I have an event page on a member's portal. I have added a new Date field to the Event Content type and I am leaving the old date field in to show previous events as they are in that table. I'd like to have the new events' dates show up in the same format at the existing Date field.

The problem I have is that DEC 31 comes up after I create a new event. The new Date field is working fine in that it only shows upcoming events on the landing page but when you click on the events tab the DEC 31 comes up on all Dates that are associated with the new Date field.

I looked into the template.php file to try to modify the code to allow the new Date field to show like the existing Date field.

case 'events' :
  if ($vars['view_mode'] == 'teaser') {
    hide($vars['content']['field_event_city']);
    hide($vars['content']['field_event_country']);
    hide($vars['content']['field_event_date']);
    hide($vars['content']['field_upcoming_date']);

    $city = !empty($vars['content']['field_event_city'][0]['#markup']) ? sprintf('%s, ', $vars['content']['field_event_city'][0]['#markup']) : '';

    $country = (isset($vars['content']['field_event_country'][0]['#markup'])?$vars['content']['field_event_country'][0]['#markup']:'');

    $vars['location'] = html_entity_decode($city . $country);
  }

  if (!empty($vars['content']['field_event_speakers'])) {
    $i = 0;

    foreach ($vars['field_event_speakers'] as $speaker) {
      $vars['content']['field_event_speakers'][$i]['#avatar_uri'] = AIUser::get($speaker['value'])->get_picture_uri();
      $vars['content']['field_event_speakers'][$i]['#uid'] = $speaker['value'];

      $i++;
    }
  }

  $vars['start_date'] = (isset($vars['node']->field_event_date['und'][0]['value'])?$vars['node']->field_event_date['und'][0]['value']:NULL);
  $vars['end_date'] = (isset($vars['node']->field_event_date['und'][1]['value'])?$vars['node']->field_event_date['und'][1]['value']:NULL);
  break;

The field_event_date is the current date field. So I want to add the new date field along with this one and have it print out the same format.

The reason I added a new Date field is because the current Date field is an integer field. I needed to add a Date Time Unix field so that I can allow it to be greater than now.

I checked around the Redaction module but I am unable to find anything on how to get this done.


texts: How to autofill webform with node field data

texts:
I have a content type, applicant with a name, and birthday field. I also have a entity reference to a webform, which has a name and birthday fields, as well as others. I want to allow users to create the applicant content type, then click the link to webform, and autofill the appropriate fields on the webform.

I've been trying to use the FormStateInterface::setValue method. Here' where I am so far:

function mymodule_webform_element_alter(array &$element, \Drupal\Core\Form\FormStateInterface $form_state, array $context) {
  kint($element); // this outputs '#webform_key' => string(4) "name"

  $form_state->setValue('name', 'bob'); // Here I'm just trying to statically set the field.
}

This method doesn't actually autofill, and it also doesn't actually set the value. This is a demo-project, so we don't have specs yet, so I'm actually fine with either auto-filling, or setting the value, probably both.

The main thing I'm trying to do here is to link one node entity to a webform submission.


texts:
How could I add a default text inside drupal's search box? I have done this with jquery but I need the text to be translated.

I know this can be done with the Custom Search module but it is a little overkill to add a module for such a small feature. Hopefully this can be achieved using my theme's preprocess function. Any ideas on how this can be done?


texts: Print CCK field "A" if CCK field "B" has a value of "Z"

texts:
I want to print a CCK field (we'll call it CCK field "A") only if the value of another CCK field (we'll call it CCK field "B") matches a string. CCK field "B" is a select-list field with two options: "red" and "blue". I'd like to display the value of CCK field "A" only if the value of CCK field "B" is "blue". If the value is "red", then CCK field "A" should not be displayed at all.

How can I do so?

Thanks!


texts: How to use a variable in script tag of template file?

texts:
I want to use $node->title in the script tag so that I can get data dynamically for particular titles. So I am not getting how can I achieve this. I tried like below, but not worked.

 <script type="text/javascript">
     var job_title = $node->title;
     var container_id = "#footer";
     Springest.getTrainings(job_title, container_id);
  </script>

Thanks for any suggestions.