texts: Exposed filters with dropdown selections

texts:
I have a project where I've created a View with some basic information, showing for example Year, Manufacturer, Product Type. They are all custom text fields. I can expose a filter on them which lets me manually enter in a search, for example, 2008 for year and it correctly shows me all the entries for 2008.

Is there any way to have these fields available as a dropdown selection based on the content saved within each node, eg so that the Year field shows 2001, 2002, 2003 ..... 2012 etc, or Product Type shows "Table, Chair, Lamp etc" that the user can choose from? I'm fairly new to using Views and struggling to find an answer.

I'm using Drupal 7 and Views 3.3.


texts: How to change block visibility/pages in hook_block in my module?

texts:
I implement mymodule_block and for case 'list' I have blocks like:

  $blocks[CN_BLOCK_RHM_BUTTONS] = array(
        'info' => t("Block name"),
        'status' => 1, // on by default
        'weight' => -99, // should be at the top
        'region' => 'right', // RHM
        'visibility' => 1, // Only on these pages
        'pages' => 'page1' . PHP_EOL .
          'page2' . PHP_EOL .
          'page3' . PHP_EOL

This works great for new blocks created on our dev site. But I want to change the pages settings in source control, and for these changes to propagate when we updated this module on our production site. It seems that for existing module deltas, Drupal looks at the block table fields and ignores any changes in hook_block. If these any feature of Drupal or cool snippet that will help me 'reset' blocks to the module's settings?


texts:
I'm trying to remove the Site Map module from my website, however when I disable it in the modules section the page that it generates http://mywebsite.com/sitemap remains unaffected.

My first thought was; maybe the website cache needs clearing and or cron job needs to run. After doing both of those things, nothing has changed. I'm still left with the page on my site that I no longer want.

Does anyone know how I can get rid of this? I've even tried deleting the modules folder to no avail.

The module's definitely disabled.


texts: How to make a word/pdf type doc clickable

texts:
Good day

I have created a view, but am not sure how to make the documents type clickable. At the moment you click on the label it works, but not when you click the type. See attached, second example is the desired results and first one is the current results. I would like to take away the label and leave just the type and make it clickable.

On the other hand, how can I determine the document size and display it on the table as per second example.


texts: Drupal Commerce: Number of a sales per product

texts: How can I find the number of sales for a particular product in Drupal commerce?


texts: Is there a way to automatically have a copyright attribute when content is submitted?

texts:
I have a website where all users submit content and that content is often also plagiarism, which I don't want.

Can this be done with rules? How would the copyright attribute fetching work?

What I want to accomplish and what I tried without luck in short:

After content is submitted, cross check websites database and look if there's some copyright attribution to be made, if positive add the copyright attribute to the end of the text.

Am I doing it right?


texts:
I'd like to make a scroll display for sponsor's logo like this demo.

Is there any module for Drupal 7? if there is no one how can i achieve this?


texts: How to add a display format for the field

texts: I have a field of list type in my custom content type. The display format of list type field has two options default(value) and key.  In my case i want third option which will display "key and value". How can i add third option or get the key/value for the field.


texts: |slice filter does not work with special characters

texts:
I try to use the slice filter in order to limit a link to a specific amount of characters. The field that I render is a link field and my code is the following:

{% set title_text = title|render|striptags %}
<span>
     {{ title_text|length > 65 ?
         title_text|slice(0,65)  :
         title_text|striptags}}
</span>

Unforturnately some characters like the apostrophe are not rendered appropriately.

So instead of rendering "I've learned", they render "I& #039;ve learned"


texts: Group Module - have access only to content created by group members

texts:
I am using Group Module and I have many groups and each member is creating new nodes every day.

What I need:
Only the members from a specific group can view/edit the nodes created by the members of the exact same group. I want a full closed circle.

Let me refrain with this:

Group 1 has users:

Moderador - Can see its own content and all the content created by member 2 and 3. Can't see content created by user 4,5,6 because they are in a different group.
Member - Can see content created by him alone, not others.
Member - Can see content created by him alone, not others.

Group 2 has users:

Moderador - Can see its own content and all the content created by member 2 and 3. Can't see content created by user 1,2,3 because they are in a different group.
Member - Can see content created by him alone, not others.
Member - Can see content created by him alone, not others.

I searched in the permissions but I can't figure this out.

Does anyone know how to accomplish this?

Thanks


texts: Setting current node url as default value for "Link" field

texts:
I have a content type with a field type Link. I would like to set default text and url for the field. Under:

  Structure » Content types » MY CONTENT TYPE » Manage fields

I tried entering # and [current-page:url:absolute]. Both of them were not accepted and the below are the respective error messages:

The value [current-page:url:absolute] provided for MY FIELD NAME is not a valid URL.
The value # provided for MY FIELD NAME is not a valid URL.

What is the right way to enter the current node URL as a default value into a Link type field?


texts: How to use Oracle as a remote/local database for Drupal 7?

texts:
Can anyone offer any advice about the viability of using Oracle(commercial) as a remote/local database for Drupal 7?

I need to determine if this will work and convince my employer without incurring huge costs in testing.


texts: warning message after uprgraded to drupal 6.38

texts:
I upgraded drupal 6.2 to drupal 6.38 to apply the security patch to ignore the vulnerabilities as mentioned in https://www.drupal.org/drupal-6.38-release-notes .

But after updating to 6.38 when i checked the status report am getting the following result .

How could i resolve this ? is there need to install any additional modules to ignore this warning ?

UPDATE

After enabling the module i got this


texts:
I'm in the process of upgrading to Drupal 7.12 from Drupal 6.25.
I have been upgrading all my modules as well, and now is time to figure out how to migrate the data from CCK to D7 Fields.

I found the Migrating D6 Content Construction Kit (CCK) to D7 Fields article, which explains how to do this.

Unfortunately I after I update the CCK module, and enable the Content Migrate Module, I don't see where the Content Migrate Module under Admin -> Structure -> Content Migrate!

I'm stuck and I don't know what to do. Any ideas/suggestions?


texts:
I have created the following form:

function donation_amount_selection_form($form, &$form_state) {
  $form['donation-amount'] = array(
    '#type' => 'radios',
    '#options' => array('10','20','50'),
    '#default' => 0,
    '#ajax' => array(
      'calback' => 'donation_amount_selection_callback',
      'event' => 'click',
      ),
  );
  $form['donation-custom-amount'] = array(
    '#type' => 'textfield',
    '#title' => 'Other',
    '#ajax' => array(
       'callback' => 'donation_amount_selection_callback',
    ),
  );
  $form['submit'] = array(
    '#type' => 'submit',
    '#title' => 'Submit',
    '#value' => 'submit',
  );
  return $form;
}

I have put an ajax calllback on each of the form elements. The callback for the textfield gets fired but not the one on the radio buttons. I even tried commenting out the callback for the textfield to see if somehow it was interfering with the radio buttons (because its the same callback function), but it still didn't work.


texts: struggling with template_preprocess in module

texts:
I know there is a lot of documentation on this function on google, but I am still not able to get this hook to run for my holidayautosxml_carsearch_form. Could anyone advise on what I am doing wrong.

The Theme function is running fine. If I put exit(); in that function I get white screen of death. However if I put exit(); in the template_preprocess function nothing happens.

I have cleared all the caches.

my template is called holidayautosxml-carsearch.tpl.php and it is located in the module folder.

Here is my theme function

function holidayautosxml_theme(){
return array(
            'holidayautosxml_carsearch' => array(
                    'template'=>'holidayautosxml-carsearch',
                    'render element'=>'form',
            ),

    'halocationresults' => array(
        'template' => 'halocationresults',
        'variables' => array('haresults' => NULL,),
    ),
    'hapriceslist' => array(
        'template' => 'hapriceslist',
        'variables' => array('haprices' => NULL,),
    ),
);
}

Here is my template_preprocess function

function template_preprocess_holidayautosxml_carsearch(&$variables){

$variables['holidayautosxml_carsearch'] = array();
$hidden = array();
//Provide variabels named after the form keys so themers can print each element independently.
foreach (element_children($variables['form']) as $key){
    $type = $variables['form'][$key]['#type'];
    if ($type == 'hidden' || $type == 'token'){
        $hidden[] = drupal_render($variables['form'][$key]);
    }
    else{
        $variables['holidayautosxml_carsearch'][$key] = drupal_render($variables['form'][$key]);
    }
}
//Hidden form elements have no value to Themers. no need for seperation.
$variables['holidayautosxml_carsearch']['hidden'] = implode($hidden);
//collect all form elementsto make it easier to print the whole form
$variables['holidayautosxml_carsearch'] = implode($variables['holidayautosxml_carsearch']);
}

and here is my form function

function holidayautosxml_carsearch_form($node, &$form_state){

    $country_list = _get_country_list();
    $form['country'] = array(
            '#type'=>'select',
            '#title'=>'Select Country',
            //'#description'=>'Select the country where you want to collect the car',
            '#options'=>$country_list,
            '#ajax' => array(
                'callback' => 'update_officename_autocomplete',
                'wrapper' => 'haofficename',
            ),
    );

    $citylist = _get_city_list($form_state['values']['country']);

$form['officename'] = array(
    '#type'=>'select',
    '#title'=> t('Location'),
    //'#description' => t('Select the location where you want to pick up the car'),
    '#required' => TRUE,
            '#options' => $citylist,
            '#width' => 50,
            //'#autocomplete_path'=>'location-autocomplete',
            '#prefix' => '
',
            '#suffix' => '
',
);

    if (!empty($form_state['values']['country'])){
        $form['officename']['#autocomplete_path'] = 'location-autocomplete/' . "{$form_state['values']['country']}";
    }
    $dateformat = 'd-m-Y H:i';
    $form['datefrom'] = array(
        '#required'=>TRUE,
        '#type'=>'date_popup',
        '#date_format'=>$dateformat,
        '#title'=>t("Pickup date"),
        //'#description'=>t("The date you are picking up the car"),

        );

    $form['dateto'] = array(
        '#required'=>TRUE,
        '#type'=>'date_popup',
        '#date_format'=>$dateformat,
        '#title'=>t("Dropoff date"),
        //'#description'=>t("The date you are bringing the car back"),
    );

$form['submit'] = array(
'#type'=>'submit',
'#value'=>'Search Now',
'#submit'=>array('holidayautosxml_carsearch_form_submit'),
);

return $form;
}


texts:
http://drupal.org/node/1558548

That page says I can fix this bug by visiting the image field setting form - where is this located exactly? I can't find it.


texts:
I have a view white a gmap and foreach Marker a link with tel number.

And I want add tracking code on this link.

I add class on my link like this:

Marker Title

Description marker

   Call us

And after try with jquery

   $('.js-track-phone-gmap').on('click', function () {
       alert('ok');
    })

But nothing.

Someone has already tried to add ga code on Gmap ?

Thx for your help :)


