texts: how to get the expanded menu tree of a menu link?

texts:
I have the following menu items
- Menu item 1
--  Menu item 1 child
- Menu item 2
- Menu item 3
--  Menu item 3 child
- Menu item 4

I have the id of the Menu item 3 like menu_link_content:bda6f3cc-966d-41de-ba72-6d82f8933a00 . How can I display all the siblings of this menu item and also this menu item as expanded. i-e
- Menu item 1
- Menu item 2
- Menu item 3
--  Menu item 3 child
- Menu item 4

I tried the following code.
$params = new MenuTreeParameters();

// Set the root only if a child item was selected.
$params->addExpandedParents(['menu_link_content:bda6f3cc-966d-41de-ba72-6d82f8933a00']);

$menu_tree = $this->menuLinkTree->load($menu, $params);
$menu_tree = $this->menuLinkTree->transform($menu_tree, [
  ['callable' => 'menu.default_tree_manipulators:generateIndexAndSort'],
  ['callable' => 'paddle.menu_tree_manipulators:filterByCurrentLanguage'],
]);

But this is not displaying the results like I want?
It only displays the child that menu item. How can I achieve it?


texts:
I am using Drupal 7.9 and Webform 3.15. I need to translate -select- option on top of list box. Also I have to translate in Captcha module (7.x-1.0-beta2), the text What code is in the image? and Enter the characters shown in the image. How can do this?

How can I translate modules to required language?


texts: How do I cache my custom entities using entity api with entitycache?

texts:
I have implemented custom entites, extending on Entity API. This is essentially identical to what the Model module does with a few extra customisations (fields, solr/facet integration etc).

I want to cache my custom entities using the Entity Cache module to get fast loading of entities when using Views and Apachesolr along with automatic cache updating when my entities are updated.

What do I have to do to implement this?


texts: How do I enable the "extra" stuff in the OpenPublic distribution?

texts:
OpenPublic is a Drupal distribution that is supposed to be for NGOs (and government).  I've downloaded and installed the distribution as a tarball from their site using the big download button.

The tarball is about twice the size of a basic Drupal 7.22 core tarball, so I assume there are some extra stuff included in this distribution.

However, after following the instructions for installation (they refer to the standard instructions for installing Drupal 7), I am looking at a completely plain vanilla Drupal 7 website.  No additional themes, no additional content types, no additional functionality.

I've been hunting high and low for documentation for what to do post-installation with this distribution and come up with nothing.

There is a support group for the distribution at groups.drupal.org, but it is not very responsive, for instance, this question was asked on Jan 18th, with no reply yet.

I am asking here, hoping that someone here is familiar with this distribution and can provide me with the recipe of how about to "unlock" whatever this distribution has to offer, or—even better—provide a link to the missing manual.


texts:
My problem is related to Drupal and the use of the JCarousel module for my views. I'm having a few problems with this, namely in getting a jcarousel like view style but with 2 rows instead of one. With the following jcarousel-view.tpl.php in my theme folder, I was able to somewhat get further:

<?php
  /**
   * @file jcarousel-view.tpl.php
   * View template to display a list as a carousel.
   */
?>
<ul class="<?php print $jcarousel_classes; ?>">
  <?php $i=0; $rows_number=2; //you can change the number of rows ?>
  <?php foreach ($rows as $id => $row): ?>
    <?php if ($i % $rows_number == 0): ?>
      <li class="<?php print $classes[$id]; ?>">
    <?php endif; ?>
    <?php print $row; ?>
    <?php if ($i % $rows_number == ($rows_number - 1)): ?>

    <?php endif; ?>
    <?php $i++; ?>
  <?php endforeach; ?>
  <?php if ($i % $rows_number != 0): ?>

  <?php endif; ?>

Here is the end result:

As you can see, it groups each set of fields for each item into a common column and not separated, so I cannot create a full border for each individual item.

How can I resolve this?


texts: Fetching(GET) image url with applied image styles using jsonapi module

texts:
Looking to make request using the jsonapi module to GET all urls that point to the images optimized version of the image.

If I use the Drupal front-end with Twig and view my page and inspect the images on the page I get something like this

http://local.mysite.com/sites/default/files/styles/promo_background_image/public/promo-backgrounds/MYIMAGE.png?h=df23a951&itok=fslZ-kmD

If I make a request to my api endpoint and drill down to the image field it does not have the included image style url.
```

{
"data": {
    "type": "file--file",
    "id": "b74b73fb-19fd-48a2-ac91-8a7aacd7fe18",
    "attributes": {
        "fid": 2,
        "uuid": "b74b73fb-19fd-48a2-ac91-8a7aacd7fe18",
        "langcode": "en",
        "filename": "MYIMAGE.png",
        "uri": "public://promo-backgrounds/MYIMAGE.png",
        "filemime": "image/png",
        "filesize": 37624,
        "status": true,
        "created": 1508723420,
        "changed": 1508723610,
        "url": "/sites/default/files/promo-backgrounds/MYIMAGE.png"
    },
    "relationships": {
        "uid": {
            "data": {
                "type": "user--user",
                "id": "b044b880-ab4e-495b-b2d1-6a4fe58dc609"
            },
            "links": {
                "self": "http://local.mysite.com/api/file/file/b74b73fb-19fd-48a2-ac91-8a7aacd7fe18/relationships/uid?language=en",
                "related": "http://local.mysite.com/api/file/file/b74b73fb-19fd-48a2-ac91-8a7aacd7fe18/uid?language=en"
            }
        }
    },
    "links": {
        "self": "http://local.mysite.com/api/file/file/b74b73fb-19fd-48a2-ac91-8a7aacd7fe18?language=en"
    }
},
"links": {
    "self": "http://local.mysite.com/api/file/file/b74b73fb-19fd-48a2-ac91-8a7aacd7fe18?language=en"
}

}

```

How can one get access the image style uri using the jsonapi as my api server?


texts:
In my Drupal 7 site, I inserted values into the 'surname' and 'date of birth' fields of my database tables. I want to prevent new users whose username and date of birth do not match those on my database from being able to log into my site.
How do I achieve this?
Thank you in anticipation.


texts: How to establish a condition to show another view if the first view has no results?

texts: I have some blocks with views that show upcoming events of different categories. Now, if one category has no results, how can i trigger another views-block with another category (that is normally not displayed)? I was trying to get this done with the context-module, but i have only the possibilty to create a context IF a view is shown...


texts:
I try to make a custom view using templates. I need to print one certain field at the last row, after all other fields have been printed like so:

--1st row
field1
field2
--2nd row
field1a
field2a
--last row
myfield

I can manage to display a custom field inside field template like so:

<?php print $fields['title_1']->content; ?>

However there are few problems:
1/to display the field as needed, I should print the field inside row template - but above code doe's not work inside row template, only inside field template.
2/the field get's printed twice - as normal field and as a field called directly from template as well.

The questios are
1/how can I print a field called from other than field template?
2/To prevent printing the field twice, I assume I need to exclude it from display, but after that it is not available inside template.
I found this article https://drupal.org/node/687046 where people say it is possible. I used following code but it is not working

print_r($view->result[$id]node_data_field_title_1_field_title_1_value)

can anyone point me to right direction?

Thank you

ANSWER: the correct code to put inside row template is

print $view->result[$id]->node_title

this displays excluded field


texts: Why are all files (except index.php) being redirected to 'index.html'?

texts:
We have a Drupal 7 Drupal Commerce site that we've just moved to our virtual private apache server, however we're seeing very strange behaviour that's making the site not work.

We're getting a strange problem where many files (images, CSS, JS) are getting "307: Temporary redirect"s to 'index.html', which doesn't even exist.

We have a very ordinary apache setup (no unusual settings), and the htaccess file of our website is straight from Drupal core - we haven't edited ourselves.

Is this a problem with the way we've set up Drupal, apache, DNS, or something else?


texts:
I need to do a string replacment with php on a title field in views 3 / drupal 6.So i would to know the best way because after research i found these:

use Views PHP module
use Computed fields module
use PHP in the views template
use a template file   like field.tpl.php (only for D7 ?)

Thanks for tips.


texts: custom field in product type not showing in line item drupal

texts:
ive created custom fields in my product type.

then i have this code under my custom module

global $user;
$order = commerce_cart_order_load($user->uid);
if($order) {
     $line_item_list = $order->commerce_line_items["und"];
     foreach ($line_item_list as $key => $value) {
         $line_item = commerce_line_item_load($value["line_item_id"]);
         drupal_set_message('<pre>' . print_r($line_item, TRUE) . '</pre>');
     }
}

i tried to print per line item to, but i cant see my custom field in the print...

anyone experienced this?


texts: Rules UI, accessing a Variable created in another rule

texts:
Any idea how to access a Variable created in another rule. I am trying to use the Data Comparison in the conditions section. Is doing this even possible or are Variables only visible within the Rule they were created?

Thanks


texts: How to map fields from content type to user Profile

texts:
I am using a content type named application

There are some fields I like to map to the users profile to use them with panels.

For example there are fields called:

name -->textfield
nickman-->textfield
birthday--> date
about-->text with summery
etc

Now I would like to map the content of these fields to the same fields used in the users profile to display the information the users had entered in their applications.

How could I do that? Where to start to find more about field mappings?

Thank you guys and gals!


texts: Override module function in my custom module?

texts:
I am using module Mixpanel in my site. And I want to override function of this module. Here is link where we can see the function or code which I need to alter CODE NEED TO MODIFIED

Below is the code line which suggest that I can override this function :

    // Let other modules alter the defaults.
    drupal_alter('mixpanel_defaults', $properties, $account);

So from above line I am trying to override it with code as below, please let me know what I am doing wrong as it does not make any changes. However if I do same thing in main module it make changes but I don't want to make change in module but want to do in my custom module.

My custom module name: custom

function custom_mixpanel_defaults_alter($properties, $account) {

  $properties['distinct_id'] = $account->name;

}

When i see in system table weight of my custom module is 1000 and weight of Mixpanel is 0.

Please suggest! Thanks