texts: How do I remove all default styles (such as div.widthMarker) from CKEditor?

texts:
I have copied ckeditor.styles.js to /themes/seven/ckeditor.styles.js,
and in the configuration page /admin/config/content/ckeditor/edit/Advanced
I altered the predefined styles drop down to point to this new file:

if(typeof(CKEDITOR) !== 'undefined') {
    CKEDITOR.addStylesSet( 'drupal',
    [
            { name: 'Larger', element: 'span', attributes: {'class': 'size-1'} },
            { name: 'Epic', element: 'span', attributes: {'class': 'size-2'} },
            { name: 'MASSIVE', element: 'span', attributes: {'class': 'size-3'} },
            { name: 'Stupid!', element: 'span', attributes: {'class': 'size-4'} },
    ]);
}

Now when I load the WYSIWYG editor I still see other styles in the styles dropdown:

How do I remove the other styles that are not present in my ckeditor.styles.js file?

I have searched through all the code but can't find any reference to div.widthMarker or div.sortableListDiv except for in a .CSS file, but not everything in the CSS file is showing up.

Cheers,
- Paul


texts: I need to paste full front page of Drupal site to other page. Can I get page render array for front page for example in html.tpl of not-front page? Thanks!


texts: Default webform template changes not reflecting on nodes

texts:
We are using webforms and webform template modules on our site. We have created two webforms (Enquiry and Contact) and used them as webform template forms for some content types

Webform template settings

Default webform template setting

Now if I make any changes to default template webform say "enquiry form" webform those changes do not get reflected across all the nodes of type using this template in this case it is "Accommodation".

I made some changes to email template of enquiry webform say I add a new custom subject and save the webform email settings form.

Now I want this change to get reflected across all nodes of accommodation type which are using enquiry form template but for that I had to edit and save individual nodes. This is easy when we have lesser number of nodes we can update each node for template changes to work but if we have say 100 nodes then this process becomes impractical.

Is there any way we can update nodes attached to the webform after updating the webform template.

I tried to resolve this by custom form alter where I update each node programmatically on default template edit form sublit

case 'webform_email_edit_form':
  if ($form['node']['#value']->title == 'Enquiry Form') {
    $form['#submit'][] = 'enquiry_webform_email_custom_submit';
    //dpm($form);
  }
  break;

custom submit function enquiry_webform_email_custom_submit

$query = new EntityFieldQuery();

$result = $query->entityCondition('entity_type', 'node')
          ->entityCondition('bundle', 'accomodation')
          ->execute();
  if (isset($result['node'])) {
    $accommodation_nids = array_keys($result['node']);
    $accommodation_items = entity_load('node', $accommodation_nids);
    // dpm($accommodation_items);
    foreach ($accommodation_items as $key => $value) {
      // dpm($value);
      if (count($value->field_acc_hotel_id) == 0) {
        $node = node_load($key);
        $node->body[$node->language][0]['value'] .= "\nA line of text added by program.";
        node_save($node);
        drupal_set_message('Node ' . $key . ' has been updated.');
      }
    }
  }

This function works properly after I make any change to email template this submit handler updates all the nodes using webform template. But this does not update the email template I am still getting old settings for email even after the default template is changed.

Below Image - Webform attached to individual node email settings after updating default webform template and running the custom code.


texts: Search for user by specific 12 digit ID number

texts:
I'm building some functionality into a drupal 7 site that will let users search for another user, by a 12 digital identity number (for example: ZD-3423FGIO-XZ)

How would I go about doing this? Would I need to create some custom code to insert a new field in the user table that creates a custom number then modify the search functionality, or would I just use a module to do this?

Any help would be great!


texts:
I have an exposed filter of a taxonomy vocabulary (localities) and I want the user to be able to search on it in order to find the desired values more easily.

I am using BEF at the moment. I found the jquery ui multiselect widget but it does not seem to work with views filters.

Thanks


texts:
Am I right in thinking that the Drupal distributions that I can download from http://drupal.org/project/distributions are a standard Drupal core download with a load of other stuff added at /profiles?

Anyone know if there are any plans to create a dev branch of distributions that would automatically update the core version that the distribution is running on? Currently it seems that the distribution runs on whatever core version its developer has chosen.

And how can I use distributions with Drush? Is there an equivalent to drush dl drupal that will download a specific distribution?

And, finally, is there any difference between an install profile and a distribution?


texts:
I have created a image gallery on Drupal 7 users' profiles, which I would like to present as a separate page, linked to their profiles using views.

so, there would be a page at mysite.com/typical-user/gallery

I am at a loss on how to use the contextual filters to achieve this.


texts:
How to add taxonomy term image related to node in panel?

I am displaying node details , where in I want to show the image taxonomy term related to that node in the Panel. I did add context relationship and selected taxonomy term image in panel content but it is not showing up?


texts:
In a custom controller, I'm returning an AjaxResponse like so:
    $response = new AjaxResponse();
    $selector = '.segment-set-wrapper';
    $response->addCommand(new ReplaceCommand($selector, $form));
    return $response;

Where $form is a render array. However, instead of coming through as JSON with a set of commands, it comes through in a <textarea> element containing the string of json e.g. below:

Any idea what is going on here?
EDIT
Adding ajax code:
 var ajax_url = '/personalized_paragraphs/ajax/get_reactions';
          var request = $.ajax({
            url: ajax_url,
            method: "POST",
            data: segment_set_id,
            dataType: "html"
          });

          request.done(function( data ) {
            var $wrapper = $submit_btn.closest('.segment-set-wrapper');
            $wrapper.replaceWith(data);
          });


texts: How to join two Drupal CCK content types in view without a node reference field, fast?

texts:
Users uploaded two csv files to create nodes for two CCK content types (Delivery Note and Payment), i.e.

 Delivery       Payment
----------     ---------
 Order No.      Order No.
 Recipient      Charge
 Address

I would like to create a view as a report for the boss:

 Order No.  Recipient  Charge
 ---------  ---------  -------
  ...        ...        $...
  ...        ...        $...
  ...        ...        $...

Order No. field is unique and both content types.

How's it possible to do it in Drupal's view?

The above question was asked on SO and I found a solution. However, the solution was way too slow (for example, it takes more than a hour to download ~2000 records via Views Data Export).


texts: Are deleted entities automatically excluded from entity queries?

texts:
I'm trying to figure out if deleted entities are automatically excluded from entity queries. IE, if I did:

$num = \Drupal::entityQuery('my_entity')->count()->execute();

Would the number of entities found go down if I deleted one through the ui? How could I include/exclude deleted entities in this query?


texts: Debugging the result property in a ViewExecutable

texts:
I need to debug the $result property of the ViewExecutable object passed to hook_views_post_execute but for what ever reason, Drupal can't handle it. $view->result is an array of type ResultRow, and because it's an array, I'm attempting to log it like so:
\Drupal::logger('foo')->notice('<pre>' . print_r($view->result, TRUE) . '</pre>');

When I do this and then load the view I'm attempting to mess with, it loads the page without css and then the recent log messages just shows up blank, no errors or anything that would actually be helpful.
I've tried a number of different ways but this is always the result. Why can't this logger print a simple array?
I've even tried looping through the array and printing just the value:
foreach($view->result as $key => $value) {
  \Drupal::logger('bar')->notice(print_r($value, true));
}

And that will render the view without css and then the logger doesn't print anything at all. I double checked and printed a regular string and that worked, but when I attempt to print the value it just breaks and doesn't do anything.


texts:
D6 module https://www.drupal.org/project/uc_dependent_attributes is converted to D7 here: http://dupgrade.com/ and I found out db_affected_rows() was removed from D7.

I tried few codes, basically copy and paste, based on this answer db_affected_rows gives fatal error in drupal 7. Now I have a different error: Call to a member function rowCount() on a non-object.

Code which throws Call to undefined function db_affected_rows()

function uc_dependent_attributes_uc_product_adjustments_form_submit(&$form, &$form_state) {
  foreach ($form_state['values']['body'] as $value) {
    if (!$value['enabled']) {
     db_update('uc_dependent_attributes')->fields(array(
        'enabled' => 0,
      ))->condition('nid', $form_state['values']['nid'])->condition('combination', $value['combo_array'])->execute();
      if (!db_affected_rows()) {
       db_insert('uc_dependent_attributes')->fields(array(
          'nid' => $form_state['values']['nid'],
          'combination' => $value['combo_array'],
          'enabled' => 0,
        ))->execute();
      }
    }
    else {
      db_delete('uc_dependent_attributes')->condition('nid', $form_state['values']['nid'])->condition('combination', $value['combo_array'])->execute();
    }
  }
}

Changed: This gives 'Fatal error: Call to a member function rowCount() on a non-object' error.

function uc_dependent_attributes_uc_product_adjustments_form_submit(&$form, &$form_state) {
  foreach ($form_state['values']['body'] as $value) {
    if (!$value['enabled']) {
     $result = db_update('uc_dependent_attributes')->fields(array(
        'enabled' => 0,
      ))->condition('nid', $form_state['values']['nid'])->condition('combination', $value['combo_array'])->execute();
      $affected_rows = $result->rowCount();
      if ($affected_rows!=0) {
        db_insert('uc_dependent_attributes')->fields(array(
          'nid' => $form_state['values']['nid'],
          'combination' => $value['combo_array'],
          'enabled' => 0,
        ))->execute();
      }
    }
    else {
      db_delete('uc_dependent_attributes')->condition('nid', $form_state['values']['nid'])->condition('combination', $value['combo_array'])->execute();
    }
  }
}

How can I change db_affected_rows() to D7 properly?


texts:
I would like to add a few custom fields to Ubercart orders. These would be fields like "order assigned to" (which would allow an admin user to choose a user from the site's user list, or a simple text field where they can type a person's name). The fields would be updated via the order admin screen. Does anyone have any ideas on how this can be accomplished?

Thanks!


texts: Check if the user has read a node, if so give access to the next

texts:
Is there a module which can check if an user has read a node? For example, I have this node:

Node order 1
Node order 2 (locked)
Node order 3 (locked)
Node order 4 (locked)

If the user read 'node order 1' or marked as read with a button, he has access to 'node order 2'. If 'node order 2' has marked as read, he has access to 'node order 3'.
It's all user based. It's similar to an e-learning structure, but I don't like heavy modules like: course or opigno for just this functionality.
Can I do something like this with rules or an other lightweight module? I saw the flag module, but I don't know if it possible to do something like this with that module?


texts: When saving an updated node, does the update operation clear all caches?

texts: Just want to confirm when a node is updated, the update operation clears the complete cache table or the updated node related cache contents. Is this right?


texts: How we can have layout options at time of node creation just like we select in panels and display suite

texts: How we can add layout selection option of display suite or panel during node creation. Any solution available. The layout selection should be at the time of node selection.


texts: Working with operators when manually specifying options for a custom views exposed filter

texts:
I am trying to build a custom exposed filter for a field using the Countries module.

Instead of listing all 200+ countries in the world, I want to list only three options Japan, Not Japan, and All (the site obviously has a Japan focus).

The sample code in this question is:

class views_handler_filter_MYMODULE_country extends views_handler_filter_in_operator {

  /**
  * Get value options for the select list.
  */
  function get_value_options() {
    // Replace $this->value_options with an appropriately filtered list.
    $this->value_options = function_to_build_filtered_list();
  }

}

The countries module stores countries as two-character ISO codes.  Japan is JP.  So I tried doing this:

    // Replace $this->value_options with an appropriately filtered list.

    $options = array();

    $options = array('jp' => t('Japan'));
    $options = array('us' => t('USA'));

    $this->value_options = $options;
  }

However, this code results in an error.  Additionally, I don't know how to specify the operator, and when I think about it, I'm not sure how to handle the operator conceptually, either.

The logic should be this: either JP or NOT-JP.  However, as I understand it, Views does not provide per-item operators; the operator is applied to the whole handler.  "Is one of..."  "Is not one of..." etc.

So, to do Japan or Not Japan, should I list JP for Japan and then all other possible values for all other countries for Not Japan?  (That wouldn't take too long, I'm just scared of missing one.)  Or is there some better way?

I'd appreciate any insight into how Views operators work and what approach I should take to building such a list.


texts:
In hook_node_grants() I want to check if user ID is equal to a node's field value, But there is only two arguments: $account and $op

How can I access the node object that is being checked for grants?


texts: Redirect Page on Change of Exposed Filter

texts:
We have an All Articles view that is added to the http://www.example.com/articles page that is supposed to display all pages where content type is Article. The content type has a taxonomy term, Category, which has several filter values such as IoT, Security, and Cloud. On the view, the field_category is exposed for visitors to change the value and it will automatically update the results (Use Ajax = true).

Goal:

On change of the exposed filter to Cloud, we would like to redirect the user to another page (http://www.example.com/some-page).

Question:

How would we redirect a user to the other page when the exposed filter is set to Cloud?

View Settings:

Format

Format: Unformatted List | setting (default settings)
Show: Content | Listing (custom view mode)

Filter Criteria

content: published (= yes)
content: content type (= Article)
content: category (exposed)

Advanced

Use Ajax: Yes
Query Option: Distinct = true

Here is what we tried, but it does not redirect with no errors.

mymodule.module

function mymodule_form_alter(&$form, $form_state, $form_id) {
  if($form_id == 'view_exposed_form' && $form['#id'] == 'views-exposed-form-articles-page-1') {

   if($form['field_category_target_id'] == '123') {
     $form['field_category_target_id']['#ajax] = [
       'callback' => 'cloud_ajax_callback',
       'wrapper' => 'category_cloud',
     ],
   }
  }
}

function cloud_ajax_callback($form, FormStateInterface $form_state) {
  $response = new AjaxResponse();
  $cloud_cmd = $new RedirectCommand('http://www.example.com/some-page');
  return $response->addCommand($cloud_cmd);
}


texts: How can I get the english node title printed on the translated nodes edit page.

texts:
Something along the lines of this

function THEME_AMENDS_form_alter(&$form, &$form_state, $form_id) {
   global $language;
   $lang = $language->language;
   $translations = translation_node_get_translations($base_node->tnid);
   $translated_node = (isset($translations[$lang])?node_load($translations[$lang]->nid):$base_node);
}

I want on the backend of the translated node above the form the english node title to be printed for reference only.

So say we have a contact page, I want on the (spanish) node in the backend above the content edit form "Page Title: Contact" to be printed above where the field for the translated title of the spanish node would be in which the user would translate the title to "contacto".

Basic layout below:

Page Title: Contact

Node title field: [Contacto] <-- input box


texts: change the body and the title of my content type by css

texts:
I'm using the zen theme
I would like to customize with css, the "content type" that I created. Set a different font for the title and body. What should I do?


texts: How do I get the raw field value in a twig template?

texts:
myfield is a plain text field. {{ content.field_myfield }} renders the field with HTML markup and the field label.

How do I render the raw value of the field? {{ content.field_myfield.value }} doesn't work.


texts: What permission is required to access node reference data?

texts:
I created a CCK field (claim_category) in a CCK type (claim), added a few claim_category nodes.

When I try to create a new claim node (/node/add/claim), admin can see the claim_category drop-down list fine. However, an authenticated user sees an empty drop-down list with no option in it.

What permission is required for an authenticated user to to access the drop-down list data (claim_category nodes)?

Note: CCK Content Permission module is not enabled.


texts: When using the webform module, is it possible to get information on the submitter's device (Mac/Win/Android), browser version, etc.?

texts:
I'm using Webform 3 on Drupal 7.  I have a form on my site for people to report problems with the website itself.  Many of these reports ultimately turn out to be browser- or OS-specific, but often users do not add such information in their initial report.

Is there any way to automatically capture the browser and OS information, etc. in Webform upon submission?


texts: Access callback return true, but still is: you are not authorized to this page

texts:
function updatable_news_menu() {
    $items['updatable_news/test'] = array(
        'title' => 'Updatable news',
        'page callback' => 'updatable_news_test',
        'access callback' => 'updatable_news_permission',
        'access arguments' => "hello",
    );
}
function updatable_news_permission() {
    return true;
}

I have used a similar implementation and the permission is ok in another module. However, it fails in this module which defined a brand new entity.

function updatable_news_menu() {
    $items['updatable_news'] = array(
        'title' => 'Updatable news root',
        'page callback' => 'updatable_news_root',
        'access arguments' => true,
    );
}

I have to add new menu item with access should always be true. But it only succeed for administrator instead of anonymous user and logged in user.


texts: hook_page_alter and trying to change the '#theme_wrappers' property

texts:
I'm going a bit Drupal crazy trying to change the '#theme_wrappers' property of certain blocks in my sidebar region. I am able to set it using hook_page_alter and can dpm() it and confirm it is being set, but it never calls the function I point it to:

 $element = $vars['page']['sidebar_first'];

  foreach($element as &$elements){
    if (array_key_exists('#block', $elements)){
      $menuBlock = (array) $elements['#block'];
      if ($menuBlock['delta'] == "navigation" || $menuBlock['module'] == "menu"){
        $elements['#theme_wrappers'] = array('wet4_menu_tree__menu_sidebar');
      }
    }
  }

=====================

function wet4_menu_tree__menu_sidebar(&$variables) {
  dpm($variables);
    return '
' . $variables['tree'] . '
';
}

Any ideas?


texts:
I would like to make small css changes such as h1 and various font, background colors and divs etc. I am using Newsflash theme on Drupal 7 and I have searched and searched my folders thus: sites> all> themes> newsflash> css> local.css

I can probably override things here but I would prefer to go to the source stylesheet if it exists.  Does it exist?  If not, is local.css the right place to write my changes?


texts: Drupal 7 easy breadcrumb module hides breadcrumbs

texts:
When I install the easy breadcrumbs module my breadcrumb disappears.
I am wondering if there is a particular settings that I need to change. If I am on the homepage the breadcrumb home is displayed. As soon as I install the easy breadcrumb the breadcrumb is hidden. I tried clearing the cache but that didn't fix the problem. I also changed the theme to see if it was a theme issue but that didn't fix it.


texts: Why is my field not showing up in the template?

texts:
I created a new field of the type Link for the Basic page content type and the field name is field_secondary_links.

All the pages on the site operate based on custom templates and I edited node--page.tpl.php in order to show the links on the page. I added this:

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

The div appears in the HTML structure, but it turns out empty, even though I know for sure the fields aren't empty. What am I doing wrong?

Using print_r($node), I found out the field is indeed there:

[field_secondary_links] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [url] => http://www.google.com
                            [title] => Link 1
                            [attributes] => Array
                                (
                                )

                            [html] => 1
                            [query] =>
                            [fragment] =>
                            [absolute] => 1
                            [display_url] => http://www.google.com
                        )

                    [1] => Array
                        (
                            [url] => http://ww.google.com
                            [title] => Link 2
                            [attributes] => Array
                                (
                                )

                            [html] => 1
                            [query] =>
                            [fragment] =>
                            [absolute] => 1
                            [display_url] => http://ww.google.com
                        )

                    [2] => Array
                        (
                            [url] => http://www.google.com
                            [title] => Link 3
                            [attributes] => Array
                                (
                                )

                            [html] => 1
                            [query] =>
                            [fragment] =>
                            [absolute] => 1
                            [display_url] => http://www.google.com
                        )

                )

        )


texts: Drupal 7 views 3 add custom filter handler for an existing field

texts: How can you implement custom filter handler for an existing field in Views 3? With hook_views_data() you can expose a new table to views but how can you alter the handler for an existing field?


texts: How do I integrate a nodes edit form on a page?

texts:
I would like to integrate a nodes edit form on a page. For example, I want to alter the node with ID id equal to 1.
I know there are a lot of ways to achieve this, but I can imagine there is only one right way.

I am having some troubles with my form. After certain time, the edit form shows values from different nodes: some from this, some from the other, etc. I really don't know why.


texts: Where to find the html.tpl.php $head variable content generation

texts:
I'm looking for a way to edit the $head variable of the html.tpl.php.
Where exactly is this variable composed and set?


texts:
Basically Drupal is bit complicated for normal clients. Drupal 7 is better but still its not that user friendly for clients especially when comes to admin content or taxonomy!

Is there any module or themes which designed the client in mind? I found tabtamer and quickbar very helpful :) Any other to simplify admin section?


texts:
I'm trying to use filecache and authcache and I'm running into the same issue with both.  The documentation says I only need to add an entry to $conf['cache_backends'] and then define what that cache type should be used for.