texts:
Due to lack of php knowledge i cant find where i am mistaken and how it`s better to do this. I have several languages one of them LTR and the other RTL and i need sidebars to be displayed vice-versa. It means that in LTR menu would be in the first and in the RTL it would be in the second sidebar. The code returns '1' somehow and breaks the markup.
Please help me to modify this code:

global $language;
switch ($language->language) {
case "en":
if ($page["sidebar_first"]):
print "".print render($page['sidebar_first'])."";
endif;
if ($page["sidebar_second"]):
print "".print render($page['sidebar_second'])."";
endif;
break;
case "ar":
if ($page["sidebar_second"]):
print "".print render($page['sidebar_second'])."";
endif;
if ($page["sidebar_first"]):
print "".print render($page['sidebar_first'])."";
endif;
break;
}


texts: Taxonomy autocomplete widget with term depth settings

texts:
Is there a module (or custom code) to implement a widget for taxonomy autocomplete (>=1k terms) having term depth settings?
Settings could be like to control term level variable depth, rules and permissions integration, etc. in order to let (&control) users classify its own content in a clean ui?

I made some research in this amazing site (and Google) reading every post concerning this matter with little luck (tags: autocomplete, add/edit nodes, widgets, taxonomy, D7)

I have tried the following outstanding modules:
    Heriatrical select,
    Autocomplete deluxe,
    Autocomplete hieratical widges,
    Select with style,
    Taxonomy autocomplete,
Autocomplete Widgets for Text and Number Fields,
Taxonomy Autocomplete Settings,
Hierarchical Select,
Taxonomy Term Reference Tree Widget,
Search Autocomplete,
Taxonomy Access Control,
Simple hieratical select,
Hierarchical Term Reference Autocomplete (best one, but no settings for depth)

None of them render what I am looking for; I’m kind of newbie with Drupal and coding and may be missing another approach like node reference or something similar;  Solr or Acquia search add any advantage?  I will be very pleased if you can give me some help.
Thanks in advance DRUPAL Friends, greetings from Mexico.


texts: validation function not being called on submit but gets called on delete

texts:
My validation function gets called when 'deleting' the node but isn't getting called while 'submitting' the form. Moreover, the function works perfectly when tested on the offline copy of my site. That means there is no problem with the function.

I first tried 'field validation module' on my production site which too was working smoothly on the offline copy of my site but disappointed on the production site. And now same is the story with my custom validation function.

Can this be rules or some other setting which is causing the issue??

Please help!


texts:
Please could someone explain why the following doesn't work?

This is in the form build:

$form['#theme'] = 'some_form';

Here's the hook_theme function:

function MYMODULE_theme($existing, $type, $theme, $path) {
    return array(
      'some_form' => array(
        'template' => 'some-form',
        'variables' => array('form' => NULL),
      ),
    );
}

The template (some-form.tpl.php):

<div id="some-form">
<?php print render($form); ?>
</div>

You can see the wrapper markup from the template file but the form is not being output.


texts: Why does using an empty call hook_exit call create an error?

texts:
I added the following code to MY_MODULE.

function MY_MODULE_exit() {
}

Since I did it, I get this error message:

  Fatal error: Call to undefined function answers_question_locked_p() in MY_MODULE.module on line 178

The line happens to be within MY_MODULE_node_view(). Any thoughts on why this behavior occurs?

The code on line 177-179 is the following.

if ($view_mode == 'full') {
  if (answers_question_locked_p($node)) {
    $node->content['lock_message'] = array(
      // ...
    );

    // Omissis.
  }
}

This code does not cause errors when the empty hook_exit() is deleted and the cache cleared.


texts: Theme "seven" – how to allow regular users edit content with this theme?

texts:
please instruct me how to allow regular users (non-admins) to use Seven theme to edit content. Now users are forced to edit content using the default drupal theme which wasn't designed for this purpose (looks ugly).
Is it matter of some permission? Admins are editing with Seven theme without problem.

I've found some topics about more complex cases with module recommendations like this:
http://drupal.org/project/themekey . As my case is pretty simple, I decided to ask!

Cheers!


texts: Setting the default value for a text field as a variable in Form API

texts:
I thought this would be straight forward but my lack of drupal knowledge is holing me back. I want to grab the email from the logged in user, and set it as the default value of the form. I can grab the email from the global user logged in, but cannot pass this to the form?

The email field is blank, but I have the email stored in $email1 I want to place this value in the text box, as the default field.

global $user;
    $user_full = user_load($user->uid);
    $email1= $user_full ->mail;
    echo $email1;

 $form['admin_email'] = array (
 '#type' => 'textfield',
 '#title' => t('Admin Email need email validation!!!'),
 '#description' => t('Please enter an Email'),
 '#default_value' => $user_full->mail,
 );


texts: Group nodes based on authors (the current user, and the rest of users)

texts:
I know how to group fields based on UID using Views.
but Id like to know how I am able to do that only into two groups:

The nodes that I created myself
The nodes that the rest of the users have created

is this possible to do so in ONE view?


texts: Exposed filter - based on first three number in Zipcode?

texts:
I have been using Basic Exposed Filter for filtering the zipcode(Number) field.

Now, I want to filter based on the first three number, though the 5 digits number is entered.

How do I achieve this ?


texts:
I'm using drupal 7, and I'm having a lot of trouble using the webforms.

I have a set of radio buttons, but each radio button needs to have an associated input field with it.

Code example:

<input type="radio" name="derp" /> option 1 : option 1 quantity desired: <input type="number" />

Note that this would span multiple rows, and is just to show the "layout" I am trying to achieve.

How can I add a "set" of input elements to a webforms radio select field?

Optional to answer but extra question: when I try to inject javascript into the webform using the markup option, my code is simply printed out onto the screen instead of being interpreted. Anybody know why?


texts: Where can I declare the compute field function?

texts:
Computed fields have a computed_field_YOUR_FIELD_MACHINE_NAME_compute() function to compute the field value.

In Drupal in which module I use this?


texts:
when i try to change the attribute field settings under my custom field in my product to radio buttons, it does not display anything in the product display content type anymore, but when i change it back to select list, its okay..

i want to use radio buttons because i want to style it..

the one circled in red is in select list, while the one ricled in blue is in radio button.
here's the attribute field, when i change it to radio buttons, it does not display anything in the prodcut display page. really blank..

EDIT:
so i found the problem, the node cant handle too many radio button.. i tried creating a custom line item, then added to fields, first field is users>list(integer)>checkbox/radio button, it is fine, but when i added the 2nd field storage_size>list(text)>checkbox/radio button, it doenst show anything again,

my conclusion, too many radio buttons in that node will make it display nothing.. any workaround regarding this problem? Thank you!!


texts:
Some background: On the site I'm maintaining, I installed Internationalization module and also enabled Node Translation. I added a few languages, then set a node's language to French and site default language to English.

When the site's current language is set to French, the node shows up as en/node/28, however shows up as fr/sous-specialites when the current language is French. How do I work this around?

UPDATE: Detection and Selection page has URL, Session, User and Browser enabled.


texts: Wrapping fields together in a Views Exposed Filter

texts:
I'm trying to insert divs (or any tag) in my exposed filter form with the purpose of grouping related fields together. I want to have something like this:

  field one
  field two
  ...

So far, I have tried this in my hook_form_alter(), with no luck, since the prefix and sufix are added within field_one, instead of before field one and after field two:

$form['field_one']['#prefix'] = '
';
$form['field_two']['#suffix'] = '
';

How can I accomplish this (without external modules)?


texts:
When I add an additional "onsubmit" function to the login button, the login doesnt continue
this is my code function xxx_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
 if ($form_id=='user_login_form') {
    // Add a custom submit handler to save the array of types back to the config file.
    $form['actions']['submit']['#submit'][] = 'xxx_form_submit';
  }
}

and it goes through the submit but doesnt continue the login functionality.


texts: Is it possible to use taxonomy term's field as exposed filter in Services Views?

texts:
I would like create a REST endpoint which would allow a user to pass a query parameter that is incidentally a field of a taxonomy term. I am trying to achieve this by using Services Views in Drupal 7.

To simplify the problem, let's say I have a list of players and each player has a name and a skill level. For example, the unfiltered JSON output of my API would be

   [{"name": "John98","level": "Beginner"}, ...
    {"name": "PetePete", "level": "Advanced"}]

But the level is actually a taxonomy term, that also has a "min_points" integer field, for example 0 for "beginner" and 50 for "advanced" and 1000 for "expert".

In my API would like to do smth like
http://example.com/api/players?points>45 and get all the players with levels that correspond to more than 45 points.

Is this possible to achieve? Thank you in advance for any input.


texts: Drupal running behind a proxy send emails with links to the wrong domain/IP

texts:
So I have a public site http://www.mysite.com with the following vhost entry:

ProxyPass /press http://123.45.67.89/press
ProxyPassReverse /press http://123.45.67.89/press

And I have a Drupal site running at http://123.45.67.89/press ready to receive requests.

All works fine except emails sent from the Drupal site come through as:

http://123.45.67.89/press/user/reset/1/1384468691/3WY1S7QUJK8Wdp78U9Itu2ygw-KenVLY_9mgBZeTOy8

Which is not accessible to the general public, and instead needs to output:

http://www.mysite.com/press/user/reset/1/1384468691/3WY1S7QUJK8Wdp78U9Itu2ygw-KenVLY_9mgBZeTOy8

How can I trick Drupal to think it's being accessed on the desired domain? Thanks for any advice.


texts: D7: jQuery script for creating 'active' links in menu system. (partially works)

texts:
This is such a pity D7 does not have by default active links sets in the menu system. I mean everyone likes to have a clue where he is in the site by the active state of the menu.

I wonder why there is no such default feature in Drupal7?

Now I tried to do this in jQuery like this (see below) but it only works for predictable URL like static pages (it doesn't work for menu links created out of taxonomy terms). If someone can help me make it work for all the links in the menu I would appreciate.

  <script type="text/javascript">
  /*Script for creating active links*/
  $(document).ready(function(){
   var currentURL = document.location.pathname;
   var activeTopLevelPageArray = currentURL.split('/');
   var activeTopLevelPage = activeTopLevelPageArray[1];

   // applying the class to what we find
   $('#header ul li a[href^=/'+activeTopLevelPage+']')
    .addClass('active');
   // now making the nav menu do what we want with styles for the active element
    $('#header #primary-menu ul li a.active:first')
    .addClass('current-main') // assign main active bg to active link
    .parent('li') // select the parent list item
      .addClass('active-trail'); // then assign a class to it for manipulation

    /* If there is no match, just activate the "home" menu item/tab */
    var isActive = $('#header #primary-menu li.active-trail').size();
    if (isActive < 1) {
    $('#header #primary-menu li:first').addClass('active-trail');
    }
});
  </script>


texts: Where to render? Preprocess or template?

texts:
We are constantly improving our coding performance and we are monitoring every page load to optimize loading en rendering times in our websites.
Above statement in mind, I stumbled upon the question where should we render the renderable arrays?

If you render them in your preprocessor, the template keeps pretty neat since you're only printing variables.

Preprocessor:

function template_preprocess_node__faq(&$variables) {
    $node = node_load($variables['nid']);
    $node_style = node_view($node, $variables['view_mode']);

    $faq_sets = array(
      '#theme'  => 'my_module_faq_set',
      '#sets'   => $variables['field_faq_set'],
    );

    $variables['faq_image']   = render($node_style['field_faq_image']);
}

Template:

<div class="faq_image">
     <?php print $faq_image; ?>
</div>

However, I'm not sure it this is the proper/fastest/neatest way to preprocess and print variables.

Drupal isn't consisting in this matter either I guess... In the default node.tpl.php variables are rendered while in other default templates (like html.php.php), variables are just printed.

Does anyone have a rule and/or some tips and advices on how to tackle this issue the cleanest and fastest way?


texts: Can't edit views even though I have admin rights. Says user not authorized. Help me understand please

texts: I am working on my college website and the professor created an admin account for me. I have been able to do pretty much everything on this website but it won't let me edit any Views which is the main thing I am supposed to work on. Yes, I am beginner in Drupal, so please be nice. What could be the reason for me not being allowed to edit views? Should I talk to my IT helpdesk?


texts: Create a new node by program and fill the specific field automatically

texts:
the goal of my program is to create a content of the specific content type

The specific content type (called A content type),have three fields:title,body,select option

when the user press a button, and the program will lead the user to the edit content page.

But the select option field will select the option i want and the AUTHENTICATED user can't

change this field.

How can i do?

the method i think is create a new node and fill the select field by programming. After

that, lead the user to the edit page of  the node  i just created.

but i still can't disable the select field

Does anybody have the suggestion? thx a lot !

i am not good at english. i hope you understand what i ask ?


texts:
I'm trying to figure out how I can get the path of a node via entity query. So far I've managed to fetch the title of the node but I can seem to find a solution on how to get the node path/url. Here is a sample of my code

$facultyPostings = $query->get('node')
                           ->condition('status', 1, '=')
                           ->condition('type', 'careers')
                           ->condition('field_career_directory', 'Faculty Postings', '=')
                           ->sort('created')
                           ->execute();

foreach ($facultyPostings as $key => $faculty_postings_careers) {

     $careersNode = _nodeLoad($faculty_postings_careers);

    $variables['faculty_postings'][$key]['title'] = $careersNode->get('title')->value;
    $variables['faculty_postings'][$key]['path'] = $careersNode->get('path')->value;
}


texts:
On one of my sites, I have over 600 Profile 2 profile types (most of them have between 20-30 field instances, some have additional fields just used in that one type). I've tested a few different methods for bulk deletion, but can't find a way using the Entity/Profile APIs to get the deletion to occur without basically wiping out the site for a few hours.

It seems that, when a content type, profile type, etc. is deleted, a ton of caches are cleared and rebuilt for each deletion, meaning the process goes something like:

Delete the entity type. (I do this part.)
All the attached field instances are deleted.
All the attached fields that have no other instances are deleted.
All the field info and entity caches are cleared.
All the caches are rebuilt (due to other visitors on the site trying to load pages which need those caches).
Ready to delete another entity type.

Is there any quicker way of mass-deleting entity types (I've already removed all the entities themselves—they're quite simple and fast to remove)? I'd like to cut out steps 4 and 5, which take about 90 seconds.

(I changed to a different system for storing profiles, because the cache rebuild and memory requirements were getting out of hand with over 500 profile types (in addition to 20 other content types), and over 10,000 field instances!)


texts: Loading an Ajax form through Ajax (Magnific Popup)

texts:
I'm trying to load an Ajax form using the Magnific Popup Ajax type and as expected the returned Form is not Ajaxified as I need to attach behaviors to it.

However, following other related issues didn't help me.
A very similar issue was described on Drupal.attachBehaviours() on Block that got rendered via ajax call but still, I can't make it work.

Here is what I have.

The controller returning the Form (through a theme):

class MemberPhotoEditController extends ControllerBase {

  public function content($photo_id) {
    if (!empty($photo_id)) {
      $node = Node::load($photo_id);

      $build = [
        '#theme' => 'member_edit_photo',
        '#photo_id' => $photo_id,
        '#node' => $node,
      ];

      /** @var \Drupal\Core\Render\Renderer $renderer */
      $renderer = \Drupal::service('renderer');
      $rendered = $renderer->renderRoot($build);

      $response = new Response();
      $response->setContent($rendered);
      return $response;
    }
  }
}

In the theme preprocess the Form is loaded:

function template_preprocess_member_edit_photo(&$variables) {
  /** @var \Drupal\node\NodeInterface $node */
  $node = $variables['node'];
  $variables['member_photo_edit_form'] = \Drupal::formBuilder()->getForm('Drupal\mymodule_member_photos\Form\MemberPhotoEditForm', $node);
}

And here is how I'm triggering the load:

(function ($, Drupal) {

  'use strict';

  Drupal.behaviors.MemberPhotosGallery = {
    attach: function (context, settings) {

      $(window).on('hashchange', function () {

        var url = window.location.hash.substring(1);
        if (url == '/' || url == '') {
          $.magnificPopup.close();
        } else if (url.substring(0, 6) == "/photo") {
          $.magnificPopup.open({
            items: {
              src: url
            },
            type: 'ajax',
            mainClass: 'mfp-zoom-out',
            showCloseBtn: true,
            closeOnBgClick: false,
            callbacks: {
              close: function () {
                window.location.hash = '/';
              },
              ajaxContentAdded: function () {
                var form = $('form#member-photo-edit')[0];

                Drupal.attachBehaviors(form, settings);

                //# Triggering this doesn't ajaxify the Form.
                // Drupal.behaviors.AJAX.attach(this, settings);

                var ajaxObject = Drupal.ajax({
                  url: "",
                  base: false,
                  element: false,
                  progress: false
                });

                // Simulate an AJAX response having arrived, and let the Ajax
                // system handle it.
                ajaxObject.success(form, "success");
              }
            }
          });
        }

      });
    }
  };

})(jQuery, Drupal);

After Drupal.attachBehaviors(form, settings); is running, comparing my form with a working Ajax form I see that all the classes are present in the form except the enctype="multipart/form-data" attribute.

Does anyone have any idea what can I do here to Ajaxify my Form?


texts: Get "Raw" views data (with no or little markup)

texts:
One thing i hate about views is this bunch of markup and nesting it uses to render the data on a page.

What i usually do to remedy this problem is iterate through the content variable and trim all tags so i can them display it as i wish. I know this kind of a dirty shortcut and i was wondering if there was a better way to do so.

Can' t views only output the raw data from the DB without adding all that markup to it ?


texts: How to change the url the core search form submits to?

texts:
The action value for the core search form is /search/node.
How could I get it to go instead to a different url for a custom View?


texts: how to restrict heartbeat activity messages per roles?? i am using drupal 7

texts:
Message display access
Defines to whom the message is meant for and who is entitled to see the message.
Limit this message with roles
anonymous user
authenticated user
administrator
moderator
Guest
Select the roles to filter activity. Leaving empty means the messages will always be shown.


texts: How do I edit a complex entity via dynamically loaded AJAX-forms?

texts:
I have a "profile" entity with a field "education" (to get started). That field contains various input fields that describe the "education". At the moment I have "institution" and "year". I created that field with the Field API in a dedicated module and attached it to my "profile" entity (currently this is a profile2 bundle). The entity form works as expected, the "education" field widget is included and I can add multiple "education" entries. I can view my entity and the fields get formatted, and I can edit my entity and the form widgets get rendered.

--profile entity
----education field
------education a
--------institution a
--------year a
------education b
--------institution b
--------year b

But I do not like the all or nothing approach here. There are going to be many different fields and I want to display the "profile" entity with various "edit" and "add new entry" buttons, which should load the specified field form widget via AJAX. The profile page on xing.com is a good example of what I am trying to achieve.

Is this possible with the fields form widget and Field API alone, or do I have to implement the ajax callback via a menu hook, which returns a form with the needed input fields? Can I even use my "education" field in that scenario or do I have to work with the entity API and database API?


texts:
I have a field and set its input format to Filtered HTML. Its content some text within the <strong> and </strong>, which are allowed by the input format I chose.

However, when displaying the a node of that content type, the text is still displayed as plain text and the <strong> tag seems to be ignored.

What can be the reason for that?


texts: One time URL doesn't re-direct the user to change the password

texts:
In Home » Administration » Configuration » under the email messages section when a user is invited to the site the [user:password] is not generated and the one-time-login URL doesn't re-direct the user to change the password (It just logs him in and he doesn't know the password!)

What can I do to fix this? I have also installed this module


texts: How do I edit the template files for GLOBAL PHP?

texts:
I have a global php field in a view and it has a output field. However, I want to add / edit the template file instead which looks like this:

<?php

/**
 * @file
 * This template is used to print a single field in a view.
 *
 * It is not actually used in default Views, as this is registered as a theme
 * function which has better performance. For single overrides, the template is
 * perfectly okay.
 *
 * Variables available:
 * - $view: The view object
 * - $field: The field handler object that can process the input
 * - $row: The raw SQL result that can be used
 * - $output: The processed output that will normally be used.
 *
 * When fetching output from the $row, this construct should be used:
 * $data = $row->{$field->field_alias}
 *
 * The above will guarantee that you'll always get the correct data,
 * regardless of any changes in the aliasing that might happen if
 * the view is modified.
 */
?>

<?php print $output; ?>

However, when I put anything here, like for example: echo "hello world"; nothing gets displayed.

If I put this php code in the output field on the view, it works just fine, but I am tasked with removing php from fields and putting them in either modules or template files so they do not risk exposure.

How come my template file will not display whatever php code I insert, but it will on the field itself? I'm confused.


texts:
I can't access my website. I guess it has been hacked. Some drupaldev user is already been created and is in admin list. I have blocked that user multiple times, but it reappears again and again in my admin panel list.
My site has also faced spamming, which i stopped by disabling registration module. But i believe its too late now.

How can i prevent letting this user access my website? What have i missed in my security constraints? Please help.

Drupal Version : 7.17


texts: Fill Date field in a hook form alter with ajax callback

texts:
I'm trying to populate some fields via Ajax.

Is working good with textfields, but no with date field and select list.

After the rebuild of the form the date field is empty and the select too.

Here my code:

function PORTO_SUB_form_alter(&$form, &$form_state, $form_id)
{ if ($form_id == 'datore_node_form')
{
global $user;
  $form['title']['#type'] = 'hidden';
  $form['title']['#value'] = 'test';

  $form['#prefix'] = '
';
  $form['#suffix'] = '
';

    $form['user_copy'] = array(
      '#type' => 'button',
      '#value' => 'Sono io il datore!',
      '#ajax' => array(
        'event'=>'click',
        'callback' =>'user_copy_ajax_callback',
        'wrapper' => 'datore_node_form_prefix',
    ),
  );
  // field_group_hide_field_groups($form, array('group_azienda'));

  $user = user_load($user->uid);

  dpm($form);

  if (!empty($form_state['values']['field_cognome']))
  {
    unset($form_state['input']['field_cognome']['und'][0]['value']);
    $form['field_cognome']['und'][0]['value']['#value'] = $user->field_cognome['und'][0]['value'];
    $form['field_nome']['und'][0]['value']['#value'] = $user->field_nome['und'][0]['value'];
    $form['field_luogo_di_nascita1']['und'][0]['value']['#value'] = $user->field_luogo_di_nascita1['und'][0]['value'];

    $form['field_data_di_nascita1']['und'][0]['#date_items']['#value'] = $user->field_data_di_nascita1['und'][0]['value'];
    $form['field_data_di_nascita1']['und'][0]['#date_items']['value']['#value'] = $user->field_data_di_nascita1['und'][0]['value'];
    $form['field_data_di_nascita1']['und'][0]['#date_items']['value'] = $user->field_data_di_nascita1['und'][0]['value'];
    $form['field_data_di_nascita1']['und'][0]['#default_value']['#value'] = $user->field_data_di_nascita1['und'][0]['value'];
    $form['field_data_di_nascita1']['und'][0]['#default_value']['value']['#value'] = $user->field_data_di_nascita1['und'][0]['value'];
    $form['field_data_di_nascita1']['und'][0]['#default_value']['value'] = $user->field_data_di_nascita1['und'][0]['value'];
return $form;
}

function user_copy_ajax_callback($form, &$form_state)
{
dpm($form['field_data_di_nascita1']['und'][0]['#default_value']['value']);
return $form;
}


texts: I've installed FullCalendar in Drupal 7, I have more than one event in the same day, so in the month view all this events shown in same cell and the cell height is increased badly and effects other theme regions, I read about the view more extension but I cant add it, I also try to edit the css to set max height and make overflow hidden but same.


texts: Enable users to view their own profile, without enabling "View user profiles"

texts:
This may be a really stupid question, but we can't see how to make it work.

We have a Drupal 7 site with several different rôles and one of them should not be able to see the user profiles of the others. Now I thought that would be simple, by unchecking the "View user profiles" permission in the People admin.

But that prevents them accessing their own profiles as well. From what I can gather, there isn't a simple way of making this be the case, so I'm looking for any sensible suggestions on how I can make it happen -- code edits, modules, whatever.

Thanks everyone! (And let me know if I need to provide more information about our configuration or Modules we have installed.)


texts: How to upload location module zip codes for proximity search

texts:
This is driving me completely insane. I can't get the database to import to the zipcode table using phpMyAdmin. Looks like it is going, then a blank. Go to table and nothing. Trying to import the US data. Any suggestions? Using Drupal 7.3, location-7.x-3.0-rc5.

Had tried this with the latest Dev version of module, but caused issues with my entityform location field that I didn't have with rc5, and also couldn't import zip codes. Using it so people can add zip code among the other fields of info, then using a View to show the information in a table and run proximity search.

At first seemed to work as the results narrowed, but the distance kept showing 0.
Please please help.
Thanks
Daniel


texts: Drupal Users while developing: Methodology

texts:
I have recently been working on a Drupal project that due to time constraints had to be put up in a relatively infantile stage with the registration in place (using Profile2) and attempted log-ins blocked.

The problem that I have run into is that users have registered to the site in the interim time between my last update+commit and now.

I have exported the authmap, profile, profile_type, users, users_roles, webform_emails, webform_roles, webform_submissions, webform_submitted_data, & zendesk_users tables and imported them into my local environment. There doesn't appear to be any bugs .. *knocks on wood*.

Is this the only option for me? Does anyone have any insight as to how to best handle a situation of this nature?


texts: Converting Drupal 5 to 6, theme_views_view() error

texts:
I'm working in Drupal for the first time and working on migrating a Drupal theme from D5 to D6. There doesn't seem to be ANY documentation for the error or issue and I need some help.  Again, I've never used Drupal, so I'm completely in the dark.

I'm getting the following error on ALL my views pages after the upgrade:

Fatal error: Call to undefined function _views_get_style_plugins() /sites/all/themes/vets/template.php on line 152

Removing the function all together from the template.php file, just gives a blank white screen.

Here's the function that is throwing the error:

/**
* Customize Views Output
*/
function vets_views_view($view, $type, $nodes, $level = NULL, $args = NULL) {
  $num_nodes = count($nodes);

  if ($type == 'page') {
    drupal_set_title(filter_xss_admin(views_get_title($view, 'page')));
    views_set_breadcrumb($view);
  }

  if ($num_nodes) {
    $output .= views_get_textarea($view, $type, 'header');
  }

  if ($type != 'block' && $view->exposed_filter) {
    $output .= views_theme('views_display_filters', $view);
  }

  $plugins = _views_get_style_plugins();
  $view_type = ($type == 'block') ? $view->block_type : $view->page_type;
  if ($num_nodes || $plugins[$view_type]['even_empty']) {
    if ($level !== NULL) {
      $output .= "
name) ."'>". views_theme($plugins[$view_type]['summary_theme'], $view, $type, $level, $nodes, $args) . '
';
    }
    else {
      $output .= views_theme($plugins[$view_type]['theme'], $view, $nodes, $type);
    }
    $output .= views_get_textarea($view, $type, 'footer');

    if ($type == 'block' && $view->block_more && $num_nodes >= $view->nodes_per_block) {
      $output .= theme('views_more', $view->real_url);
    }
  }
  else {
    $output .= views_get_textarea($view, $type, 'empty');
  }

  if ($view->use_pager) {
    $output .= theme('pager', '', $view->pager_limit, $view->use_pager - 1);
  }

  if ($output) {
    $output = $output . "\n";
  }
  return $output;
}

I can't find documentation about the function, nor the error.


texts:
Related to, but not the same as How to change end date automatically after changing start date?

I'm looking for a method to have Date fields do some sort of validation on the end date. I don't want it to get set to the start date automatically, but I'd like end end date to get bumped forward if they set a start date after the end date.

Alternatively, I'd at least like the datepicker to default to the start date's month when they open the form. Is this just going to be a little javascript module, or does this functionality exist already somewhere I'm missing?

Looking in the date field settings, there's a way to set default start and end dates, but they don't update obviously.

Is the answer just doing a bunch of javascript/jquery login on the fields whenever my users enter data? It seems like this should exist somewhere already.


texts: Error trying to submit webform programatically multiple times: Duplicate entry for key 'PRIMARY'

texts:
I'm trying to programatically send submissions to a webform n times, but when I submit the submission info to the webform for the second time, I get an Integrity constraint violation: 1062 Duplicate entry 'nnnnn' for key 'PRIMARY' error. It appears the second submission has the same sid as the first submission, but I'm not sure why as I'm submitting NULL for the sid. How can I submit the webform again with the same information, but get a new sid? Drupal 7.
Here is the error in full:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '211-82916-1-0' for key 'PRIMARY': INSERT INTO {webform_submitted_data} (nid, sid, cid, no, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 211 [:db_insert_placeholder_1] => 82916 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => Bob ) in drupal_write_record() (line 7471 of /var/www/html/includes/common.inc).
And the code:
function wildsight_raffle_tickets_webform_submission_insert($node, $submission) {
  if ($submission->nid == 210) {

  $node_out = node_load('211');
  global $user;

  $data = array(
    'first_name' => $submission->data[3][0],
    'last_name' => $submission->data[4][0],
    'email' => $submission->data[14][0],
  );

  module_load_include('inc', 'webform', 'webform.module');
  module_load_include('inc', 'webform', 'includes/webform.submissions');

  // This methods will arrange $data in the right way
  $data = _webform_client_form_submit_flatten($node_out, $data);
  $data = webform_submission_data($node_out, $data);

  $submission_out = (object) array(
    'nid' => '211',
    'uid' => $user->uid,
    'sid' => NULL,
    'submitted' => REQUEST_TIME,
    'completed' => REQUEST_TIME,
    'remote_addr' => ip_address(),
    'is_draft' => FALSE,
    'data' => $data,
  );

  $number_of_tickets = $submission->data[24][0];
  while ($number_of_tickets > 0) {
    webform_submission_insert($node_out, $submission_out);
    $number_of_tickets -= 1;
  }
}
}


texts: Drupal 7 localhost is shortening css strings

texts:
My local copy of a Drupal 7.19 site has been cutting the css strings and I cannot figure it out.  I have checked my .info file, settings file and tried disabling modules, all to no avail.  It continues to render css like this:

<link type="text/css" rel="stylesheet" href="http://localhost/rwr/" media="all">

Where is should be

<link type="text/css" rel="stylesheet" href="http://localhost/rwr/sites/all/[themename]/css/global.base.css" media="all">

My remote site is generating @import calls to the css, but my localhost is not.

Feel free to link me to an existing solution for this.  I have been googling and reading for hours, but I cannot find a solution.  Thank you!


texts: Custom role: adding a new node results page not directing properly

texts:
Current roles I have:
...., authenticated user, student, staff, admin, ...
I create a new content type and only staff & site admin (i.e. I only check permission for staff & site admin. Other roles don't have any permission checks)can do something to it.
I login as a staff and try to add a node. The "add node page" for new content type cannot be accessed (too much redirects in chrome, then die)
If I select "authenticated user" things start working, but other roles are selected as well.
Build-in roles like editor, site admin have no issues. It seems the issues are caused by custom role.
I used module content access, not sure that causes issues. I disabled it, still no luck.
Any idea?

Update: Staff has not been assigned with "staff role" uuuuuhhhh


texts:
I've got a view that outputs a pdf business card for every student with all the classes he attends.
Someting like this:

2014
Name Surname
class1, class2, class3

To associate students and classes I use a Session content type with fields: year, entity referenced student and entity referenced class (Students and Classes are separated content types as well).

Because I need to control the exact position of every field on the final pdf, I use views PDF.
To achieve that some kind of "GROUP_CONCAT" on classes I succesfully used Merge Rows module.

My query is ok. If I try it on page display everything is all right, but when I try to make a PDF display using views PDF it shows just one value, not the entire comma separated string of classes.
I've tried many combinations of merge rows settings, played with custom html output of fields, but it seems that Merge Rows doesn't work on PDF display.
Any idea to make this work?

As suggested for invoices in the paragraph "Append and Include other Views" from views PDF documentation, I also tried to split the view into two separate views: the main and the secondary view of classes included as a field but with no success. The classes view doesn't filter content using the contextual filters passed by the main view. Removing contextual filter, I can see classes under student name, but all of them. And the query is really slow...

Another solution could be to rewrite the SQL using GROUP_CONCAT (I use MySQL)... But how?

What should I do?

Thanx in advance


texts: How to make node view show approved, not latest

texts: I've got a client with an old Drupal 6 site that uses workflow and revisions. They want a blog added with related content types and Views. All works except that for the node page itself, it shows the latest revision, even if an earlier one is approved within workflow. The tab says "View Latest." For the already-existing Events content type, it shows the most recently approved revision and the tab says "View." I've looked in workflow config and have compared workflow settings for the two content types and cannot see where this is controlled. I would add that the fact that Views is called Views means that searching on "node view" is almost worthless. Any help in how I can make this old site show the approved version for the node page would be appreciated.


texts: Where should one add the js file (D7) to be attached to the custom theme's template.php file

texts:
I have js file which needs to be attached to template.php file.
Can I directly add the js file in template.php file ?
I am using drupal_add_js() but
should I add it inside the functions of template.php
or
should I add it directly into template.php file
I have the code in d6 which has added the drupal_add_js() in template.php file
without including it in any of the functions?


texts: Something was happened to my site, so now I can't add or edit items in all my menus: I see just buttons 'Save', 'Cancel'. Where can I find solution of this problem, what can be a reason of this? I use Drupal 6.26


texts:
How can I get the filesize (eg, 2.12 MB) of a FileField upload?

I tried this from a views row template but I get an error message (function.filesize]: stat failed for ..filename..):

// this correctly gets the result
// /sites/example.com/files/CIRS_manual_test.pdf
$file_field = '/' . $field->original_value;
print "Download chapter as pdf: ';
print filesize($file_field) . '';

I've tried using the full path /www/..., but get the same error message. I know the path is right because I'm able to load it in my browser.


texts: How can I display a list of users who have the same taxonomy term

texts:
The setup:

A Taxonomy Vocabulary called "Area of work".

The vocabulary has the following associated terms: A, B, C, D, E, F, G, etc.

During registration users have to choose a department from the taxonomy list to associate themselves with.

The challenge:

I would like to create a single page view or multiple page views if necessary that displays the users that work in each department.

Another requirement is to display each list of users page using the following the path pattern: people/staff/A/, people/staff/B/...

Current status:

So far, I have managed to create a generic list with all users that have selected one of the departments in the following path: people/staff, but I can't figure out how to display single lists for each department.

Any help will be much appreciated!


texts:
When creating a view whose display type is page, we got an option to apply pagination using pager option given in view, where you get sort of radio buttons to select pager, full, mini, etc..

Do we have check-boxes instead of those radio buttons?

What If want to render 2 different pagers in my view display - full and mini?

Any help is really appreciated.


texts:
I'm using the uc_ddate module.

How would one hook into the checkout pane to cause it to force it to validate and make the delivery date option required?


texts: How to display view with context filters as a block in sidebar?

texts:
I'm trying to display a view in a block, the content of which is based on value of one of field of currently displayed node. I found out that I must use Views content panes and Mini panels modules. I created appropriate view in format "content pane" and I'm stuck. I can't find how to proceed any further. I tried to create new mini panel but I don't see how to associate one with another.

Clarification

I choose Panels after quick research because I want to display view in a block, which takes arguments from it's context: field value of current node. Nodes are displayed using standard template and Display Suite.

Clarification 2

What I exactly want to do: take field value from currently displayed node and in a block in sidebar display list of nodes that also have same value in that field.


texts:
I am a drupal newbie and am having the following problem:

In my custom content type page, I have multiple check boxes and a text area, among other fields. What I want is that, I would like the values of the checked check-boxes to be pasted inside the text area. The checkboxes are created as a multi-value field (field type = list, widget = check-box). Basically what I want is, every time the user checks/unchecks one of the checkboxes, the text area should re-populate with values of all the checkboxes that are currently selected.

I tried using the dependency fields module, but it did not solve my problem. Have anyone encountered this need before?

Based on what I read, it seems this might be possible using hook_node_presave, however I am not sure where to add this. I am using a template called norma, so I edited its template.php and added a function like so:

function norma_node_presave($node)
{
 print_r($node);
 exit;
}

However, nothing has happened... :(

Any pointers on how to solve this is very much appreciated...


texts: Programmatically enable Mollom protection for a form

texts:
I want to enable Mollom protection for a number of forms in my development environment, and then export that configuration to QA and to Production without touching the Admin interface in QA or production.

I can export the Mollom settings via Features + Strongarm, but it doesn't appear to export the configuration for forms protected by Mollom.

I see that I can use hook_mollom_form_list and hook_mollom_form_info to make new forms available in the UI with default values, but I can't get hook_mollom_form_info to fire without enabling protection for the form in the UI.

I am trying to add a captcha to the registration form and password reset form, do text analysis on comments, and do text analysis for my custom node submit form. It appears that the mollom module already has definitions for all of these forms, but I don't see any way to enable them.


texts: 'Edit' tab does not appear on user's account page?

texts:
On my site when a user navigates to their account page there is no 'Edit' button for them to be able to edit their details. From the documentation online it seems this should appear automatically.

Is there any way this could have been disabled by accident or are there any modules that could have interfered with it?

A user is able to edit their profile if they add /edit to the link to their profile page, so it is not that they don't have the 'edit' permission - they definitely do and are able to edit their details successfully if they go to this link.


texts:
I have installed the Metatag module, along with ImageCache Token, but it just does not work.

I have tried many of the different available tokens in the Open Graph image field for my node, and none of them generate a og:image tag. For instance, I have tried:

[node:my_image]
[node:my_image:large:path]
[node:my_image:large]
[node:my_image:thumbnail]

if I hard-code a URL rather than use a token then it works, but that rather defeats the purpose. My logs contain no errors, and I remember to clear the cache each time. This is driving me nuts. Anyone know what might be wrong?


texts:
Very simply, I'm creating a date of birth field pragmatically like so:

  $form['dob'] = array(
    '#type' => 'date',
    '#required' => TRUE,
    '#title' => t('Date of Birth'),
    '#default_value' => $sponsorship->dob,
  );

The API says the return value is in the form:

array('year' => 2007, 'month' => 2, 'day'=> 15)

My question is simply, how should I store this in a database table? I originally set the table column to varchar. But I would like to know what is normal practice and most efficient for handling a date using the Form API for Drupal, both saving to the database and then displaying on a page.


texts: Should I use both caches pane and panels?

texts:
this is my first post here on SE after years and years of just using the platform for researching, I hope I do it right!

On a D7 site I use several cache systems/layers, mainly filecache, views cache, panels cache and boost.

I have good results with caching the panels only, but I recently read an article (link not at hand unfortunately) that recommended to use both caches, the one for the panel and the cache for each pane at the same time.

Does this bring me any performance gain?

Or should I either use the pane or the panels cache?


texts: How to obtain the complete list of available Drush Output Formats?

texts:
I'm trying to obtain the complete list of Drush Output Formats. I'm using drush 9.0-dev and in the Output formats section of the Drush Documentation it says:

  The list of formats shown is abbreviated; to see the complete list of
  available formats, run the help command with the --verbose option.

I tried drush help --verbose, but I can't find the information.

Is there another way to have access to this information?


texts: Simple way to add dropdown arrows to a dropdown containing menu?

texts: I have a menu (Main menu). It's a superfish based menu that contains simple dropdown appearances. This menu doesn't have any Superfish style attached to it. It just uses the JQuery of this library and that's it; because of this reason I now need to attach arrows to these specific menu links that contain dropdows... Is there any simple module for this purpose and would you even recommend a modular solution in this case?


texts: Smart Paging Clean url redirects to Queried strings automatically

texts:
I just use Smart Paging module and it works great. Except one thing, when I click on next link, next page clean url is automatically redirected to queried string url.

Like xyz.com/some-url.html/p/0/1 to xyz.com/some-url.html?page=0%2C1

I'm not able to figure out the reason for this.

Can you please help?

Thanks.


texts: Dynamically enabling checkout panes based on cart contents?

texts:
I am working on a service booking website and below is a customer scenario:

i) A customer arrives at the site, views the various services and clicks the "make a booking link" for a particular service.

ii) They are redirected, a view of all available services of that type (product with time/date field & service_type_id) is then generated.

iii) The customer selects the timeslot suited and clicks on a "Book now" button (overidden "Add to Cart"), the Review page is skipped and they are redirected to the checkout page

On the checkout page I am trying to dynamically add suggested services that compliment their current selection. The problem I am having is how to dynamically add this checkout pane?

Currently I am using rules to detect what service has been added to cart, using entity has the field (service_type_id) & a data comparison to allow me to know what added service type I should suggest. I am trying to use commerce extra panes to create and display the content.

I am just wondering what is the best way to go about dynamically adding panes based on the contents of the cart?

I imagine I will have to write a series of rules that enable/disable checkout panes based on the carts contents but am hoping there is a simpler way to get the functionality I am looking for?

Allowing for the display of extra panes to be integrated with conditionals derived from rules would be a very handy feature for a variety of uses.

Any thoughts/help appreciated.

Kind regards,
Ruairi


texts:
Is there a way to get drupal 7 to keep version history for every node/page without having to remember to select the "Create new revision" option every single time?

Is there a module that improves this feature? Also, the ability to Diff two different revisions would be great.


texts: hybridauth redirection to an emailed link after success login

texts:
Im using hybridauth to let users login from different social media websites ...
I send emails manually to some users with an link to edit specific nodes (for example http://example.com/node/444/edit?parma1=val1&param2=val2).
At that moment the user is automatically redirected to a page to choose a social media he want to login with.
Im using hook_init for this :

function MYMODULE_init(){
  if($node->type == 'type' && other conditions){
    drupal_goto('link_to_hybridauth_login_page');
  }
}

Now I want that user to be automatically redirected to that link sent via email after success login via hybridauth ( I tried to add destination query inside drupal_goto but not working.)

how can I do this redirection ?

Thanks in advance.


texts: Override Taxonomy Node content for different terms without using views

texts:
I have taxonomy-term.tpl.php page in my theme folder which shows the standard layout of a taxonomy term page like : Title, Description and content listing corresponding to the taxonomy term. Now I wish override this standard layout for a particular term and I create another term file namely : taxonomy-term--32.tpl.php. For this I haven't added any function in the template.php file in my theme.

My problem is that for the term page with tid / term id = 32, does not entirely override the content block. Precisely, the listing of the contents related to that taxonomy term remains in the overridden web page as well, which is not what I want.

N.B : I have disabled the Taxonomy Term View from the admin end of the site as I am not absolutely sure about its functionality.


texts: How does the UserData plugin get the correct value?

texts:
The User module defines a UserData plugin for the Views module, which allows to access the user.data service from a view. Its render() method contains the following code.

$uid = $this->getValue($values);
$data = $this->userData->get($this->options['data_module'], $uid, $this->options['data_name']);

// Don't sanitize if no value was found.
if (isset($data)) {
  return $this->sanitizeValue($data);
}

}

How does the Views module know the plugin require a user ID? In other words, how does the Views module know that is a field plugin associated with the User entity and not another entity?

The annotation for the plugin is simply the following one.

@ViewsField("user_data")

Neither its create() nor its constructor method set something that would make clear to which entity the plugin is associated.

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  return new static($configuration, $plugin_id, $plugin_definition, $container->get('user.data'), $container->get('module_handler'));
}

public function __construct(array $configuration, $plugin_id, $plugin_definition, UserDataInterface $user_data, ModuleHandlerInterface $module_handler) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);

  $this->userData = $user_data;
  $this->moduleHandler = $module_handler;
}


texts: Upgraded to Display Suite 7.x-2.8 and my Node Titles Are Missing

texts:
I just updated to 7.x-2.8 and now all of the Titles of my Node Teasers are missing. Example: http://liberalgeek.com/

Each of the boxes on that page should have the title as the first item in the box (above the image).

When I go to Manage Display, the Title field is entirely missing from the available options.


texts: Jquery Ajax to Drupal to External site, reading response

texts:
I have a drupal site.

There is a page (page 1) with a form that gathers user info and submits it via AJAX to a Drupal Module page.

The AJAX format is jquery

var responseTarget = '/site/module/page_name';
  jQuery.post(responseTarget, {
      key1: value1, key2: value2,.......
  }, function(responseText, statusText, xhr) {
    if (xhr.status === 200) {
      PROCESS SUCCESS
    }
    else PROCESS FAILURE

The module page has the URL format "site/module/page_name" (page 2) and is constructed from the module file "page_name.tpl.php".

This (page 2) processes the user information and sends it to an external server.

The server replies to my (page 2) which processes the response by saving a value to the user account.

The (page 2) then responds to the AJAX call on (page 1).

When my AJAX receives the response it is the response from Drupal (page 2), not from the external server.

responseText = the whole Drupal page2, as it is part of a module it contains the header and footer and the processed php of the page as HTML, no objects or values.
xhr.status = 200 // Drupal page2 success

What I would like to do is read the response from the server in my page 2 and pass this pack to the AJAX script, or process the value returned from the server in page 2 and pass a status/value/... back to the AJAX script based on this.

I have tried getting Drupal page 2 to echo a JSON object but this is done within the module and Drupal prints it out as part of the page HTML.

Summary

[page 1 (ajax)] --> [page 2 (Drupal module)] --> [External Server]

[External Server (modifies an object)] --> [page 2 (processes the object and incorporates it into a full Drupal page, and removes whatever header, status was sent from external server] --> [page 1 (ajax) receives the status and data from page 2]


texts: Drupal Commons add automation using Workflow modules to solve the problem of Wiki/Article Publishing for End users

texts:
I have a Drupal Commons Profile and I have setting up the following modules to my drupal commons site.

Workbench

Workbench Access
Workbench Moderator

Configure the Taxonomy and set it to "Section"

My Workflow

Content Creators
Content Publishers

Article Content Type:
Publishing Options: Disabled
Enabled Moderator Options to "Drafts"

Created two Roles

Content Creator ( Content Creators )
Channel Manager ( Content Publishers )

Set permissions to Each Role

First I logged in as Content Creator

My Workbench->Create Content->Article->Add New Article
Set Moderator: "Needs Review"

and Save article.

Issues:

After logged in as Publishers account.
Go to

My Workbench->Needs Review

But there is no any content will be appear.

But If i logged in as Administrator I will show the same there?

Can anyone let me know what was the issue I am facing.
any suggestion will be helpful.


texts:
I'm trying to create my first module which essentially is a visitor sign-in system where each visitor is stored as a custom content type.

The user will be a visitor to our building who's able to input their name and who they are here to see (autocomplete field based on taxonomy terms). My custom module will then add a timestamp to the node, as well as email the person they are here to see.

Code is below:

function visitor_email_staff_form_alter(&$form, &$form_state, $form_id){
    if ($form_id == 'visitor_sign_in_node_form'){
        $form['actions']['submit']['#submit'][0] = 'visitor_email_staff_my_custom_submit_handler';
    }
}

function visitor_email_staff_my_custom_submit_handler($form, &$form_state){

    $guestName = $form['field_visitors_name']['und'][0]['value']['#value'];
    $staffName = $form['field_tags']['und']['#value'];
    $visitorTitle = $guestName.' - '.time();

    $staffTaxonomy = taxonomy_get_term_by_name($staffName);

    foreach ($staffTaxonomy as $email) {
        $staffEmail =  $email->description; // email address
    }

    $form_state = array();
    $form_state['values']['title'] = $visitorTitle;
    $form_state['values']['field_visitors_name'] = $guestName;
    $form_state['values']['field_tags'] = $staffName;
    $form_state['values']['field_timestamp_in'] = time(); // timestamp
    $form_state['values']['field_timestamp_out'] = '';
    $form_state['values']['op'] = t('Save');

    drupal_form_submit('visitor_sign_in_node_form',$form_state);

}

The major issue I'm having at the moment is getting the data to save and submit... I keep getting the below errors:

Warning: Missing argument 3 for node_form() in node_form() (line 107 of C:\www\xxx\modules\node\node.pages.inc).
Warning: Creating default object from empty value in node_form() (line 115 of C:\www\xxx\modules\node\node.pages.inc).
Notice: Undefined property: stdClass::$type in node_object_prepare() (line 981 of C:\www\xxx\modules\node\node.module).
Notice: Undefined property: stdClass::$type in _node_extract_type() (line 379 of C:\www\xxx\modules\node\node.module).
Notice: Undefined property: stdClass::$type in comment_node_prepare() (line 1298 of C:\www\xxx\modules\comment\comment.module).
Notice: Undefined property: stdClass::$type in menu_node_prepare() (line 568 of C:\www\xxx\modules\menu\menu.module).
Notice: Undefined property: stdClass::$type in _node_extract_type() (line 379 of C:\www\xxx\modules\node\node.module).
Notice: Undefined property: stdClass::$type in node_form() (line 294 of C:\www\xxx\modules\node\node.pages.inc).
Notice: Undefined property: stdClass::$type in node_form() (line 300 of C:\www\xxx\modules\node\node.pages.inc).
Notice: Undefined property: stdClass::$type in node_form() (line 321 of C:\www\xxx\modules\node\node.pages.inc).
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7922 of C:\www\xxx\includes\common.inc).

Am I going about this the wrong way? Should I be using something else instead of drupal_form_submit()?


texts: How can I make Drupal use token for summary instead of breaking at ?

texts:
I'm using "Long text with summary" fields for some different content types.

Right now the summaries are rendered until the first -tag (the web site already contains ~5000 nodes) but I would like to use a token created by a module that I'm currently using for the meta description of each page.

How can I use a token to display a nodes summary in a standard taxonomy node listing?


texts: How to enable Node editing in full mode?

texts:
Is there a way to expose selected node fields so that they are directly editable when the node is being viewed?

I want visitors of my site to be able to type some context into a text area, select relevant taxonomy terms etc. In other words, to do what you would normally be able to do in node-edit mode.
My node is also a Commerce product display. I need the users to input their data, also select their relevant product information and submit all on the same page.

I installed the Edit module, but I couldn't find how to expose the fields for editing.

How can I achieve what I am trying to do?


texts: How do I theme the tag/taxonomyterm page on my site? Can I use a  panels page for this?


texts:
The Twig cache key (twig_cache_prefix) is based the modify timestamp of the Twig template file and a randomly generated key. This gives a problem with a load-balanced Drupal setup where every host has it own copy of the Drupal source files, with different timestamps for the same template files across the hosts.

In this setup each Drupal instance keep generating a new prefix for every other request (when the balancer is in round-robin mode).

Is there a workaround for this?


texts: Exception handling in drupal : How one can deal with warnings in Drupal?

texts:
How one can deal with warnings in Drupal? If the code is getting executed smoothly, then what's the purpose of these warnings? Is there any way to deal with drupal "warnings", "notices".

one example here is:
I have written hook_uninstall

function hook_uninstall(){
   if (field_info_field('hide_field')) {
        field_cache_clear();
        field_delete_instance('hide_field');
        field_delete_field('hide_field');
    }
}

and this code is throwing warning:

Warning: Illegal string offset 'field_name' in field_delete_instance() (line 772 of modules/field/field.crud.inc).

Warning: Illegal string offset 'entity_type' in field_delete_instance() (line 773 of modules/field/field.crud.inc).

Warning: Illegal string offset 'bundle' in field_delete_instance() (line 774 of /modules/field/field.crud.inc).

Warning: Illegal string offset 'field_name' in field_delete_instance() (line 781 of modules/field/field.crud.inc).

Warning: Illegal string offset 'field_name' in image_field_delete_instance() (line 480 of /modules/image/image.module).

and there is no halt in the execution of the code. I'm very much curious about how drupal deals with exceptions, warnings, notices.

What does these warnings mean?

And can we contribute our module to drupal community if warnings or notices exits in module?

Can anyone share their piece of knowledge here?


texts: I am unable to login using linkedin integration module drupal 7?

texts:
I have installed Drupal linkedin Integration 7.x-1.x-dev and Oauth module .

I have entered the details like api key and secret key and all other settings properly

Now when I login using linkedin using the option as shown in the image
I am redirected to the page as shown in the image

but after I  enter linkedin credentials I am redirected to following page with no drupal user created

what is the reason for that?


texts: How to integrate the drush help --filter option with your custom module?

texts:
You can use the drush help --filter command to present a list of
command categories to view. When you run the command: drush --filter=devel_generate you can see the following output:
All commands in devel_generate: (devel_generate)
 generate-content  Create content.
 (genc)
 generate-menus    Create menus and menu items.
 (genm)
 generate-terms    Create terms in specified vocabulary.
 (gent)
 generate-users    Create users.
 (genu)
 generate-vocabs   Create vocabularies.
 (genv)

You can read in the Drush Command page:

help
Options:  --filter=[category]  Restrict command list to those commands defined in the specified file. Omit value to choose from a list of names.

I create the onlyone.drush.inc file with the following code:
<?php
/**
 * @file
 * Drush commands related to OnlyOne.
 */

/**
* Implements hook_drush_command().
*/
function onlyone_drush_command() {
  $items['onlyone-list'] = array(
    'description' => dt("List the configured content types to have Only One node."),
    'aliases' => array('ol'),
    'examples' => array(
      'drush onlyone-list' => dt("List the configured content types to have Only One node."),
    ),
  );
  return $items;
}

/**
 * Callback for the onlyone-list command.
 */
function drush_onlyone_list() {
  $onlyone_content_types = variable_get('onlyone_node_types');

  if (count($onlyone_content_types)) {
    drush_print(dt("Content types configured to have only one node:"));
    drush_print(implode("\n", $onlyone_content_types));
  }
  else {
    drush_print(dt("There is not content types configured to have only one node."));
  }
}

I clean the cache with drush cc drush but when I use drush help --filter=onlyone I get this output:
 [error]  The specified command category onlyone does not exist.

So, how can I obtain the list of the commands defined in my module?


texts:
I'm experiencing a weird problem. I'm making a sub-theme of the Bootstrap theme that's available for Drupal 8. However, after trying all the possible ways of how to attach a library to a page in my theme, no one seems to work. Am I doin'g something wrong?

Here's my libraries.yml file

countdown-timer:
version: VERSION
js:
  js/jquery.countdown.min.js: {}
  js/auction-timer.js: {}

Here's how I am trying to attach it to all pages in .info.yml

libraries:
  - numisvet/countdown-timer

I have already tried the approach of adding '#attached' to the render array or using {{ attach_library('numisvet/countdown-timer') }} in a twig file.

No one of these seems to work, only libraries defined by the Bootstrap theme are getting loaded.

Am I doing something wrong?
Thanks a lot for all replies.


texts:
I'm trying to use webform2pdf to generate a pdf containing form inputs. The form works fine if I don't check "Generate PDF Document", and I receive a confirmation email.

If I do enable the PDF, I don't receive a confirmation email and I get the following error:

  Unable to send e-mail. Contact the site administrator if the problem persists.

In the smtp log I see:

phpmailerException: Message body empty in PHPMailer->Send() (line 577 of /var/www/clients/client1/web1/web/sites/all/modules/smtp/smtp.phpmailer.inc).

Is there additional configuration I need to make? Drupal is new to me.

Drupal - 7.54
Webform - 7.x-4.15
Webform 2 PDF - 7.x-4.0
SMTP Authentication Support - 7.x-1.6
MIME Mail - 7.x-1.0
TCPDF - 6.2.13

** Edit **

Turning off SMTP Authentication Support and using DefaultMailSystem solved this particular issue and allows PDF attachements, although DefaultMailSystem only allows plain text emails.


texts: Prepare Drupal to be multilingual in the future

texts:
I am building a Drupal website with only one language (Italian first) but there might be more languages in the future. This website will use also DrupalGap to create an app.
Editors don't need backend Italian interface.

So these are the scenarios I thought about:

Case one:

Install Drupal with English as default.
I will NOT enable Locale module.
All machine names (Content types, vocabularies, views etc..) will be in English.
Labels will in Italian.
Content and term will be created in Italian.
Views page title and views block title will be in Italian.

After few months the website may be translated in English so, the steps will be:

Enable locale.
Install Italian language.
Install Entity translation i18n etc...
Make entities translatable.
Bulk update all nodes and terms to be Italian as original language.
Revert all Italian labels into English and use string translation to translate it in Italian.

Case two:

Install Drupal with Italian as default
All machine names (Content types, vocabularies, views etc..) will be in English.
Labels will in Italian.
Content and term will be created in Italian.
Views page title and views block title will be in Italian.

After few months the website may be translated in English so, the steps will be:

Install Entity translation i18n etc...
Make entities translatable.
Bulk update all nodes and terms to be Italian as original language.
Translate strings from Italian to English.

In terms of extendability and usability, which approach should I use at the beginning?

Let me know if you have any question.

Thanks in advance.


texts: How to show pager in terms of views of tags?

texts:
I've lists of tags suppose good and bad, now when I click to good tag it lists all good posts ( full posts ). But I wanted to show good posts only upto 5 items then all other should be there while I navigate.

So, how can I show the pager for the clicked tags. I tried it with views module, but nowhere I could see it to do this.

I've setup my views like this:


texts: How do I delete a vocabulary programmatically?

texts:
In Drupal 7 there was taxonomy_vocabulary_delete($vid), but this doesn't seem to be there in Drupal 8.

What's the equivalent code for Drupal 8?


texts: Integrate Apache Solr to Drupal Core Search Module's Form

texts:
The reason I am trying to link search form with a Apache Solr view is because, I have some fields to be displayed along with the results.

IF the default Apache solr is used the results does not have all the indexed fields, So I decided to create a apache solr view, but this will have the search field as a view filter and  I am unable to place the search box on the header region.

After trying all these options I though I would need to link the current search with the apache solr view.

The core reason of this question is to display few fields along with the apache solr search results.


texts:
In one of my modules I would like to create two different cron jobs to handle two different procedures. What I did was to use the Ultimate Cron module, and by implementing the cron api, to schedule one of my cron jobs.

My problem is that in /admin/config/system/cron/jobs only the default from the hook_cron appears and not from the hook_cronapi. This is what I wrote.

/**
 * Implements hook_cron().
 */
function MODULENAME_cron() {
  //code
}

/**
 * Implements hook_cronapi().
 */
function MODULENAME_cronapi() {
  $items = array();

  $items['generate_excel_files'] = array(
    'title' => 'Table Excel Generate',
    'callback' => 'generate_excel_files_callback',
    'scheduler' => array(
      'name' => 'crontab',
      'crontab' => array(
        'rules' => array('0 3 * * *'),
      ),
    ),
  );

  return $items;
}

function generate_excel_files_callback(){
  //code
}


texts: How to make my mobile app to work more faster when web services made from drupal7 REST services

texts:
We did an app based on drupal web services(REST server). The thing is the app is very slow on the device. The reason for this may be, the app requires 3 webservices to load initially. lile

http://myapps/api/node?parameters[type]=Company

From the above web service i will get all node under CCk company. then to get the details of the node i need to pass another url as http://myapps/api/node/5 and then to get the taxonomy term to which ths company belongs to i need to pass another url. there by it is taking much time to load. Is there any solution to make my app faster?


texts: Where do I find the vocabulary ID ($vid)?

texts:
In Drupal 6 I would go to the taxonomy section of my /admin and I'd be able to find the $vid (numerical) in the URL.

In Drupal 7 (no doubt due to the introduction of terms as entities) the URL is no longer as verbose (and some would say cleaner) as it now shows the machine name (bundle name?) of the vocabulary as it can be seen in admin/structure/taxonomy/my_vocabulary/edit.

My end-game is to use taxonomy_get_tree($vid, $parent, $max_depth, $load_entities) to load my vocabulary, and work with it in glorious and plentiful ways, but alas this function does not accept a machine_name but presumably prefers the numerical $vid.

I'll accept alternatives to load a full vocab tree (i.e. all terms and their relationships to each other), but I do think that this question should be answered directly for future generations to google.


texts: how to change hierarchical taxonomy path using Pathauto

texts:
i have posted it on drupal forum also  but there was no answer. Here is that:

  i am really working hard to know how i can add sub-categories in drupal 7. so i want to change the path of parent terms taxonomy path like this way:
  Category 1 - Path should be: mysite.com/category/Category 1
  - sub category 1 - Path should be: mysite.com/category/Category 1/sub category 1
  - sub category 2 - Path should be: mysite.com/category/Category 1/sub category 2
  Category 2 - Path should be: mysite.com/category/Category 2
  - sub category 1 - Path should be: mysite.com/category/Category 2/sub category 1
  - sub category 2 - Path should be: mysite.com/category/Category 2/sub category 2
  i think this can be done with URL aliases > PATTERNS
  but as a beginner i am really confused how to do. So, some one please help as can be described.


texts: Showing comment form under each paragraph

texts:
In node.tpl.php, I have done some changes, like creating an array of paragraphs:

    $paragraphs = explode("
",render($content));

So, I have a for loop for showing the paragraphs, like:

$number = count($paragraphs);
if($page){

 print render($paragraphs[0]);
  for ($i=1;$i<$number;$i++)
      {
         print render($paragraphs[$i]);

      Put comment for Paragraph <?php echo $i?>

<?php  } ?>

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

As you can see I want to create a hyperlink under each paragraph, so when user click on it, they can put comment on the paragraph, But right now, when they click on the hyperlink, it will  jump to the end of the page, which has the comment form.
 If you check the CommentPress website, in the right column, you can see for example, it is said: 5 Comment on Paragraph 1, and when you click on it, it will show the comments and the comment form under that link, I want to have the same thing, I mean, when users click on the link under each paragraph, the comment form displays under that link instead of jumping to the end of the page.


texts: Why can I not find the og table after installing Organic Groups?

texts:
I am using Organic Groups  module.

After installation why do I not find the og table?

I only have these five tables:

Here is a screenprint from the Drupal log with messages from around the time the og module was enabled:

Note: I installed the og module using a new Drupal site (which doesn't have any other contributed modules enabled yet), and I tried a disable/uninstall of it. Then re-installed the module but it did not fix this problem.


texts:
I have problem to get the node/{node} GET request working and I noticed that permissions for the REST are missing in my installation. Enabled modules:

HAL
HTTP Basic Authentication
JSON API
REST UI
RESTful Web Services
Serialization

REST server settings:
Content (/node/{node}) enabled and all options (json, hal_json, api_json, xml; cookie, basic_auth) selected.
User (/user/{user}) enabled, authentication: basic_auth, cookie, formats: hal_json, api_json, json, xml.

Trying requests:

node/1?_format=<format>
user/1?_format=<format>

Node 1 exists. User GET requests works perfectly, node does not at all (empty response or 406: Not acceptable format: api_json). The strangest thing is that permissions for the rest are missing completely, see:

Also tried to enable it via drupal rest:enable entity:node, went through the questions asked, but when I checked via drupal rest:debug all are disabled. Eventhough the user stuff works.


texts: Commerce 1.x (D7) has a hook _commerce_cart_attributes_refresh_alter(&$commands, $form, $form_state) that allows modules to add arbitrary AJAX commands to the array returned from the Add to Cart form attributes refresh. Is there anyway to have something similar in Commerce 2.x (D8)?. I would like to add my custom commands.


texts: How do I remove required fields (or a required attribute) from customer profile in Drupal Commerce?

texts: I only need customer to fill in name, phone and MAYBE address. Is it doable in Commerce?


texts: Can I show the answers to a previous round of questions in webform?

texts:
I built a questionnaire on Survey Monkey and had 75 people fill it in. I now need people to repeat the same questionnaire (which I am rebuilding in Webform) BUT I have to show the option they previously selected and the average across the entire survey.

I have all previous answers in a mysql database, so what I would like to do is to drop the user-specific answers in.

i.e. Last time you answered ....

Is there any way to get Webform to do this (i.e. with the Markup feature possibly?) or is this beyond its remit? I have people who are willing to help me with this, but wanted to see whether the Drupal community had any ideas first.

EDIT

Perhaps I can give you an example. Say for the first round of the questionnaire you ask people:

How do you feel about cats?
1) Love them
2) Like them
3) Dislike them
4) Hate them.

A week later, you then ask people to repeat that same question, except the question looks like this.

How do you feel about cats?

Last time you selected 'Love them'

In the survey overall people made the following choices:
1) Love them 25%
2) Like them 40%
3) Dislike them 25%
4) Hate them 10%

Please now re-answer.

1) Love them
2) Like them
3) Dislike them
4) Hate them

Thanks for your help. I hope this is a bit clearer!


texts: updating a paragraph field storage configuration that cause db paragraph revision errors

texts:
On a custom module , i had :
config/install/field.storage.paragraph.field_carrousel_model.yml  , an entity ref field to a taxonomy, taxonomy containing a "field_carrousel_model_value" :
uuid: e5c2b700-900e-431a-8064-db0eb64e8fe3
langcode: fr
status: true
dependencies:
  module:
    - paragraphs
    - taxonomy
id: paragraph.field_carrousel_model
field_name: field_carrousel_model
entity_type: paragraph
type: entity_reference
settings:
  target_type: taxonomy_term
module: core
locked: false
cardinality: 1
translatable: true
indexes: {  }
persist_with_no_fields: false
custom_storage: false

i have changed the field from an entity ref field to a list_string
uuid: 12427d62-aa2b-4b3c-b5e5-c43113aefae5
langcode: fr
status: true
dependencies:
  module:
    - options
    - paragraphs
id: paragraph.field_carrousel_model
field_name: field_carrousel_model
entity_type: paragraph
type: list_string
settings:
  allowed_values: {  }
  allowed_values_function: amu_p_carrousel_field_model_allowed_values
module: options
locked: false
cardinality: 1
translatable: true
indexes: {  }
persist_with_no_fields: false
custom_storage: false

The site db does not seem to update the data properly as i got an error,related to paragraph revision
/admin/structure/paragraphs_type/carrousel/fields/paragraph.carrousel.field_carrousel_model/storage
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_carrousel_model_value' in 'where clause': SELECT 1 AS expression FROM {paragraph_revision__field_carrousel_model} t WHERE field_carrousel_model_value IS NOT NULL LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->countFieldData() (line 1808 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

I do no not know how to fix this .

drush config-delete and reinstall do not fix it

reimporting give the same error drush config-import --partial --source=/data-platforms/platforms/drupal8-development/modules/custom/amu_p_carrousel/config/install/


texts:
Is there an official way to add extra fields on a content type on Aegir.
To be more accurate, I want to a comment (text) field for the 'sites'.


texts: How to use commerce_cart_order_product_line_item_delete?

texts:
I've set up my own custom module structure, and am trying to implement commerce_cart_order_product_line_item_delete. At it's most basic level, i'm trying to delete line item 70 from order 1 in my cart with the following code in my module:

<?php
    commerce_cart_order_product_line_item_delete(1,70,FALSE);
?>

I'm getting this error on the page:

Fatal error: Call to undefined function commerce_entity_reference_delete() in /Users/[username]/Documents/Sites/[site_name]/profiles/commerce_kickstart/modules/contrib/commerce/modules/cart/commerce_cart.module on line 1268

I've tried other methods, like the code on this page:

http://dropbucket.org/node/358

but i can't seem figure out how to find a product's ID, and in the end, I want to delete a line item from a cart which could potentially have two entries of the same product. don't want to delete the whole product from the cart... hope that makes sense.

What am I missing?
thanks!


texts: I am trying to update a website from Drupal 5 to 7 and I have to use location field for one of my content types. On Drupal 5, I can see the latitude and longitude fields but on drupal 7 I can not. Please check the image below.


texts:
I am using \Drupal::database()->query() with the following SQL statement.

LOAD DATA LOCAL INFILE '{my file name}'
INTO TABLE {my table name}
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
({my column names})

I have also tried with db_query() with same result.  I can confirm the SQL statement works as expected in phpMyAdmin, so I don't think it's a problem with the SQL statement.

First error

  Warning: PDOStatement::execute(): LOAD DATA LOCAL INFILE forbidden in Drupal\Core\Database\Statement->execute() (line 59 of {my directoreis}\core\lib\Drupal\Core\Database\Statement.php)

Line 59 is $return = parent::execute($args); which I believe is referring to PDOStatement.

Second error

  Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute.

Not sure if this can be set in a call to \Drupal::database()->query();

My research on this has shown me it should be possible to do in Drupal.

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

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

https://evolvingweb.ca/blog/import-hundreds-of-thousands-of-records-15-seconds-custom-entities

Database Abstraction Layer and 'LOAD DATA INFILE' Statements

https://stackoverflow.com/questions/3994133/how-to-load-data-to-db-from-csv-using-load-data-infile-in-drupal

So, where am I going wrong and how can I fix it?

UPDATE

Based on some of the pages I linked to above, I was able to come up with a working solution.

// set up an extra db connection
$connection = \Drupal::database()->getConnectionOptions();
$connection['pdo'][\PDO::MYSQL_ATTR_LOCAL_INFILE] = 1;
\Drupal\Core\Database\Database::addConnectionInfo('extra', 'default', $connection);
\Drupal\Core\Database\Database::setActiveConnection('extra');

// instantiate the extra db connection and query against it
$db = \Drupal\Core\Database\Database::getConnection();
$db->query($sql_statement)->execute();

// set connection back to default;
\Drupal\Core\Database\Database::setActiveConnection();

But for some reason I don't think this would be the "Drupal" way.  And now, I am not sure what my question is.  Maybe, is this the appropriate Drupal way or is there a more elegant built in solution I am unaware of?


texts:
When I go to mysite.com/user I see the login form. But it is not accessable. I cannot click in either of the text boxes and the button does not click.

This is true in Firefox, Chrome, and recent IE. It does work in IE8 for some reason.

Anyone have a clue why this should be? I tried moving it to other regions. I looked at the HTML and it appears to be fine. Maybe I'm missing some crucial Javascript?

Any ideas would be appreciated.


texts: Display text according to the access to a field

texts:
With field permissions, I restrict the access of a field to certain users.

I would like to display some text to inform the user that he has no access to the field.

I tried it in node.tpl.php :

<?php if (!field_access('view', field_info_field('field_name'),'node', $node)): ?>

<?php print t('my text.'); ?>

<?php endif; ?>

It works, but I do not know how to restrict according to the type of content.

How can it be done?
Also, is it the good method?


texts: Custom Submit Handler issue in getting file

texts:
I have the following custom submit handler.

function example_form_submit(&$form, FormStateInterface $form_state) {
    $file = file_load($form_state['values']['file_fid']);//This works in 7
}

Now I want to have uploaded file information like fid, name etc. in D8. I am not able to get that.

UPDATE:
I have also tried using the following code from here but no luck.

if ($form_state->hasFileElement())
{
  drupal_set_message("This form has a file element.");
  $video_file_file_array = $form_state->getValue('video_file');
  if (is_array($video_file_file_array))
  {
    if (isset($video_file_file_array[0]))
    {
      $video_file_file_id = $video_file_file_array[0];
      $file = \Drupal\file\Entity\File::load($video_file_file_id);
      if ($file != NULL)
      {
        $filename = $file->getFilename();
        drupal_set_message('Filename: ' . $filename);
      }
    }
  }
}


texts:
When I publish content – for instace an article – on a Drupal site, I'd like Drupal to push a status update with a link to the article to a Facebook company page.

I know there are a lot of Drupal modules that offer Facebook integration, but does any of them offer this particular functionality? Or is perhaps the best way to go to generate an RSS feed and use a third-part app like http://twitterfeed.com/ to push it to Facebook?

The site in question is a Drupal 6 site.


texts:
I have a custom content pane that I'm using in a panel that I would like to include in a feature.  In the features UI, I don't see any options to add it to the feature; however, on the custom content panes page there is an export option, so it seems like there must be some way to do this.

How can I add a custom content pane to a feature?


texts: Which module allows for tracking recently viewed content per user?

texts: I am searching for a module that will enable me to track recently viewed content per user. I found the Recently read module but it does not appear to enable me to configure it per content type. For example, I want to show all recently viewed content by this given user for content type a and content type b. Is anyone aware of a module that would allow this?


texts:
I want to create a menu link that says blog, and have blog posts show up there (this blog is only for a single user).

I can't find any documentation, and so far everything seems to be posting on the homepage and I can't find a way to redirect blog posts to a different page.