This never works for me and I'm curious if it supposed to and I'm missing a step.  The only way I've gotten this to work properly is to manually include the file that defines the cache class.

UPDATE: it works if I put the includes at the top of my settings.php file, but not the bottom.  This doesn't make sense to me.


texts: How to do automatic card authorization during checkout process?

texts: I have a website that uses Drupal Commerce, we use Authorize.net for authorization and use AcceptJS as a plugin. When you put in the credit card information, it checks with Auth to make sure that you're using a real credit card and saves it as a payment method without authorizing the actual value. It gets saved in Auth, as well as the commerce_payment_methods table with a remote_id for Auth. Currently in our workflow, after you submit your order, in Commerce->orders->payments, you have to add the payment and manually authorize/capture the amount. I want it to automatically authorize the amount when you finalize checkout, however I'm running into difficulty figuring out where and how I do this. I know it must be something simple. Can anyone help?


texts: Easy date selector for Views Exposed Date Filter

texts:
I'm looking for a solution to put "Easy date selector" on the Views Date Exposed Filter, something like a drop-down or links with predefined date range:

Posts for today
Posts for yesterday
Posts for last week
Posts for last month
Custom range

any ideas?


texts: How do I add a custom image in a block (unique for every page)?

texts:
I have a block at the top of my site used for an image slider on the home page (using Nivo Slider), and I need to allow the users to add a custom image to fill that block space for any pages created (aside from home page).  This image will be different per page.  How can I do this?

I'm running Drupal 6


texts: How to add "Size" option in my Commerce Product without adding lot of SKU that differs by size?

texts:
The same question was "Module Commerce Product Option. Sizes are not active for selection"

I read here Drupal Commerce Custom Sizes that "it requires you to define a SKU for every possible combination - depending on how many measurements options you have"
But I do not want to add many products. I need to add One product display Woman's T-Shirt with 5 SKU with photos:
Blue, White, Yellow, Green, Orange.
In every SKU I want to check the option sizes like:

Blue with option sizes: S, L
White S, M, L, XL,
Yellow XL, XXL, XXXL
Green L, XL, XXXL
Orange S, L

Without adding lot of SKU like: T-Shirt White S, T-Shirt White M, T-Shirt White L.....

The option Sizes should become dropdown or checkboxes when customer is viewing product Womans T-Shirt. How to do this?

Here it is correct: http://demo.commerceguys.com/ck/tops/drupal-commerce-hoodie
The user can choose color and size. Is this really neccessary to add all variations with color and sizes?

How to solve my optimization problem?


texts:
There is any way to override the content page of a particular content type in drupal 7.

By default the content page has the sidebar on the right hand side and the content is placed on the left side

 Page design:

 Content- width 650px | Left sidebar 500px

Here if the content type is company_profile then the width of the content type should be 1050px and the side bar should be below the content page with width 500px as show in the below image

Can anyone help me how to override the content page when the content type is company_profile


texts: Can AJAX be enabled for a form element inside a tableselect row?

texts:
Firstly, a working select element with an AJAX callback:

public function buildForm(array $form, FormStateInterface $form_state) {

  $form['select'] = [
    '#type' => 'select',
    '#options' => [
      0 => 'ZERO',
      1 => 'ONE',
      2 => 'TWO',
    ],
    '#ajax' => [
      'callback' => [$this, 'ajaxSelectChanged'],
      'event' => 'change',
    ],
  ];

  $form['submit'] = [
    '#type' => 'submit',
    '#value' => t('Submit'),
  ];

  return $form;
}

public function ajaxSelectChanged(array &$form, FormStateInterface $form_state) {
  $selection = $form_state->getValue('select');
  // Do something with the selection.
}

Now I want to put the select element inside a tableselect element...

This comment shows how form elements may be added inside the rows of a tableselect (which is also a form element).

Here's my attempt:

public function buildForm(array $form, FormStateInterface $form_state) {

  // Build the sortable table header.
  $select_options = [
    0 => 'ZERO',
    1 => 'ONE',
    2 => 'TWO',
  ];

  $form['table'] = [
    '#type' => 'tableselect',
    '#header' => [
      'name' => $this->t('Name'),
      'select' => $this->t('Select'),
    ],
    '#options' => [
      'alice' => [
        'name' => $this->t('Alice'),
        'select' => [
          'data' => [
            '#type' => 'select',
            '#options' => $select_options,
            '#ajax' => [
              'callback' => [$this, 'ajaxSelectChanged'],
              'event' => 'change',
            ],
          ],
        ],
      ],
      'bob' => [
        'name' => $this->t('Bob'),
        'select' => [
          'data' => [
            '#type' => 'select',
            '#options' => $select_options,
            '#ajax' => [
              'callback' => [$this, 'ajaxSelectChanged'],
              'event' => 'change',
            ],
          ],
        ],
      ],
    ],
    '#empty' => $this->t('There is nothing to see here.'),
  ];

  $form['submit'] = [
    '#type' => 'submit',
    '#value' => t('Submit'),
  ];

  return $form;
}

public function ajaxSelectChanged(array &$form, FormStateInterface $form_state) {
  $selection = $form_state->getValues();
  // Do something with the selection.
}

It works, except for the AJAX callback, which never runs.

Am I doing something wrong?
Is there a way to let form elements inside a table trigger AJAX callbacks when they are changed?


texts: Update MySQL Table og_membership, how to then update Drupal without Clear All Cache

texts:
New to Drupal and I can't figure this one out. My company wanted an external way of updating a User's group, I found that the groups were located in og_memebership and with a update

UPDATE og_membership SET gid = @gid WHERE etid= @uid

I am able to update all the appropriate rows in MySQL, however it doesn't update Drupal and the old group stays until I do a 'Flush all cache'. I even tried logging out and logging back in, using a different browser, different computer and all no go. I am somewhat afraid of updating the cache through code since I have never done this and/or worked with blobs.

Anyone have any suggestions by chance? (Using Drupal 7, and my Script is run vis C++, SSIS)

Thanks

EDIT:
I did a grep to search for cache and found og_flush_caches , it used an array cache_entity_og_membership and cache_entity_og_membership_type ... after doing a select on both.. the two tables show up null. I will keep searching, but so far no luck with the cache


texts: Recursion when reading field in hook_entity_load

texts:
Is there a preferred approach modifying values?

I need to modify a value when a node loads, but must use other values from the node.  The code below causes recursion errors.

function zzzmodule_entity_load(array $entities, $entity_type_id) {

  foreach ($entities as $entity) {

    if ($entity_type_id === "node" && $entity->hasField('other_field')) {

      $t = $entity->title->value;
      $o = $entity->other_field->value;

      if (empty($o)) {

        $o2 = json_encode($t);

        $entity->set('other_field', $o2);
        $entity->save();
      }

    }

  }

}


texts:
Does anyone know if there is a way to include a button (or just a basic link) next to each comment that is used by admins only and when clicked changes the body of the comment to something like "This comment is inappropriate, please read the blahblahblah"?
I tried with Flag + Rules but failed to make any changes to the comment body whatsoever.
Any ideas?


texts:
I need help with my Views. I have a field called 'Type'. There are eight types of resource. I have managed to get it to distinctly shows only one link to each type of resource by using aggregation. However, for some reason, it doesn't display the Types in the order they are listed in the field list for the content type ie. alphabetically). Anyone know why?

Here's the list as it appears currently in the View:

Conferences
Web Articles
Webinars
Blogs
Books
Certificate or Degrees
Tools

Here's the list I have set in the content type:

Blog|Blog
Book|Book
Certificate or Degree|Certificate or Degree
Conference|Conference
Newsletter|Newsletter
Tool|Tool
Web Article|Web Article
Webinar|Webinar

In the View I also have the following already set:

Sort Criteria: ASC, COUNT DISTINCT
Filter Criteria: COUNT(DISTINCT Content Type) (not empty)
                 Content: Published (Yes)

Changing from ASC to DESC doesn't seem to help.


texts: Geolocation Field Oops! Something went wrong

texts:
I use Geofield Gmap as Field in a Content Type. When I want to Add Node The -MAP- field display Error message

  "Oops! Something went wrong this page didn't load google maps
  correctly. See the javascript console for technical details."

How can I solve it?

BS: I already create API key For google map

UPDATE:

I try to apply a patch, I go to DIR
sites/all/modules/geofield/modules/geofield_map

Then I applied Like this

patch -p1 < https://www.drupal.org/files/issues/fix-api-key-not-being-used-2746209-5.patch

I see this message:

  No such file or directory


texts:
How to use EntityFieldQuery to load the nodes based on available nids. I tried,

$query->propertyCondition('nid', $nid);

and

$query->entityCondition('nid', $nid);

Both of the above didn't work. What would be the right way?


texts: Field content not showing in public view

texts:
I didn't build the website, and I'm new to Drupal.

I've been asked to add a new field to an existing content type. I've added the field, and it shows up on the form for that content type, but the data entered into the form doesn't seem to translate through to the public view.

The site is Drupal 7 & and uses Views. I don't think it's the views module that's the problem, although I've played around a lot with that and learned mostly how that works. The reason I don't think it's the views module is that when I'm looking at the page with the "View" "Edit" tabs, it doesn't show up there either.


texts: Composer Not Getting Latest Version of Module

texts:
I am one of the maintainers of Bootstrap Paragraphs. The module is currently set as the 2.0 branch to be the default and the 1.0 branch is set to unsupported.  The 1.0 had a Beta Release but the 2.0 is currently in Alpha.

When I run composer require drupal/bootstrap_paragraphs composer downloads the 1.0 release ("drupal/bootstrap_paragraphs": "^1.0@beta",) instead of the 2.0 release.

What do we have to do to make the 2.0 branch be downloaded when running composer require drupal/bootstrap_paragraph.  Want to avoid as many people as possible from using the 1.0 branch.


texts:
Merry Christmas to all,
I would like to allow users to log in my site using their Yahoo e-mail.
Is there a module for that?I am using Drupal 7.
Thanks


texts:
I'm a bit stumped. For some reason Drupal prints some extra links and I can't find where are they generated.

This is what I see in my output:

The arrows point to the extra ocurrences of

The template code for this page is like this:

<?php if ($logo): ?>
<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>">
<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />

<?php endif; ?>

<?php if ($site_slogan): ?><?php print $site_slogan; ?><?php endif; ?>

 <?php if ($page['search_box']): ?>

      <?php print render($page['search_box']); ?>

 <?php endif; ?>
 <?php if (theme_get_setting('social_icons')): ?>

<a href="http://www.twitter.com/<?php echo theme_get_setting('twitter_username'); ?>" target="_blank" rel="me"><img src="<?php global $base_url; echo $base_url.'/'.$directory; ?>/images/twitter.png" alt="twitter"/>

<a href="http://www.facebook.com/<?php echo theme_get_setting('facebook_username'); ?>" target="_blank" rel="me"><img src="<?php global $base_url; echo $base_url.'/'.$directory; ?>/images/facebook.png" alt="facebook"/>

<a href="<?php print $front_page . ($language->prefix ? '/' : ''); ?>rss.xml"><img src="<?php global $base_url; echo $base_url.'/'.$directory; ?>/images/rss.png" alt="RSS"/>

<?php endif; ?>

    <?php print render($page['header']); ?>

    <?php
    $main_menu_tree = menu_tree(variable_get('menu_main_links_source', 'main-menu'));
    print drupal_render($main_menu_tree);
    ?>

I've been looking all over the place, and can't find WHERE is that coming from. Searching in site's source code I only found 1 instance of a similar looking URL, inside a Module I disabled and deleted from the host; and still the same thing.

The links appear both before the main menu starts building, and after. Several times for the first menu item, but never again. And it only happens with anonymous users, never with logged in users...

Any pointers in where should I be looking to fix this?

Thanks a lot in advance.

Edit:

I found that the problem lies in this piece of code:

ÁREA DE CLIENTES <img height="14" width="14" src="/sites/default/files/pictures/clipart/key.png"

      <?php print render($page['search_box']); ?>

If I remove the #link-clientes
; the ghost links stop appearing later on. Still don't understand why.


texts:
I have referred many links including the following:

Services module. How to construct the JSON data with session info for creating node?
GitHub
- Creating a node using Services 6.3 REST

I tried several ways to POST a new node to a Drupal site, but I have failed. I have created a sample CCK for storing students data with name, age, gender, DOB, and added some list.

I have installed and configured the Services module (D7), and created a service end point at services.
As expected, GET is the easiest way to get details of a node in JSON. http://localhost/drupal/services/node simply listed all nodes.

I still can't figure out how to use the POST method.

I would like to search for the students whose name contains john. I tried localhost/drupal/services/node&node[name]=john. I used  POST Man plugin for Chrome without success. I also tried some other ways.
I tried adding a new student to the site without success.

Can anyone guide me to make the above work fine?

UPDATE :

I tried adding new nodes of type article . It worked fine. but when i am trying to add nodes of type Department CCK It is showing "s:22:"CSRF validation failed";"
Here are the screen shots

I have gone through the link https://drupal.org/node/2013781

I followed session = session_name=session_id but i still get an error.


texts: How can I limit users to one account each? (Or, how can I detect users who have multiple accounts?)

texts:
For various reasons I would like to limit each individual user to registering/using only one account.  I realize that there is no perfect way to do this, but what can I do within Drupal to detect cases where users have registered and are using multiple accounts?

I plan to set up a view using uiplog to check whether the same IP address is logging out and then immediately logging in to another account, but what else can I do?

Additional information: The site I am working on requires users to complete a fairly lengthy registration form and then additional information on the first time they log in.  As such, I'm primarily concerned about users with multiple accounts trying to game the ratings system within the site.  (Abusive users will be handled through an abuse reporting system.)


texts: How to give default today date value in exposed filter?

texts:
I am using exposed filter condition for date field in views.

I want to see the data in view by current date as default ..for that i am trying to give date field should be default by today date  and when i click on date filter and select on previous date i should see the previous data..

Is this possible by filters.


texts: I'm trying to use core Actions module to send email after new comment has been inserted. I'm doing it with Action::load('<my_mail_action>')->execute([$entity]); executed with function hook_comment_insert(Drupal\Core\Entity\EntityInterface $entity). This works fine. But I don't know, which tokens can I use in email body. I tried to use [comment:entity],etc, but they aren't replaced. I'm using Drupal 8.2


texts: Using multiple templates for the same node & views

texts:
Ok so my problem is this, I want to be able to manage events in a simplistic form on a Drupal 7 site. I created the relevant content type and inserted some dummy content, all is well. I then move on to creating views for displaying this in various forms (1 view for forthcoming events, 1 view for archived/past events). Again these seem to work fine. Now the problem comes when I want to display the views for this content type on the pages for this content type, so you go to an individual event page and you're presented with the relevant information followed by a views block for forthcoming events and a views block for archived events. I've created three templates, one for the content type (node--type.tpl.php) and one for each of the views (node--view--view-name.tpl.php) but the default one is getting overridden on the node page by the what appears to be the last loaded views one. I thought that these were specifically for the views not the default node display for that content type.

Now I am probably just missing something (I'm relatively new to Drupal, I've read through the theming guide and tried searching for similar issues, only managed to find 1 from 2007 which wasn't very helpful, but I've only been using it for the last 2 weeks) but I would like to know why this does this and how to stop it.

Hope this is enough information

Edit: I'm using the latest versions of the following in this: Drupal 7, Views Module, Date Module.


texts: show all the blocks added to the particular page?

texts:
I've been tasked to remove a tracking javascript from a particular URL on our Drupal 7 website. I've grepped our site's codebase for the name of the javascript that's being loaded, but I don't see it.

I need to start combing through content, but I'm looking at making my task easier.

Sometimes our front-end devs will include scripts in blocks. I want to look at all the blocks that are included in my target URL, but I don't see how to do that in the interface.

It seems that I must look at each of our blocks and then see if it's added to the page. I wonder, however, if there is a page somewhere in the admin menu where I can enter the URL I'm looking at and see what blocks are being attached to it.


texts:
So, I have a frontpage where I simply have a big image and a button that leads to a second page. On that page I want this:

Which are two sections. However, when I'm on the contact page I don't want the section Questions?

I want to write this in Html as I don't see how I would create these sections in Drupal. So my question is how can I make sure it's not visible on the contact page ?


texts: How do I prevent a product from being added to the cart?

texts: A common question I hear is "How can I prevent a product from being added to the cart?" There are several reasons why you'd want to do this, most end up being related to some logic being required to determine if a product is eligible without actually deactivating the Add to Cart button.


texts: Can we add different fields to instances of the same entity?

texts:
I have a City entity with two fields (Title and Population), and I have created two instances of that entity.

Can I add different fields to these two instances?

Thank for you responses but I want different approach
Let me put my question in this way

1) I have entity:  City (with fields Population and Title)

2) of which I created two content (what should i call Chicago an New York ? contens of type City or anything else??):

Chicago and New York

3) now i know the entity City is fieldable i.e i can add custome fields to it, but those will be accesible to both ‘Chicago’ and ‘New York

4) What I want is ‘Chicago’ and ‘New York’ also be fieldable and have distinct field as well as common field

5) so, it should look like as
  Chicago : (Title - ‘Chicago’, Population - 1000, CField1 - ‘Hello’)
  New York: (Title - ‘Chicago’, Population - 1000, NField1 - ‘Hello’, NField2 - ‘Hello’)

Please tell me if above requirement is possible to implement


texts: How do I amend roles for the Administer Users by Role module?

texts:
I'm using the Administer Users by Role module. I have a role set up as Publisher which has all the boxes ticked under the "Administer Users by Role" option (under People/Permissions as shown in the picture below):

The Publisher can create/edit users. I have created a menu option for the Publisher user, which has a path of admin/people/edit so they can see all the users, and add a user too.

My problem is that when the Publisher amends or creates an account, they cannot see the Role of the user they are amending, so they only have the option to create an authenticated user or amend an existing user, they cannot amend the role for that user.

However, as administrator I am able to see the role option and set accordingly.

Can anyone advise how to allow this for my Publisher role?


texts: jQuery imageScroll not functioning properly with Drupal 7

texts:
I got the following error message on my Chrome browser when adding jQuery Plugin - Parallax ImageScroll in page--node--xx.tpl.php. The error is the "jquery.imageScroll.js" file not functioning properly. I have tried JavaScript closures solutions from "Working with JavaScript and jQuery" with no luck. I don't know javascript and how to make it run properly.

Error Message on Google Chrome web browser:

Uncaught TypeError: undefined is not a function
_bindEvents
init
(anonymous function)
b.extend.each
b.fn.b.each
$.fn.imageScroll
(anonymous function)
(anonymous function)

The Script I use to call js in page--node--xx.tpl.php

<?php drupal_add_js(drupal_get_path('theme', 'mytheme') .'/js/jquery.imageScroll.js', array('type' => 'file', 'scope' => 'footer')); ?>

I have tired 3 JavaScript closure solutions on jquery.imageScroll.js with no luck

1

(function () {
//all jquery.imageScroll.js script
$('.img-holder').imageScroll({
});
}());

2

(function ($) {
//all jquery.imageScroll.js script
$('.img-holder').imageScroll({
});
}(jQuery));

3

jQuery(document).ready(function($) {
//all jquery.imageScroll.js script
$('.img-holder').imageScroll({
});
});

Update info on Dec. 10, 2014 at 12:58pm.
I solve the error message by updating the jQuery verison using "jQuery Update" module. However, the background image does not display at all.

Update info on Dec 11th, 2014 at 3:34pm
For some reason, I have this new error on Google Chrome and images are still not showing up. They are...

Uncaught TypeError: undefined is not a function
(anonymous function)
b.extend.ready
u


texts: How do I turn off caching of twig templates

texts:
I'm on mac with MAMP.

I've tried to follow this : https://www.drupal.org/node/2598914
and this : Turn off Twig cache

settings.local.php (i have not cut off comments in my file) :

assert_options(ASSERT_ACTIVE, TRUE);
\Drupal\Component\Assertion\Handle::register();
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$config['system.logging']['error_level'] = 'verbose';
$config['system.performance']['css']['preprocess'] = TRUE;
$config['system.performance']['js']['preprocess'] = TRUE;
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
$settings['extension_discovery_scan_tests'] = TRUE;
$settings['rebuild_access'] = TRUE;
$settings['skip_permissions_hardening'] = TRUE;

in y settings.php i've uncommented this :

if (file_exists(__DIR__ . '/settings.local.php')) {
  include __DIR__ . '/settings.local.php';
}

developpement.services.php :

services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory
parameters:
  twig.config:
    debug: true
    auto_reload: true
    cache: false

I call the address localhost:8888/mysite/core/rebuild.php
(in my conf/performance i've uncheck cache and i have clear all caches). But when i go to another page github signale me that i have new caches files :


texts: How do I programmatically create a route?

texts:
I'm trying to create a route programmatically using this code.

example.routing.yml

route_callbacks:
    - '\Drupal\example\Routing\ExampleRoutes::routes'

Drupal\example\Routing\ExampleRoutes.php

namespace Drupal\example\Routing;

use Symfony\Component\Routing\Route;

class ExampleRoutes {
    public function routes() {
        $routes = array();
        $routes['example.settings'] = new Route(
            '/example/',
            array(
              '_form' => '\Drupal\example\Form\ExampleForm',
            ),
            array(
              '_permission'  => 'access content',
            )
        );

        return $routes;
    }

}

When I install the module, I get the following error

  Class \Drupal\example\Routing\ExampleRoutes does not exist

Why doesn't the above code work?


texts: Quick edit many SKU fields in Drupal Commerce

texts: Is there a way to quickly edit many SKU fields in Drupal Commerce? I have the Back Office quick edit and its great for price or stock control, I have also tried editable views but it seems that the SKU field can only be edited by accessing a full edit of the individual product. With 500+ products this could take quite a while. We have a seperate database external to Drupal where the product ids don't correspond to the SKU but would like to make that happen so in the future we could use feeds to import price changes, product title changes etc.


texts: view of unformatted list invalidating cache issues

texts:
I have a view that shows the title of a single content type as an unformatted list. I have an argument for a nid-contextual filter that I pass to the view in

function modulename_views_pre_view($view, $display_id, array &$args) {
 ....
 $args[0] = $filter_value;
 }

The value for the contextual filter is a value the user can select and is set in \Drupal::service('user.private_tempstore'). Every time the user selects a different value from a select form element, the view should show different results. However, it caches the output and only if I clear all caches it shows the correct output. But if I format the view output as a table, then everything works totally fine and the new results are shown immediately.

The cache tags for this view are given as follows:

print_r($view->getCacheTags());
Array ( [0] => config:views.view.users_in_class [1] => node_list )

Do I have to specifically invalidate something here or am I missing something else ? I thought that the cache tag node_list would already be enough. And why are results being cached when having the format as an unformatted list?


texts: Display several user blog entries at once

texts:
I use Blog 7.7 core module to display site updates at http://preferans.de/blog/1

However only 1 news item is always displayed at that link.

Is there maybe a way to change that amount?

I've tried looking around, including admin/content/book/settings


texts: What are the relationships and arguments in Views? How do I use them? I have read some tutorials, but still don't know how to use them. Can someone explain them more clearly? Thank you.


texts: How can I filter for the UID of the node on a view?

texts: I want to have a relationship between the the author of the node ($uid) and the view results, seems straightforward but I'm not getting it. On the view, I've added the relationship to content:author and then used a contextual filter for the nid. Since this is a block view, I've provided the default argument from the url. It seems like I've done the very same thing before, but I'm going crazy with this case. I have noticed this time that the contextual filter doesn't ask whether to use a relationship, which seems odd.


texts: Problem with specialchars/tokens sent by email with rules module

texts:
I'm using rules module in D6

I have an encoding problem in the email's body sent by a rule while using tokens:

Name : [node:field_company_nid-title]

In the email, it appears like that:

Name : L&#039;entreprise exemple

With php it works :

echo htmlspecialchars_decode( $string )

but i'd rather to use tokens !

Thank you for help


texts: How do I build a search form with filter options / checkboxes?

texts:
I'm a noobie to Drupal - recently "converted" from WordPress.

I want to create custom search forms that use checkboxes to allow visitors to search in a specific content type.  Sorry for the shady example, but the search form on the front page of the Pirate Bay is exactly what I'm looking for. It would also be great to be able to set the default option based on context - if the user is on a page of a particular content type, that content type should be set as the default in the search checkboxes.

I've installed Drupal 7, Apache Solr search, and the Facet API. I'd give a link, but it's installed locally on mamp for development.

I want the custom search form because the site I'm building has a lot of different - and interrelated - kinds of information separated into different "areas" of the site defined by content type.  One area is for social service resources, another is for social service organization profiles, another for trainings and workshops, etc.  Each of these use Views to display related information in other content types (i.e. "Related Trainings" listed in the sidebar of a resource page).  In essence, the site maps out the entire social service system in our community and serves as an information center for clients and case workers.

When someone visits our site looking for emergency shelter, for example, the information they are looking for is in the "Resource" content type and I don't want them getting a deluge of info from trainings, org profiles, forums, etc.  Another example would be a case worker wanting training on how to apply for Social Security disability benefits for a client - I want them to be able to choose to restrict search results to the "Training" content type.  Faceted search seems to be able to allow users to drill down and refine results, but I want them to be able to filter before getting results.

Anyone know how I might do this?


texts: How to print an image in a paragraph that references a node with an image field

texts:
I have the following scenario:

I have a paragraph called Timeslot that contains an entity reference field to a content type called Class.

That content type has an image field called Class Badge.

I would like to print the Class Badge image inside this paragraph using a twig template.


texts: Does AJAXify of create relationship link possible out of the box?

texts:
I'm using User Relationship module. I've enabled:

ur
ur_ui
ur_views

and added UR link to View. By default this link work with relationship confirmation form.

Any module/settings in UR to ajaxify this link?


texts: is there supposed to be a default folder in sites/default?

texts:
Just noticed I have a default folder in my sites/default folder so that I have sites/default/files and sites/default/default/files

Found out-
The node with audio file upload is HIDING the file as protection from third party download.That is why only occurring with that particular content type.


texts: How to set and inherit variables within different twig templates?

texts:
I'd like to set a variable in my node.html.twig template:

{% set title = label %}
{{ content }}

The content consists of one field visible only, which has it's own template:

file-link.html.twig

How can I access the title variable of the node template in the file template? I am not sure if importing or extending is the right way since that might cause infinite recursion?

Edit

The file template looks like this (from the bootstrap theme):

{% spaceless %}
  {%
    set classes = [
      icon_only ? 'icon-only',
      not icon_only ? 'icon-' ~ icon_position|clean_class
    ]
  %}

    {% if icon_only %}
      {{ icon }}

        {{ link }}
        {{ file_size }}

    {% else %}
      {% if icon_position == 'after' %}
        {{ link }}{{ file_size }}{{ icon }}
      {% else %}
        {{ icon }}{{ link }}{{ file_size }}
      {% endif %}
    {% endif %}

{% endspaceless %}

Within that template I'd like to print the title of the respective node:

{{ link }}
{{ title }} {# << #}
{{ file_size }}


texts: Content type 'Product Display' not available when creating new View

texts:
I am working through the "Advanced Product Display Listing using Views" guide here.
When creating the new View, I do not have the option to select 'Product Display' as a content type.
Is there a configuration setting I have missed when installing Commerce from scratch?
Thanks,
Geoff.
Drupal 7.67,
Commerce 1


texts:
I would like to render a book tree in Drupal 8. I used to use the Booktree module, but there is not yet a port.

How can I render the structure of book in Drupal 8?

Chapter 1

Section A
Section B

Chapter 2

Section C
Section D


texts: Why is Views "Query Execute Times" so high?

texts:
I have a basic view that shows a list of members and their user points. The views query output show that this query takes over 1500ms to run.
Query build time    24.71 ms
Query execute time  1546.84 ms
View render time    88.29 ms

SELECT users.picture AS users_picture, users.uid AS uid, users.name AS users_name, users.mail AS users_mail, users.created AS users_created, userpoints_total.points AS userpoints_total_points, 'user' AS field_data_field_motorcycle_user_entity_type, 'user' AS field_data_field_review_count_user_entity_type, 'user' AS field_data_field_address_user_entity_type
FROM  {users} users LEFT JOIN {userpoints_total} userpoints_total ON
users.uid = userpoints_total.uid WHERE (( (users.status <> '0') AND
(users.uid NOT IN  ('1')) )) LIMIT 10 OFFSET 0

When I copy and paste that query into myphpadmin and run it there it takes less than 5ms. What else is happening in the "Execute Time"? I coudn't find any good help about that on the web.


texts: I have the problem in url path settings?

texts:
I have  some basic pages in my site, it has url paths.

When i pass the url its works properly.

Eg:

www.mysite.com/about-us it opens perfectly. But my problem is if i pass url as  www.mysite.com/about-us/sgajfsaff(something rondomly) it will also opens the about-us page not goto 404 page.

Is there any solution to redirect it 404 page?

Thanks in advance.


texts: Is it possible to show taxonomy terms in a views filter sorted alphabetically?

texts:
I have some content that is classified using a two-level taxonomy:
Accommodation -> B&B
Accommodation -> Hotels
Accommodation -> Self Catering
Things to Do -> Arts & Crafts
Things to Do -> Family attractions
Eating out -> Cafes
Eating out -> Restaurants

In some situations, I need to display all these categories together in views as a taxonomy filter.

When I do that, they are displayed grouped by the parent term, so they look weirdly random.  Is it possible to break them out from their parent term and show them in the filter sorted alphabetically, or alternatively, show the parent term as well as the child term, so that it's clear why the terms are sorted like that?

I am on Drupal 7, Views 3.11.


texts: What is the proper way to style pages in a new installation of a drupal theme?

texts:
I'm currently working on a new theme for a new drupal site, and have created a new subtheme of the adaptivetheme and am looking to modify  it to match the two psd's I've been given (one for the main page, another for the content found in trhe rest of the site. Originally I was going to copy page.tpl.php over to the subtheme from the at_core/templates directory and modify it's structure, but am wondering if that's considered best proactices drupal wise, ior if i should use modules like panel and views to build the style that I want that way?

So in a nutshell, which is the proper drupal way to style a new site; to use panel/views to match the design that you want, or to modify the tpl files, or a combination of both, or possibly something else that I might have missed?


texts: grouping nodes with collapsible fieldset

texts:
I use entityreference to link nodes to other nodes and field_group to display collapsible fieldsets with fields.

Assume I have node#1 which has a field related_nodes containing node#2, node#3 and node#4.

The display of this node looks like this:

node title

node body

related:
- node#2
- node#3
- node#4

I can use hook_node_view to remove nodes from the related_nodes field on the fly using something like:

unset($node->content['field_info_case_law_references']['#items'][?]);

I want to remove all those nodes (e.g based on their title) and place them in groups, each in a collapsible fieldset within that related: field. so it ends up looking something like this:

node title

node body

related:
+ starting with A (collapsible fieldset)
  - node#2
+ starting with B (collapsible fieldset)
  - node#3
  - node#4

The default collapsible behaviour, html and styling of that I can configure from admin/structure/types/manage/*/display is good enough.

Where should I look at?


texts:
I have a site using just the default ad "group: default" block and am using channels to place ads on certain URLs

The block seems to follow these rules but I have one advert in a channel that appears all over the place and ignores the rules set up for the channel it sits in.

Is this a bug in the system or something that is not set up right in terms of weights/priorities.

Non of my channels are associated with any groups, would this cause a problem?

Any help would be greatly appreciated.


texts:
I see in Drupal documentation about Configuration Management it is adviced to change the location of the sync directory in a production environnement.

But I can't find an explanation about the actual use of this directory. For what does Drupal use it ? (I expect a more accurate answer than "synchronizing", which I can formulate myself but is not very helping...)

And why is it unadvised to keep this directory accessible from the web ? What could be the consequences ?


texts: How to add custom "pay now" button and after submit, redirect to the checkout/orderId page

texts: In the Deal details page I want to add a new button Pay Now and then user clicks it, then redirects to the checkout/orderId page. How is it possible ? Please help.


texts: How do I map attachments submitted via mailhandler?

texts:
In Drupal-7 I'm reading an imap mailbox with mailhandler. I have the mapping setup via feeds. This processes text messages creating a node but messages with attachments don't have the attachments stored.

How do I store the attachments?


texts: Drush is not recognizing Acquia extension

texts:
I am using Acquia and Drush 8.1.8. I am following Acquia's instructions to load Drush extensions and aliases. My ~/.drush directory looks like this:

nickheiner@Nicks-MacBook-Pro.local:~/.drush  λ ls -l ~/.drush/
total 176
-rw-------@ 1 nickheiner  staff  43320 Feb  9 13:25 acapi.drush.php
drwxr-xr-x  6 nickheiner  staff    204 Feb  9 13:26 cache
-rw-------@ 1 nickheiner  staff   6026 Feb  9 13:14 cloudapi.acquia.com.pem
-rw-r--r--  1 nickheiner  staff   7741 Dec 19 16:52 drush.bashrc
-rw-r--r--  1 nickheiner  staff   1937 Dec 19 16:52 drush.complete.sh
-rw-r--r--  1 nickheiner  staff   2811 Dec 19 16:52 drush.prompt.sh
-rw-r--r--  1 nickheiner  staff  13628 Feb  9 13:19 drushrc.php
-rw-------@ 1 nickheiner  staff   1416 Feb  9 13:14 preview1.aliases.drushrc.php

However, Drush is not recognizing the commands:

λ ./drush cache-clear drush
'drush' cache was cleared.                                                [success]

λ ./drush help --filter=acapi
The specified command category acapi does not exist.                      [error]

I am also not seeing the alias:

λ ./drush sa
@none
@self
default

I tried opening up the permissions so they look like the following, but it did not solve the problem:

λ ls -la ~/.drush
total 176
drwxrwxrwx  10 nickheiner  staff    340 Feb 10 10:36 .
drwxr-xr-x+ 57 nickheiner  staff   1938 Feb 10 11:04 ..
-rwxrwxrwx@  1 nickheiner  staff  43320 Feb  9 13:12 acapi.drush.inc
drwxrwxrwx   6 nickheiner  staff    204 Feb  9 13:26 cache
-rwxrwxrwx@  1 nickheiner  staff   6026 Feb  9 13:12 cloudapi.acquia.com.pem
-rwxrwxrwx   1 nickheiner  staff   7741 Dec 19 16:52 drush.bashrc
-rwxrwxrwx   1 nickheiner  staff   1937 Dec 19 16:52 drush.complete.sh
-rwxrwxrwx   1 nickheiner  staff   2811 Dec 19 16:52 drush.prompt.sh
-rwxrwxrwx   1 nickheiner  staff  13628 Feb  9 13:19 drushrc.php
-rwxrwxrwx@  1 nickheiner  staff   1416 Feb  9 13:12 preview1.aliases.drushrc.php

What am I doing wrong?


texts: How do I pass the value of a PHP variable?

texts:
I have the following code in Drupal 6.

drupal_add_js(array(
  'take_control_fb' => array(
      //          'pubKey' => variable_get('take_control_public_key', ''),
      'dataUrl' => base_path() . 'admin/build/take_control/fb/getfiles',
      'appUrl' => take_control_app_url(),
      'appDir' => $appDir,
      'extPath' => $extpath,
      'zipMimes' => take_control_zip_mimes(),
      'dirSeparator' => DIRECTORY_SEPARATOR,
      'validationString' => $validationString,
      'validationToken' => drupal_get_token($validationString),
      'curUserId' => fileowner(file_directory_path()))), 'setting');

I need to convert this, since drupal_add_js() is removed from Drupal 8. I can't use this to pass PHP variables to modulename.js file. How can I pass the PHP variable to JavaScript code?


texts:
I'm working on a site with Varnish enabled, but I notice that the system clear cache pages, according to the expire configuration, also if pages are not changed.
Is it possibile to clear cache only if a page is changed?

Thanks,
Sergej


texts:
I'm hoping someone can help me. I've been stuck on this problem for a while and can't find help. I'm relatively new to theming in drupal, so forgive me if this is a basic question.

I have a taxonomy term reference field on a profile2. The taxonomy term reference has multiple fields (name, poc, number). I would like all the taxonomy fields display on the Profile2 user edit page. This would allow a checklist type effect for each individual's profile. Right now only the taxonomy term name displays on the edit profile2 form.

Is there a hook that I can use to make the Profile2 edit form display all the taxonomy fields?

I was looking at profile2_form_user_profile_form_alter(&$form, &$form_state) but I couldn't get it to work/not sure how to call the taxonomy field in my template.php file.


texts:
I'm using Drupal 8, and I want to change the markup of more_links from more to something like more. I have tried with mytheme_preprocess_container(&$vars) with the help of kint debug to analysis the $vars array. $vars['element']['#markup'] returns more. However, setting it to a value does not applied.
function saidbakr_preprocess_container(&$vars){
 $vars['element']['#markup'] = 'HHHHHHHH';
}

I tried to use the #children but it has a protected property of markup and I don't know to how use the create method?
$vars['element']['#children']->create('HHHHH')

What's the problem here?

Update:
I just have gotten a semi solution, I regard it semi because it depends on a direct echo from template_preprocess_container like the follwoing:
function saidbakr_preprocess_container(&$vars){
  $elem = $vars['element'];
  if ($elem['#type'] == 'more_link'){
    $vars['children'] ='';
    echo str_replace('<a','<a class="btn btn-primary" ', $vars['element']['#children']);
  }
}

I used echo because setting HTML tags string to $vars['children'] leads them to be printed as entities on the page. i.e you see the HTML tag of the link instead of the actual link. Is there any concerns about using direct echo from the preprocess functions?


texts: metatag_display_extender plugin does not exist

texts:
I am migrating a Drupal site over, the following error is being received... I have clear cache, did a rebuild and no luck. Any suggestions

The website encountered an unexpected error. Please try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The
"metatag_display_extender" plugin does not exist. Valid plugin IDs for
Drupal\views\Plugin\ViewsPluginManager are: default in
Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of
core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('metatag_display_extender')
(Line: 16)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('metatag_display_extender',
Array) (Line: 83)
Drupal\Component\Plugin\PluginManagerBase->createInstance('metatag_display_extender')
(Line: 161)
Drupal\views\Plugin\views\display\DisplayPluginBase->initDisplay(Object,
Array) (Line: 91)
Drupal\views\DisplayPluginCollection->initializePlugin('default')
(Line: 38) Drupal\views\DisplayPluginCollection->__construct(Object,
Object) (Line: 728) Drupal\views\ViewExecutable->initDisplay() (Line:
1754) Drupal\views\ViewExecutable->access('page_1') (Line: 60)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func_array(Array, Array) (Line: 100)


texts: How do I enable User 1 rights in minimal installation?

texts:
I have Drupal 8 minimal installation profile and it does not seem to have provided super user status to the first admin account created during the installation process.

How do I enable it?


texts: Get the ID / class of the part of the form that has been repainted with an AJAX callback?

texts:
I have an AJAX form with a callback that fires some JavaScript when the form is submitted.

I need to know what has been repainted. Can I get the class / ID of the parts of the form that have been changed by submitting the form?

AJAX callback:

function _my-module_form_process_callback_js($form, &$form_state) {
  $commands = array();

  $commands[] = array (
    'command' => 'customSomething',
  );

JavaScript:

  Drupal.ajax.prototype.commands.customSomething = function(ajax, response, status) {

    console.log(ajax);

  };

By logging ajax I can see the form ID and class. However I don't belive that the entire form is being repainted. Most of the form is unchanged, its only one fieldset that changes.


texts: How do you get file assets off the server in twig?

texts:
I have a small part of a website that relies on a bunch of csv files. When I built the site I just used the following code to grab the csv files, however I am now getting 404 not found errors.

jQuery.ajax({
      type: "GET",
      url: './data/mapping.csv',
      success: function success(res) {
        var y = $.csv.toObjects(res);
        data = data.concat(y);
      },
      error: function error(e) {
        return console.log(e);
      }
    });

I placed all the csv files into a file named data and placed that file into a library folder under the theme. I then used the {{ directory }} string in place of the ./ to yeild this:

jQuery.ajax({
      type: "GET",
      url: './{{ base_path ~ directory }}/library/data/mapping.csv',
      success: function success(res) {
        var y = $.csv.toObjects(res);
        data = data.concat(y);
      },
      error: function error(e) {
        return console.log(e);
      }
    });

Is there something else I need to include or another way this would be achieved in drupal?


texts: Adding CSS class to fields (Content Types)

texts:
I added a new content type with some fields

I have a field to upload image, I want to add a CSS class to this specific field,
Should I done it via node-file.tpl.php

or via the dashboard and where?


texts: How to display a image and some text instead of unset a field using form_alter hook?

texts:
In D7 I have a field photo on the user account page (user edit form).

I have a conflict between the modules conditional state and simplecrop therefore I like to disable the conditional state module for this field and replaced it by some code in the form_alter hook..

When another field has a value of ok/not oke I can e.g. use the function like

if( set my check here) {
        unset($form['field_photo']);
}

But I do not want to unset the field. I would like to display the image and put some text here.

How to achieve this?


texts: Why can the Views Gantt module not find the DHTMLX Gantt JS library?

texts:
I am trying to use the Views Gantt module and getting nowhere fast.

The Status Report is complaining that it cannot find the dhtmlxgantt JS library in the libraries directory - despite my having checked its presence over and over.

Has anyone any ideas what I might be doing wrong?


texts:
I have script which updating 2000-5000 nodes in loop and performance is poor.
At the moment the code looks like:

foreach($nids as $nid) {
  $node = node_load($nid);
  // updating $node fields
  node_save($node);
}

It's possible optimize it? I don't need revisions, call node_* hooks, just update data.


texts: How can i change the html generated of filter field of views?

texts:
Mi problem is that my field (Filter Date-Popup of views) have the following html:

    <input type="text" maxlength="30" name="date_filter[value][date]" id="edit-date-filter-value-datepicker-popup-0" size="20" value="" class="form-text">
 Format: 2012-09-17

But, in only need the following portion of this html:

    <input type="text" maxlength="30" name="date_filter[value][date]" id="edit-date-filter-value-datepicker-popup-0" size="20" value="" class="form-text">
 Format: 2012-09-17

I try to do with create a template of the filter. With the Theme Information and rewrite the output of this HTML but doesn't work.

I work with Drupal 6 and Views 2

How can i do this? Thanks :D


texts: I have a text field. View select the text field. I entered three numeric values to the text field as 3321,33432 and 110343. In the view, I see the values without the commas. I like to see these numbers as 3,321, 33,432 and 110,343. Is there way I can rewrite the output using comma? Please provide some help.


texts: db_select subquery "In" condition causes PDOexception

texts:
This source should get the 4 most popular top level categories.

The result query works fine when run in phpmyadmin so I must assume the problem is in db_select somewhere.

The resulting query should be: SELECT tid FROM taxonomy_index,name WHERE tid IN(SELECT data.tid FROM taxonomy_term_data AS data JOIN taxonomy_term_hierarchy AS hierarchy ON data.tid=hierarchy.tid WHERE vid=2 AND parent=0) ORDER BY COUNT(nid) ASC LIMIT 0,4

<?php
$vocab = 2;

$subquery = db_select('taxonomy_term_data','data')
  ->fields('data',array('tid'));
$subquery
  ->join('taxonomy_term_hierarchy', 'hierarchy', 'data.tid=hierarchy.tid');
$subquery = $subquery
  ->condition('data.vid',$vocab)      // vid of vocab we want to show
  ->condition('hierarchy.parent',0);  // tid of parent (We want toplevel terms)

$toplvlcats = db_select('taxonomy_index','index');
$toplvlcats
  ->join('taxonomy_term_data','data','index.tid=data.tid');
$toplvlcats = $toplvlcats
  ->fields('index',array('nid'))
  ->fields('data',array('name'))
  ->condition('index.tid',$subquery,'IN') // Sift through toplevel terms
  ->orderBy('COUNT(nid)','ASC')           // For the one with the most posts
  ->range(0,4)
  ->execute();
?>

The error message is:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index INNER JOIN taxonomy_term_data data ON index.tid=data.tid WHERE (index.tid' at line 1: SELECT index.nid AS nid, data.name AS name FROM {taxonomy_index} index INNER JOIN {taxonomy_term_data} data ON index.tid=data.tid WHERE (index.tid IN (SELECT data.tid AS tid FROM {taxonomy_term_data} data INNER JOIN {taxonomy_term_hierarchy} hierarchy ON data.tid=hierarchy.tid WHERE (data.vid = :db_condition_placeholder_0) AND (hierarchy.parent = :db_condition_placeholder_1) )) ORDER BY COUNT(nid) ASC LIMIT 4 OFFSET 0; Array ( [:db_condition_placeholder_0] => 2 [:db_condition_placeholder_1] => 0 ) in eval() (regel 25 van /home/j/www/modules/php/php.module(80) : eval()'d code).


texts: Using Drupal's database for Apache authentication

texts:
I have static content outside of Drupal that I need to password protect using the users's existing credentials in Drupal. I found an apache module that lets you use MySQL for Apache authentication:

http://sourceforge.net/projects/modauthmysql/

Unfortunately, this doesn't support sha-2 (sha512) that Drupal 7 uses.

Does anyone know of any alternative ways to do this? I'd like to avoid wrapping all this content in PHP because it's generated (and regularly updated) by a tool, has any number of relative links and folders and such, and the only way I can think of handling that with PHP outside of modifying the files is to use mod_rewrite to route all the requests for html files through some sort of front controller that is a Drupal module (or a bootstrapped Drupal).


texts: Why do I have to add main-menu under features[] in the theme info file?

texts:
I have seen other themes that just define regions and then use drupals theme() function in the page.tpl.php to print the Main menu wherever the developer pleases.

This was not the case for me, and I spent a lot of time figuring out that for some reason I had to both add 'features[] = main_menu' into the theme .info file, as well as going to 'admin/appearance/settings/themename' and enable the feature before it will display.

I'm having trouble understanding why this is the case, and hope someone can elucidate or at least point me towards some enlightening documentation.  Thanks.


texts: How to add a new user permission "Translate own nodes" ?

texts:
Looking for this Translation own nodes module but for Drupal 7.

The goal is to create a new permission to "Translate own nodes".


texts: Are there existing modules to group nodes and give sequential access to them in Drupal 7

texts:
I want to be able to select a set of nodes, put those in a specific order (or make them dependent on each other) and give a group of users access to the set. However, I want the nodes to be read sequentially so users cannot start reading node 2 if they have not seen/read node 1.

I would very much like to use existing modules to accomplish this if possible. I have just spent an hour on the Drupal modules site and I'm a bit overwhelmed by the possibilities. I have not found one that does exactly what I want and although it seems possible by combining a few, most require a more in-depth understanding of the module to make a good assessment.

If you have a suggestion for one of my requirements, that would also be very welcome.


texts: How to resolve the error encountered while trying to import a rule using the Rules module?

texts:
I have created a rule by using php code,i want to import it.When i click on import button it is showing that import block border as red(shown in the fig..)

Image

Code

And my code is shown in below,

{ "rules_send_warning_email" : {
    "LABEL" : "Send Warning Email",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "user_update" : [] },
    "IF" : [
      { "text_matches" : { "text" : [ "site:current-user:field-warnings" ], "match" : "New litter" } }
    ],
    "DO" : [
      { "mail" : {
          "to" : "[site:mail]",
          "subject" : "New litter was born",
          "message" : "[site:current-user] selected new litter",
          "language" : [ "" ]
        }
      }
    ]
  }
}


texts: Why ajax form doesn't work after paging by Views Infinite Scroll?

texts:
I have a view of node teasers. I have added custom form to every teaser. Form is submitted via Ajax (in theory).

Code for submit button:

$form['my_module_form']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Send'),
    '#ajax' => array(
      'callback' => 'my_module_form_ajax_callback',
    ),
  );

Form is added in hook_node_view like:

$content['my_module_form'] = drupal_get_form('my_module_form', $node);

Anyway after loading content by autopager ajax event isn't attached to any of new forms.

I looked to the views_infinite_scroll.js and events are attached:

Drupal.attachBehaviors(this);

but it doesn't work in my case.

Ajax works like expected on content loaded via normal page refresh. Forms from content loaded via pager, submit only as a normal request (no ajax)

I have posted it in module issues, but without any feedback, so I'm trying here.


texts: Running PHPUnit test from CLI and debug in PhpStorm: Remote file path '/directory/path/-' is not mapped to any file in project

texts:
I'm trying to execute a PHPUnit test via the CLI to debug in via PhpStorm, being on a Ubuntu 16.04 operating system. It's a KernelTestBase unit test for Drupal 8. The normal execution of the test - without PhpStorm and Xdebug - works. The problem appears, when I have XDebug switched on. I'm executing it that way from the terminal:

  peter@computer ~/Websites/pbt-d8 $ vendor/bin/phpunit -c
  modules/permissions_by_term
  modules/permissions_by_term/tests/src/Kernel/SelectTermTest.php

If XDebug is switched on, PhpStorm shows me a weird "Remote file path error":

  Remote file path '/home/peter/Websites/pbt-d8/-' is not mapped to any
  file path in project

I have also attached a screenshot of the debug window:

What confuses me here, is the "-" character at the end of the path. I have not specified this character anywhere.

I have no idea what I should define here as a path mapping within PhpStorm:

My phpunit.xml file (which is located at modules/permissions_by_term/phpunit.xml) looks like follows:

<phpunit bootstrap="tests/bootstrap.php" colors="true"
         beStrictAboutTestsThatDoNotTestAnything="true"
         beStrictAboutOutputDuringTests="true"
         beStrictAboutChangesToGlobalState="true"
         checkForUnintentionallyCoveredCode="false"
         printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter">
  <php>
    <!-- Set error reporting to E_ALL. -->
    <ini name="error_reporting" value="32767"/>
    <!-- Do not limit the amount of memory tests take to run. -->
    <ini name="memory_limit" value="-1"/>
    <!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
    <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix -->
    <env name="SIMPLETEST_DB" value="mysql://root:password@localhost/pbt-d8"/>
    <env name="SIMPLETEST_BASE_URL" value="http://pbt-d8"/>
    <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
    <env name="BROWSERTEST_OUTPUT_DIRECTORY" value="/home/peter/d8-tests"/>
    <env name="PHP_IDE_CONFIG" value="serverName=pbt-d8"/>
    <env name="XDEBUG_CONFIG" value="remote_enable=1 remote_mode=req remote_port=9000 remote_host=127.0.0.1 remote_connect_back=0"/>
  </php>
</phpunit>

Do you know what's wrong here? Do I need any specific XDebug configuration to fix this issue here?


texts: How to delete/block a list of users contained in a CSV file?

texts:
I'm looking for a solution that allows me to delete/block users from a CSV file.

Here is more information of the solution that I'm looking for:

I have a CSV with a list of users that are spam or not responding to emails. I would take that list and give it to a Drupal module and corresponding delete or block or make inactive users.

Ideally, it would work like logintoboggan:

Disable the account and keep its content.
Disable the account and unpublish its content.
Delete the account and make its content belong to the Anonymous user.
Delete the account and its content."

User should be able to set that for the batch.

How can I achieve this? If there is a module that can take me to a similar direction, that would be fine too.


texts: How to correctly specify image links in a content type?

texts: How to correctly specify img src  like  inside a content like Basic page or Blog, which does not break even when  site is accessed as   http:/example.com/drupalsite or  http://example.com/ and  while accessing as  http:/example.com/node/2 or  http://example.com/path-auto-title ?