texts: local copy of my drupal site doesn't seem to link

texts:
I isntalled a local LAMP system and basically copied my site into /var/www/ for some local "experiments" (without messing around with the live site). I've mirrored the db and everything. Now when I go to http://127.0.0.1/ my home page is loaded well but all the links (e.g. http://127.0.0.1/content/lodge) won't load, I just get 404 Not Found. I assume I'm missing some kind of php or apache setting.

edit1

I did

sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart

but this didn't seem to have made a change at all.
Now within /etc/apache2/sites-available/ I have two files 000-default.conf, default-ssl.conf.
000-default.conf contains:

ServerAdmin webmaster@localhost
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

and default-ssl.conf contains

ServerAdmin webmaster@localhost
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

and I'm not exactly sre where to add AllowOverride All, can you be a little more specific?

Oh and .htaccess is in /var/www/ too

edit 2

okay, now what I did, I installed a fresh copy of drupal in http://127.0.0.1/alternatives/Quaaout/ and if I use the original site folder with a new db, urls like http://127.0.0.1/alternatives/Quaaout/?q=user work just fine! But if I use my site/ directory from the live site, this url automatically leads me to a 404 at page http://127.0.0.1/alternatives/Quaaout/user and the difference makes which database I have setup in my settings.php - with the new db from the fresh copy, ?q=user works fine, with the live copy it doesn't. So I thought it may be the url redirections I have setup in table redirect but I cleared it and it still didn't work.  So it's not the redirections, what else would be causing this?


texts: How to speed up a webform submission having alter submission render hook?

texts:
There is a webform with a lot of components (almost 200). The webform has a hook_webform_submission_render_alter in my module. There I add a little fieldset (without long operations and calculations).

I noticed that if this case time of webform submission insert grows greatly.
That is without this hook webform submits for 3 seconds, but with this hook webform submits for 10 seconds.

Did anyone encounter it ?


texts:
I've created a cck field formatter. The field outputs uploads from filefield into embedded iframes that link to google docs for display. It currently outputs:

Download the document

Download the document

I would like to edit the html outside the contents of the .field-item. Is it possible to do this in the module or do I have to create a custom theme tpl for it?


texts: What qualifies as "active development" on drupal.org?

texts:
The D7 JW Player module claims to be "Actively maintained" and "Under active development", and yet hasn't had a commit in 30 weeks.

The page for "Actively maintained" implies that the only required qualification for that status is that bug reports are "looked at".  That seems pretty minimal to me.  What about the requirements for being considered "under active development"?  Is there really any requirement or can any module be listed as such if its maintainers say it is?


texts: I try to customize my block id and it doesn't work

texts:
I create a block which I want to theme.

My block ID is 1.

In my mind it was simple as create a file block--block--1.tpl.php and make some theming on it, but I didn't see any of my change.

One important point here, is that I'm using Panel.
I wanted to drop this block into a panel region.

this is what I see in firebug

contextual-links-region panel-pane pane-block pane-block-1

Thanks a lot.


texts: performance: rule set or triggered rules?

texts:
I need to create some rules like "when create photo, when create video, when create story" but all use the same Event "after content is saved"...

so, what's the best way? a rule that trigger a rule set with various rules or varios indepedent triggered rules?

i.e:

RULE SET

rule (when create content) >
    event (after content is saved) >
        set (set: when create content) >
            rule (when create photo) >
                if:
                do:
                    rule (when create video) >
                        if:
                        do:
                    rule (when create story) >
                        if:
                        do:
                    rule (when create page) >
                        if:
                        do:
                    rule (when create product) >
                        if:
                        do:

total:

1 set
6 rules
1 event

TRIGGERED RULES

Rule (when create photo) >
    Event (after content is saved) >
        if:
        do:

Rule (when create video) >
    Event (after content is saved) >
        if:
        do:

Rule (when create story) >
    Event (after content is saved) >
        if:
        do:

Rule (when create page) >
    Event (after content is saved) >
        if:
        do:

Rule (when create product) >
    Event (after content is saved) >
        if:
        do:

total:

5 rules
5 events

thanks.


texts: How can I make my userid point to /user/*/ instead of pointing to /user/*/home?

texts:
Currently if I set my pathauto pattern to:
u/[user:account-name]
The result I receive is:
Alias: /u/michelleclark System Path: /user/5/home
I would like to recieve the result of:
Alias: /u/michelleclark System Path: /user/5/
Is there a way I can make it stop adding home on the end of the system path?
I am using a pre-made drupal distribution. I did ask in their issues section. I am not expecting a response anytime soon.
[edit]
I am using the open social distribution: https://www.drupal.org/project/social
Specifically the pre-built template from their github:
https://github.com/goalgorilla/social_template/
[edit] - added an image to show what I mean exactly.


texts:
I want to create a very minimal login block and thus wouldn't like to have the "log in" button at all. I would like to have only the username and password fields, and log on by hitting "enter".

I have added display:none CSS property to the button, but this will stop form from being submitted. What else could be done ?


texts:
My menu block is using the module: taxonomy menu terms to construct the main menu as a block to display in frontend.

I want to add image to each menu item, anyone know what is the simplest way to do that? or other module can do the same things?


texts: Drupal CSS broken in Internet Explorer 7/8, but works as static page

texts:
The CSS layout on my Drupal site was suddenly found to be broken in IE 7 & 8. No idea what happened to cause this, but the strange thing is, if I save the source/files, then upload and test as a static page, it works fine (well, good enough for Internet Explorer). I'm using Adobe BrowswerLab to test.
I've turned off caching in performance and boost. I have also turned gzip compression off on the server, and added 10 second delay to browserlab load-time. Nothing seems to make the CSS work straight from the actual site.
I haven't found any threads about this specifically. Does anybody know what might be going on?

I am using Drupal 6.24.


texts: Show a Display Suite view mode depending on a field value in the profile of the viewing user

texts: I'm not looking to use Views for this challenge here but simply to add a check for a value of a field on the viewing user's profile and then to select the correct view mode from Display Suite for that node depending on that value. What would I have to do to accomplish this?


texts: Where do I specify the URL of the incoming XML?

texts:
In D8 I installed the feeds module.

I added a feed type named Coindesk

Before I can do the mapping I should add a url to this feedtype. I cannot find where I should do this. I looked in all the settings...

Where should I add the url van de XMl feed?


texts:
I am using Read time module for calculating the read time for each node. Value is getting inserted in the database table correctly. But I didn't get an idea about how can I get this value in view. Because I want to show this in a article list view. ie each article's read time in its card.

How can I achieve this?


texts: How to send an email from user email templates programmatically?

texts:
There are some email templates on the admin interface of the user account settings.

I want to load that email template and change the token value dynamically in my custom module and then send that email?

Any one who have some idea?


texts: Existing image field is not appearing in views

texts:
I am having a trouble with displaying existing image field of article content type in views.
It's not coming while adding a field in views to display.

I am using drupal-8.1.x, also I have tried to upgrade the drupal to it's latest version but it didn't worked.


texts: How to use Hierarchial Select Module for select field's of webform module?

texts:
Answer is to use Hierarchial select module for dynamic options list based on the previous select box value

How do I use Hierarchial select module in my webform module for select fields?


texts:
I have the following query:

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

Then I want to access all content:

$nodes = \Drupal\node\Entity\Node::loadMultiple(array_keys($result));

But in variable $results, there are wrong NIDs. My first article ID is '12' and second article '13'. But in $result are '9' and '10'

Do you have an explanation for this?

Ok, I found out I can't use array_keys... because keys are not same as IDs. Proved just now in an easy example... in my $result[9] there is the right id '12'.


texts: Cookie not being created (not a schoolboy error, I hope)

texts:
I'm building a deeplink system into a very complex website which needs cookies and other context set-up before the deeplink will work (otherwise the page gets redirected back to the home page - not much use).

So I've added a module which provides the deeplink entry point through hook_menu:

deeplink/<deeplink-parameters>

The callback builds the context, adds the cookies and then redirects to the actual required page.

So much for the theory. It doesn't work and I can't figure out why not.

In order to replicate a completely "virgin" request I've been using incognito windows, restarting the server and clearing caches before each test. In the test version I'm not redirecting to a new page, just outputting a line of text to display the page.

But even attempting to generate a simple test cookie with a long life (REQUEST_TIME + 999999) fails. No cookie created. The setcookie() function is returning TRUE (cookie created), which implies there is no problem.

The only cookies I can see are the ones created by JavaScript on the page itself, and a couple created by the Zeus wrapper (there are no Zeus rules to delete cookies on standard Drupal pages).

Just in case the cookie isn't visible on the first page I am also then moving to another page but still no cookie. Seems like it just isn't being created despite what the function says.

Additional data: There is also no PHP Session ID cookie.

Any thoughts as to why the cookies are not appearing?

EDIT: Looking at this further, I moved the setcookie() function into index.php (before the Drupal bootstrap), and it still wasn't creating the cookie.

So rather than issuing the deeplink command as above I simply went to the home page. And it's still not creating the cookie (as an anonymous user, with everything cleared before we start).

Only when I moved away and into the more complex part of the site did the test cookie appear. At the same time that the PHP Session ID cookie appeared. Is this a hidden dependency? No cookies can be created through PHP unless there's a PHP session ID?


texts: Is Organic Groups 7.x ready for production?

texts: I am about to build a community and planned on using organic groups. I was using drupalmodules.com to download modules, and I noticed that that the reviews for organic groups 7.x are terrible. http://drupalmodules.com/module/organic-groups. Is anyone using organic groups 7.x, and what are your experiences with it?


texts: Are there any acceptable uses for $_COOKIE['has_js'] outside of core?

texts:
Drupal 7 has a cookie called has_js.  drupal.js sets this cookie, and it is used by the Batch API and the authorize.php script.

There is a rather old issue about this cookie, backport "$_COOKIE['has_js'] must die" patch to 7.x, but this cookie still remains in drupal-7.x.

Are there any acceptable uses for this cookie, outside these two cases in core?


texts: Programmatically render user edit form with form mode

texts:
I can't figure out to render the user profile form with a custom display mode. I did search the forum and internet and it seems that this piece of code should work:

 function mymodule_entity_type_build(array &$entity_types) {
      $entity_types['user']->setFormClass('my_custom_form_display_mode_id', 'Drupal\user\ProfileForm');
}

combined with

$user = \Drupal::entityTypeManager()
->getStorage('user')
->load(1);
$formObject = \Drupal::entityTypeManager()
  ->getFormObject('user', 'my_custom_form_display_mode_id')
  ->setEntity($user);
$form = \Drupal::formBuilder()->getForm($formObject);

However, the form that gets loaded actually contains all fields and is not even using the default form mode. What am i doing wrong?


texts:
I have been Googling and trying to find out why when I perform a ajax callback that the form's submit function is also called. I looked at the ajax documentation and see no mention of this behaviour. Is this suppose to happen and how do I stop it if need be?

Thanks.


texts: Content, terms and user/author import or migration to D8 without custom module

texts:
How can I only import or simply migrate content (nodes), related terms and users/content-authors from a D7 project into a better structured D8 installation, which is similar to the old project, but meant as a project upgrade replacement, but with changes regarding how things work in D8 and which require to import the data only, apart from the code/modules of the old project?

The D8 installation is already prepared to reflect the old project with the same fields, menus, etc, but it uses different solutions for relationchips than its D7 predecessor. I would love to import content, comments, terms and users seperately (for example as CSV) and with key-ids helping to rebuild their relationchips. But ...

TBH, the migration docs I read over the last days made me even more confused than being helpful since many little in between parts and steps are not further explained so that I can not hook into and alternate the steps for my needs.

All I already know is, that Feeds and Feeds import isn't ready yet and that migrating is rather complex and is made for not only importing content but for whole project structures? But how if so many modules have no D8 version or working upgrade path?

What I read so far is:
https://www.drupal.org/docs/8/modules/migrate-source-csv/using-the-migrate-source-csv-plugin

which maybe comes close to what I maybe need for my issue. But I have a hard time to understand parts of it. So I see a use example with

 migration_groups:
  - ACME import

in it but without explanation if this line is required and what it is about. Googling for migration groups confuse me even more.

Is migrate_plus with migrate-source-csv the right direction for my purpose and is somebody out there who can help about the terminology of the migration docs and what parts are important to understand?


texts: Hide/show pages depending on landing page click

texts:
Last year i created a drupal 7 website for a MMA Trainer . He's pretty happy about it.
But now he wants to expand his business to personal training and has some new requirements.

He wants a landing page where people can click on 1 of 2 links(Gym / Personal training)
Depending on what the user clicks i have to hide/show certain pages on the website

How would i go about doing this ? Is there somekind of variable i can set on a landing page that i can check in drupal to hide pages ?


texts: Upgrade Drupal 6 to 7 using Drush 5 in Windows

texts:
Drush 4 has a site-upgrade command for major version upgrades.

Looking at Drush documentation pages, and it looks like the command is not a feature in Drush 5. Is there a replacement or was it removed? I'm using the windows version of drush 5.


texts: Article page url in chinese language Drupal 7

texts:
When i am visiting my site individual article page url in chinese language got below error, even this URL working fine in my localhost.

Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xE7:titl...' for column 'location' at row 1' in /var/www/includes/database/database.inc:2204     cloud-server-01     /zh-hans/articles/%E5%9D%90%E6%8B%A5%E5%95%


texts:
I want to use photoswipe script on my site to preview images. I downloaded the script, copied two JS files code-photoswipe-1.0.11.min.js and simple-inheritance.min.js. Include them in a file theme.info:

scripts[] = js/code-photoswipe-1.0.11.min.js
scripts[] = js/simple-inheritance.min.js

Next, I overwrite template with image field:

            <?php print $output; ?>

HTML generate this code:

But nothing your working. What's wrong?
FireBug displays two errors:

Uncaught ReferenceError: SimpleClass is not defined       code-photoswipe-1.0.11.min.js:28
Uncaught TypeError: undefined is not a function                                       8:62


texts: Execute some steps before REST POST request

texts:
I have created a custom content type and configured it to be created via REST POST method using REST client like POSTMAN or any frontend(like angularJS or react).

I want to execute few steps before creation of content type when a POST request is made. For example, make a SOAP call to SAP or make a query to external DB, and based on some condition like if data is received from SAP or external DB, then only content type should be created else it should throw some custom error.

I am new to Drupal and any guidance is welcome.


texts: What's the best way to put in a link to a translated node in a D8 template?

texts:
There just has to be a better way to insert a link to an alternative translation than this:

function THEME_preprocess_node(&$variables) {

  $node = &$variables['node'];

  // Current language
  $current_language = \Drupal::languageManager()->getCurrentLanguage()->getId();
  $variables['current_language'] = $current_language;
  $variables['current_language_url'] = $node->toUrl()->toString();

  // If this is a multi-lingual node, get links to alternative language.
  $languages = $node->getTranslationLanguages();
  foreach ($languages AS $langcode => $language) {
    $node_ja = ($langcode == 'ja') ? $node->getTranslation('ja') : null;
    if ($node_ja && is_object($node_ja) && $current_language == 'en') {
      $node_url = $node_ja->toUrl()->toString();
      $variables['node_url_ja'] = $node_url;
      $variables['node_url_ja_translation'] = 'Japanese';
    }

    $node_en = ($langcode == 'en') ? $node->getTranslation('en') : null;
    if ($node_en && is_object($node_en) && $current_language == 'ja') {
      $node_url = $node_en->toUrl()->toString();
      $variables['node_url_en'] = $node_url;
      $variables['node_url_en_translation'] = 'English';
    }

  }

  // Display link to alternate translation.
  $variables['node_url_translation'] = ($current_language == 'en') ? $variables['node_url_ja_translation'] : $variables['node_url_en_translation'];

}

It works, but it's just not at all graceful. How should this be written?  I just want to put in a link like this into a templates/node.html.twig file:

{{ node_url_translation|raw }}


texts: Is there a way I can access the user profile picture filename?

texts: I want to create a view in the Drupal 7, where I can show the User Profile picture name (the original which user uploaded) and the path its saved.


texts: Add all the fields to view automatically in csv export

texts:
I am using entity registration module for node registration.Now i wants to export the registrants.

I am using view export module to export registrants list. Its working fine

But as the registration fields is different per node i can not add a fix number of field to export.

I am trying to use global php field, its working for single column.

Is there any alternatives?

What other i have tried?

function paticipant_export_views_pre_view(&$view, &$display_id, &$args) {
          if ($view->name == 'paticipants_export') {
            views_db_object::add_item($view->current_display, 'field',
    'field_data_field_first_name_1', 'field_first_name_1',
$options = array(
            $handler->display->display_options['fields']['field_first_name_1']['id'] = 'field_first_name_1',
            $handler->display->display_options['fields']['field_first_name_1']['table'] = 'field_data_field_first_name_1',
            $handler->display->display_options['fields']['field_first_name_1']['field'] = 'field_first_name_1',

            ), $id = NULL);

          }
        }

Thanks for your suggestion.


texts:
I would like to manage user permissions with Drush, but I don't find any command on the official documentation website.

How to achieve this?

I am using Drupal 6, and Drush 6.0-dev.


texts: Update drupal module with existing custom changes

texts:
I am new to drupal and am wondering when I update a drupal module, say the menu module for example.

If I have some existing custom changes to the module, is it ok to just update the module and it will retain all my custom changes once the update is completed?

Or is it going to overwrite all my custom changes and I would have to "re-do" them or will it actually create a merge conflict during the update?

I am not entirely sure the practice in updating modules where there are custom changes added to it so any insight would be helpful.  This is for drupal 8.

Thanks!


texts: Views : Use a custom template field even if it's excluded from display

texts:
In a Views, I have two field :

Link field : With 1 to n links to display (excluded from display)
Body field : Who use the previous link field (via rewrite output and token)

I have created a custom template for display link field like I want.

Here is my problem:
When I render my Views, my custom template isn't used for display my links...
He use the display function defined in the link field settings.

Is there a way to force View to use my template ?
Any suggestions to do this?

Edit : Some screenshot of fields and theme informations

Link field :

Body field :

Theme Infos :


texts: How to populate filter options with another field values?

texts:
Consider the following nodes:
- 'Match' which has a 'field_season' field referencing to 'season' node
- 'Player' which has a 'field_seasonS' field referencing to 'season' node, allowing multiple values.

On the player's node page I created a view showing his results, with an exposed filter to 'field_season' that let me to filter out the 'Match' nodes.

I'd like to populate the exposed filter options with the values inside 'field_seasonS' of that player, letting me to choose only the seasons that player played


texts: How can I restrict a Flat Rate to a single product SKU?

texts:
Shipping 2.0.
Flat Rate is $4.95.
I only want to offer this one Flat Rate I created to product SKU= 146

The place I am confused is in editing Conditions. What do I set the "Data Selector" to? Everything else makes sense to me but the Data Selector.


texts: Views filter by date is showing incorrect data

texts:
I'm having a strange issue with one of my views in drupal 7.
The view has an exposed date field (unixtimestamp) and I can select a range. If I select for example March 1 to March 31, 2020, the table shows an entry for April 1. Below is the details of the node that shoudn't be shown.
Is this some issue related with the timezone?


texts: #ajax on a managed_file custom form field is not working

texts:
I have a custom Drupal 8 form using a managed_file field with an #ajax callback but the ajax callback is never called (example below). I assume that it's because the managed file field type is already using ajax. Is there a way that I can implement my own ajax callback within my custom module to fire after the managed file's own ajax completes?
 $form['file'] = array(
      '#title' => t('Image File'),
      '#type' => 'managed_file',
      '#required' => TRUE,
      '#upload_location' => 'private://',
      '#multiple' => FALSE,

      '#upload_validators'    => [
        'file_validate_is_image'      => array(),
        'file_validate_extensions'    => array('jpg png psd ai bmp eps jpeg pdf tif tiff'),
        'file_validate_size'          => array(56600000)
      ],

      '#ajax' => [
        'callback' => array($this, 'myAjaxCallback'),
        'event' => 'change',
        'wrapper' =>  'im-area',
        'progress' => array(
          'type' => 'throbber',
          'message' => t('Choose City'),
        ),
      ],
    );


texts: How to trim the Node field is rendered in page.html.twig?

texts:
I have rendered the node(custom) field in page.html.twig. Custom field is a summary text field.

And now, I want to trim the text field.

I have tried the below code,

{% set summary = node.field_custom|render|striptags %}
{{ summary|length > 10 ? summary|slice(0, 10) ~ '...' : summary }}

This is not working in page.html.twig. But its working only in the node.html.twig.

Showing error like,

Uncaught PHP Exception Exception: "Object of type Drupal\\Core\\Field\\FieldItemList cannot be printed."

How do I trim the summary field which is rendered in page.html.twig.

Please help me to solve this ?

NOTE: I could not control it in the managed Display section. If the reduce the number in the Trim character section, its not working.


texts: How do I implement access checks based on referring nodes in the grants system?

texts:
Following a suggestion in another thread here I'm trying to rewrite the access restrictions that I developed using hook_node_access (and that are working well, so far) in Drupal's grant system (i.e. using hook_node_access_records and hook_node_grants). I would like to do that for two reasons:

I'm worried that the current access checks might become a performance bottleneck, when the number of users grows.
I need to use the results of access checks as a filter in views.

Here's a truncated version of my current access checks:

function mymodule_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Session\AccountInterface $account){
  $type = $node->bundle();
  $user = $account->getAccount();
  $uid = $user->id();

  // only handle the lesson content type
  if ($type === 'lesson') {

    // ...

    // check the user's access to the referring courses
    $courseaccess = FALSE;
    if ($node->hasField('reverse_entity_reference')) {
      $parentcourses = $node->get('reverse_entity_reference')->getValue();
      foreach ($parentcourses as $course) {
        $coursenode = \Drupal\node\Entity\Node::load($course['target_id']);
        // perform access checks for the referring course
        $courseaccess = $courseaccess || ...
      }
    }

    // ...

    // return the result
    if ($courseaccess) {
      return AccessResult::allowed();
    } else {
      return AccessResult::forbidden();
    }
  }

  // ...

}

Note that, in essence, I need to check, whether the current user has access to any of the nodes (courses) that are referring to the viewed node (lessons): That determines, whether the user may access the lesson. I'm using reverse entity references for that.

As I see it (I'm open to suggestions), there are fundamentally two ways for approaching this. Unfortunately, so far, I have been unable to solve the problems involved. So, in my understanding, I could...

Put (more or less) the full access logic into hook_node_grants: That would mean, I need to have access to the currently viewed node (lesson) in hook_node_grants to be able to follow its reverse references to check, whether the user has access to any of the referring nodes. Is that possible? There's no $node variable...
Put (more or less) the full access logic into hook_node_access_records: In that case, the problem is that the hook only gets called (and thus the lesson gets updated), whenever the node is saved. So, the access restrictions will be out of date, as soon as a lesson is included in another course.

I'm unsure how to proceed at this point. Is it even possible to rewrite this in the grant system? Any other ideas?


texts: How to assign default values for an edit form?

texts:
In my form I create a field of type list (with the widget box is checked). By default, this field has no value.

In my hook_form_alter () method, I add options (via PHP) has this field.

$form['field_genric_domains']['und']['#options']= _get_domaine_options();

if($form['field_genric_domains']['und']['#default_value'] == NULL){
    $form['field_genric_domains']['und']['#default_value']  = array(_get_this_domain_id());
}

Then I set a default value. I set up a test that shows whether we are editing or creating.

When creating, it works perfectly, but when editing the table (# default_value) is empty. Normally it should contain the values previously inquire.

Why? Thank you for your help


texts:
I have a form that is using ajax to filter from a dropdown to another dropdown and then I have ajax setup on the submit button to submit the whole form via ajax.

Everything works fine in the main module page, but the ajax does not work on other module pages.

I don't see any javascript errors in the console, and it seemed that all the javascript files related to drupal's ajax were loaded with the page.

What could the problem be?

Thanks!

Update:

I am using Drupal 7.9. The code that I am using to submit the form in ajax is:

$form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Transfer'),
        '#submit' => array('ajax_create_transaction_submit'),
        '#ajax' => array(
            'callback' => 'ajax_create_transaction_callback',
            'wrapper' => 'user_transfer_panel',
            'effect' => 'fade',
            'progress' => array(
                'type' => 'throbber',
                'message' => t('Processing transfer. Please wait...'),
            ),
        )
    );

This code is working but only on 1 page within my module.


texts: How to count the number of post by author in D7?

texts:
I am using the following code in drupal 6 but now this code does not work with Drupal 7.

<?php
$uid=$node->uid;
$results=db_query("select COUNT(nid) AS count from node where uid=$uid");

while ($res = db_fetch_object($results)) {
print "
" . $node->name . " has submitted " . $res->count . "          source code / articles.
";
}
?>

My primary problem is on how to query the number of post like the sql statement above as:

db_query("select COUNT(nid) AS count from node where uid=$uid");

Anyone know the equivalent to this on D7?

BTW, I want to use the code in display suite module.


texts: How can I implement OAuth based login, just like drupal.stackexchange.com offers?

texts:
Possible Duplicate:
  What are the differences between the various OpenID widgets available?

I know there is the Janrain Engage module, but I don't want to depend on an external provider. Can I implement it with any Drupal module?


texts:
I am trying to migrate a drupal 6 to 8 through drupal migrate ui and i am getting a error with the sources files, drupal 8 is not able to read sites folders due is writting a double slash.

Does anyone why this happens?

  Source ID 3125: Cannot read from non-readable stream (http://dev.example.com/example//sites/default/files/)

The URL has an empty part in the path. I tried with full permissions in this folders, source in subdomain, domain, folder, etc.


texts: Count of entities with a certain field value, filtered by created date

texts:
I’ve got users with a gender field and I want to display counts of how many males and females were registered on or before a particular date.  So:

COUNT(user.gender=male) and COUNT(user.gender=female) where user.created < {date}.

Using views aggregation I can easily get the male/female counts for ALL users, but when I try to add either a filter or a contextual filter on user.created I get no results (and my brain goes flatline—see “extra credit”, below).

Is it possible (within Views) to do what I’m trying to do, and if so, how?

Extra credit: 4,000 brownie points for anyone who can help me understand why when you add a filter you specify aggregation rules.  When filtering, I'm thinking about constraining the results, not aggregating them.  What am I missing?.

Thanks!


texts: Can "Demonstrate block regions" use a specific template?

texts:
I have two templates in my theme called page--front.tpl.php and page.tpl.php. When I click at the link "Demonstrate block regions" (Structure/Block) it shows the page.tpl.php template. Is it possibly to change the template to page--front.tpl.php?

Thank you for your answer.

My .info file look like this
name = xxx
description = xxxxx
core = 7.x
engine = phptemplate
stylesheets[all][] = css/css.css
regions[banner] = Banner
regions[header] = Header
regions[leftcolumn] = Left Column
regions[content] = Content Column
regions[rightcolumn] = Right Column
regions[footer] = Footer

It should be all right I think?

page.tpl.php is my sub page and consist of the regions: banner, header, left column, content column and footer.
page--front.tpl.php is my front page and consist of the regions: banner, header, left column, content column, right column and footer.

The website works perfectly. It shows content as it should do. But when I use the link "Demonstrate block regions" (Structure/Block) it shows the page.tpl.php template (I have checked that with devel_themer). I can see the regions: banner, header, left column, content column and footer. Not the region right column.

I wish it was the template page--front.tpl.php instead of  page.tpl.php so I could see all the regions.


texts: I created a contact form in Drupal 8 and would like to use that form on several pages across my website. Can I do something like Insert / Form or use some sort of shortcode to display the form?


texts: Term name converted to term id filter removed?

texts:
I am currently working on a view that should show all items from a content type with the given taxonomy term name (not id) in the url.

While this was easy to achieve in D7 (by following the answer on this question: Views contextual filters taxonomy name), I can't seem to find the validator filter now.


texts: How can I change Menus depending upon domains (url name)?

texts:
I want to change main menu items depending upon domain and sub domains url in a single site.

I could have done it easily with roles, but issue w.r.t anonymous users. How would I show or not certain items in the main menu?


texts: Search using external sites Google Search

texts:
I am creating a Drupal site for a government agency, and we use Google Search for our websites. The problem I'm running into is the domain the site I'm creating is on is foo.com, and the search is supposed to be run through bar.gov.

My question is is there any way to get either the built in Seach module or the Google CSE module to submit the search query on the other domain? And if there isn't how would I go about creating either a block or content pane with the search box I need?

What I need is when you click Search on foo.com it directs you to bar.gov/gsearch?sitesearch=foo.com&q=terms. Specifically getting a form's action to be the bar.gov/gsearch.


texts: How to change a collection field value with presave

texts:
I'm using field_collection module, and $question is a collection field.

$question->value = 'test';
$node_poll->save();

The above code works for update this collection field value. Problem is this cannot be used for presave.

$question->value = 'test';
//$node_poll->save(); // I removed this since it does not need for a presave.

When I use above code for a presave hook. The value did not change.

How to set a value for this collection field with presave with D8?


texts:
Am working on the site with Mathematical content(Drupal 6.18).
Have success fully integrated Mathjax for representing mathematical equations. But have an problem to generate PDF of same content.
The issue is that Mathjax Processes the Equations after page is loaded and am using the Print,pdf module. While PDF generation, content is pull from the database which is not mathjax Processed. Hence scrambled data!!!
Is there anyway I can preprocess the content so that the PDF is generated exactly as shown on the web.
I know there are tools to convert HTML to PDF like wkhtmltopdf but any help doing this with Drupal core will be greatly appreciated.


texts:
I have the following code to alter the way comment form is displayed. After the bellow code everything is displayed as i want to but it does not add the comments.

 global $user;
     if ($user->uid) {
       $form['author']['_author'] = array
     (
        '#tittle' => 'Name',
        '#attributes' => array('id'=>array('name')),
        '#prefix' =>'

Name'.$form['author']['_author']['#markup'],
        '#suffix' => '
'
     );
     }
     else {
     $form['author']['name'] = array
     (
        '#type' =>'textfield',
        '#attributes' => array('id'=>array('name')),
        '#prefix' =>'

Name',
        '#suffix' => '
'
     );
     }

     $form['author']['mail'] = array(
        '#type' =>'textfield',
        '#attributes' => array('id'=>array('email')),
        '#prefix' => '
Email (optional)',
        '#suffix' =>'
',
        '#required'=>TRUE,
        '#weight' => 2
     );

    $form['comment_body'] = array
     (
        '#type' => 'textarea',
        '#attributes' => array('id'=>array('comment')),
        '#prefix' => '
Comment',
        '#suffix' => '
',
        '#weight' => 4,
        '#resizable' => FALSE
     );

     $form['author']['homepage']['#access'] = FALSE;
     $form['subject']['#access'] = FALSE;

     $form['captcha']['#prefix'] = '

';
     $form['captcha']['#suffix'] = '
';
     $form['actions']['submit'] = array (
        '#prefix' => '<button type="submit">',
        '#suffix' => '</button>

',
        '#markup' => '' . t('Say your piece') . ''
     );

    $form['#action'] = $_SERVER['REQUEST_URI'];

To submit the form i have to press twice on the submit button ( how can i solve it ? ) and after i submit the form again i get the following errors and i cannot figure it out how to solve them:

Warning: array_values() [function.array-values]: The argument should be an array in _field_filter_items() (line 513 of /home/mcristi/public_html/jhub/modules/field/field.module).
Warning: Invalid argument supplied for foreach() in text_field_validate() (line 119 of /home/mcristi/public_html/jhub/modules/field/modules/text/text.module).
Notice: Undefined index: homepage in comment_form_validate() (line 2155 of /home/mcristi/public_html/jhub/modules/comment/comment.module).

This thing causes the problem that the form is not submitted/saved :

 $form['actions']['submit'] = array (
        '#prefix' => '<button type="submit">',
        '#suffix' => '</button>

',
        '#markup' => '' . t('Say your piece') . ''
     );

    $form['#action'] = $_SERVER['REQUEST_URI'];

Is there any possibility to save the comment on the node page ? ( to not be redirected to /comment/reply/$nid)


texts: Iterate through all children of an element

texts:
I have a Drupal code below:

function myid_create_template($form, &$form_state){
    $form['myid_templates_editor']['#access'] = TRUE;
    foreach (element_children($form['myid_templates_editor']) as $child1)   {
        $form['myid_templates_editor'][$child1]['#access'] = TRUE;

    }
    return $form;
}

This code iterate to the first child only of an element, but not the child with degree 2 or more. How will I iterate it to all child/grandchild of the element?


texts: Drupal 7 Webform Components Related To Individual Nodes

texts:
I am attempting to create a decision making "questionnaire" in Drupal 7. I am currently using the Webform module to create the questionnaire.

The questionnaire (webform) will create a list of related nodes based on the users submission. What I need is a way to relate the nodes to the webform components.

For example, if a user selects 'Coffee Shop' & 'Sandwiches' on one of the multiple choice questions, all nodes relating to 'Coffee Shops' & 'Sandwiches' will be added to the list.

Is there an available module that will allow me to relate webform components to nodes or would I some how incorporate taxonomies into this for the relationships?

Would EntityForm be a better module for this type of thing?


texts: How to make a block visible on a particular page and as well as on taxonomy term page?

texts:
here is my situation,

I have a Taxonomy menu block built using taxonomy_menu and taxonomy_menu_trails module. And I have used block_term module to display the menu on nodes with given term(s).

Now, how can I display the same taxonomy menu block on taxonomy term pages as well?

I tried adding the taxonomy term page link to display block only the listed pages. but it did not work. while doing this I had both the conditions (Display on nodes that are taged to terms and Show only on listed pages) checked.


texts: How to load jQuery UI after bootstrap js files?

texts:
I'm a newbie to drupal 7, And I'm facing a conflict between jquery.ui.button.js and bootstrap/button.js because jquery ui is loaded before bootstrap.
How can I change the order and load jquery ui last?

Knowing that bootstrap files are loaded by the theme, and jQuery UI is loaded by the module (jquery_update)


texts: Theme Ubercart product node and form in Drupal 8

texts:
I've been trying to do a "simple task" with Drupal 8. Using Ubercart 4.x, I want to totally change the product (add to cart) page.

For that I've created a twig file called node--product.html.twig and I've fully customized it. But the form is not there.

In order to have the form I've added this to my .theme file:

function theme_preprocess_node__product(&$variables) {
  // Creates a AddToCartForm for the given product (with node->id());
  $form_object = new \Drupal\uc_product\Form\AddToCartForm($variables['node']->id());
  $variables['product_form'] = \Drupal::formBuilder()->getForm($form_object, $variables['node']);
}

And now the form is accessible via the product_form variable in the node--product.html.twig file.

But that's where my issue start, I only find two ways of handling the form, either I do this:

{{ form }}

But then I have the form with the "normal" design, or I create it myself by doing something like this:

<form id="{{ product_form['#form_id'] }}" method="{{ product_form['#method'] }}" action="{{ product_form['#action'] }}">
  (...)
</form>

This way works since I can now customize the attributes, but I don't have access to their ID (I'm getting the values from the node--product node and not the form).

So my question is:
How can I handle this in order for me to fully customize the product node?


texts: Modules for RTF with inline images + word limits?

texts:
I want to allow all users of my sites to add there own blog post, with certain constraints.

Here's the form I want to give them:

Title:

Contents (RTF, max 700 characters):

Submit (or Login/Register then Submit):

Mandatory for all posts to:

enable read/write permissions on comments
be published to the /const/ with the title they initially provided
allow edits and unpublishing by administrators


texts:
I have a drupal module creating a new page using a menu hook. And I have menu blocks (menus displayed as blocks) that SHOULD be showing up on the drupal module page. But I cannot seem to get them to display? How can I get these menu blocks to show up? I tried added it to a menu and that did not work.

Create Menu

  $items['gift_cards'] = array(
    'title' => 'SELECT A CARD',
    'page callback' => 'uc_gift_certificate_order_page',
    'access callback' => 'user_access',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

This is the function to make the page, it is simply a drupal form.

function uc_gift_certificate_order_form($form_state) {
    // This is the function that generates the required page for ordering the gift card.
    // Load the required datepicker JS/CSS
    drupal_add_css(drupal_get_path("module", "uc_gift_certificate").'/datepicker/css/datepicker.css');
    drupal_add_js(drupal_get_path("module", "uc_gift_certificate").'/datepicker/js/datepicker.js');

    // We already have the block part (gift card rotator)
    // Display the form
    $form['#attributes'] = array('class' => 'gift-card');
    DRUPAL FORM API STUFF
}


texts: Customizing filter criteria search of a view

texts:
I've got a view with an exposed to users filter criteria ajax search. I want to customize it somehow and link a specific search phrase to a specific node.

any idea on how to do that? any way around without getting my hands dirty with coding?


texts: Using simplenews in conjunction with sendgrid is possible?

texts:
I have installed and configured the simplenews and sengrid module. Sendgrid depends on mailsystem. When the module is installed, it configures itself.
I've done the test posts that sendgrid provides in the module and it works fine.
Now I am trying to send the simplenews nodes but I can't get them to send.
Is this integration possible or something additional needs to be developed to make it work.
I have configured it as follows


texts: How to use view's relationships to pull user entity reference data?

texts:
I created 2 new user fields for the user (object/entity) on my D7 site. Using views, I can select 'content' or 'user' for querying data. When I use views to query the 'user', the 2 new fields come up just fine. However, when I select 'content', the 2 new fields are not there. This makes sense to me since the 2 new fields are tied to the user entity.

For my purposes, I need both content AND user data. The strange or weird thing is, when I select 'content' for my base and use relationships to find and pull user entity fields, SOME old custom created fields already tied to the User Entity is present and I can select them, BUT my 2 new fields are not.

I tried clearing caches and making sure I had active content with the 2 new fields enabled. So why can I find in relationships, entity references to old custom fields, but not my new fields I created?

It feels like a catch 22. If I select user, I have my new fields, but not the content, and vice versa.


texts: Facetapi combined filter of city and zip code

texts:
I am using address field module with search api and facetapi modules.
I want one filter of two fields, city and zip code. Which will be an autocomplete field.
I have used the Search API Combined Fields module. Created a combined fields filter with the following configurations:
Imitate field : Address » Locality (i.e. City)
Contained fields : Address » Locality (i.e. City), Address » Postal code

But the problem is, in facet settings I can see only links and links with checkboxes widgets. there is no autocomplete widget.
and second when I select one of a widget from links and links with checkboxes, it only displays the city names on the search page.
can anyone know the solution for this?


texts:
What I would like to do is to have a ?.tpl.php file in which I can write my own HTML content. A minimal example would be:

      <?php drupal_render($input_label); ?>

      <?php drupal_render($input_text); ?>


texts: Select all nodes, where date is greater then current date and repeat event option is empty

texts:
I have content type "event". In this content type I have a date field, provided by the Date Recur module. At the result I have range of the dates: Event start and end date. Also Date Recur provides an option to repeat event. I need to select all event nodes where date field is greater then current date and repeat event option is empty or select all nodes, where repeat event option is not empty.

My code:

$current_time = \Drupal::service('date.formatter')->format(time(), 'custom', 'Y-m-d\TH:i:s');

$query = $this->db_connection->select('node__field_type', 'n_f_type');
$query->join('node_field_data', 'n_f_data',
  'n_f_data.nid = n_f_type.entity_id AND n_f_data.type = n_f_type.bundle');

$query->join('node__field_event_dates', 'n_event_dates',
  'n_event_dates.bundle = n_f_type.bundle AND n_event_dates.entity_id = n_f_type.entity_id');
$query->fields('n_f_data', ['nid']);
$query->condition('n_f_type.bundle', 'event');
$query->condition('n_f_data.status', 1);
$group_and = $query->andConditionGroup();
$group_and->condition('n_event_dates.field_event_dates_value', $current_time, '>=');
$group_and->condition('n_event_dates.field_event_dates_rrule', '', '<>');
$query->condition($group_and);
$group_or = $query->orConditionGroup();
$group_or->condition('n_event_dates.field_event_dates_rrule', '%RRULE%', 'LIKE');
$query->condition($group_or);
$query->range(0, 500);
$events = $query->execute()->fetchAll();

Please, can anybody help me to build the correct query, because current query returns empty array.

SELECT * FROM table_name.node__field_event_dates where
((field_event_dates_value >= '2019-07-17T10:00:00') and
(field_event_dates_rrule is null or field_event_dates_rrule not like
'%RRULE%')) or (field_event_dates_rrule like '%RRULE%');

Last query works fine;

I need some help to transform the last query via using Drupal and/or conditions.


texts: Finding out the machine name of a field when using Views

texts:
When using Views, I always use fields instead of content. But I noticed that Views does not show the machine name of a field and it only assumes that you already know it. Is there some other way to find out the machine name?

Knowing the machine name lets me access the field directly like so

print $fields['machine_name_here']->content;


texts: Pass role variable through $author (advanced_forum module?)

texts:
i'm trying to show last_post $author role in the advanced forum forum-list.

What i've discovered is that last_post appearance can be changed in advanced-forum.submitted.tpl.php, however the $author variable does not contain anything except 'topic' and 'time' according to https://api.drupal.org/api/drupal/modules!forum!forum-submitted.tpl.php/7 which is not enough for me...

is there any way to add a "roles" variable $author var?

This is needed to code the username in relation with it's role (http://pastebin.com/9gDX2qi3 - under the (HERE AUTHOR ROLE_ID) part)


texts: How to tell the difference between multiple image_buttons on the same form?

texts:
Using FormAPI to create a simple set of three image_buttons, in the form_submit handler there is no 'op' value set in $form_state and therefore no way to tell which image_button was clicked. Is this a limitation of image_buttons?

Here's what I used to create the form, and it's bare-bones submit handler that shows no information telling me which button was clicked:

function cex_dash_top_icons_block_form( $form_state ) {
  $form = array();
  global $base_url;
  $projects_icon_path  = '/'.drupal_get_path('module','cex_dash').'/Projects-icon-med.jpg';
  $reporting_icon_path = '/'.drupal_get_path('module','cex_dash').'/Reporting-icon-med.jpg';
  $help_icon_path      = '/'.drupal_get_path('module','cex_dash').'/Help-icon-med.jpg';

  $form['projects'] = array(
    '#type'  => 'image_button',
    '#value' => 'Projects Dash',
    '#src'   => $projects_icon_path,
  );

  $form['reports']  = array(
    '#type'  => 'image_button',
    '#value' => 'Analytics Dash',
    '#src'   => $reporting_icon_path
  );

  $form['help']     = array(
    '#type'  => 'image_button',
    '#value' => 'Documentation Dash',
    '#src'   => $help_icon_path
  );

  return $form;
}

function cex_dash_top_icons_block_form_submit($form_id, &$form_state) {
  _devReport( 'cex_dash_top_icons_block_form_submit: form_state is "'.print_r($form_state,1).'"' );
}

And no matter which button is clicked, $form_state['values'] looks like this:

[values] => Array(
  [projects] => Projects Dash
  [reports] => Analytics Dash
  [help] => Documentation Dash
  [form_build_id] => form-b6c762d22d0fd2360d1804ef19043c7d
  [form_token] => 4f0ce5275cc923e8fb27c305b57bf414
  [form_id] => cex_dash_top_icons_block_form
)

Now, in the larger $form_state array there is a 'clicked_button' array, but that always only has the information for the last image_button.

Do I need to create one mini-form for each image_button?


texts: Add class to all labels in a comment form

texts: Pretty straight forward.  For every label within a comment form, I wish to add a particular class to it.  Using only functions in template.php, in Drupal 7, how can this be done?  If it can't be done this way, what is the most straight-forward alternative?


texts: Why is #field_parents empty in nested, multi-step form?

texts:
I'm using Webform, Fieldgroup and Multistep with D7.

Ultimately I'd like to create a hierarchically-grouped list of all the submitted values and display on the last step of the multi-step form, with the following format:

Page 1

Question 1 Label

Question 1 Response

Question 2 Label

Question 2 Response

Question 3 Label

Question 3 Response

Page 2

Question 4 Label

Question 4 Response

Question 5 Label

Question 5 Response

Question 6 Label

Question 6 Response

When I inspect the $form object, however, I see the fields each listed, but $form['field_my_question']['und'][0]['#field_parents'] is an empty array.

How can I identify from the $form object which fields belong on which page of my multistep form?


texts: Add JavaScript and css to page with nodes only if there is no tag in any of the nodes

texts:
I wrote a module that adds javascript and css to a page with nodes of type 'rower', now I need to add javascript and css to the page only if there is no tag with id == 1503 in any of the nodes. I tried to do it myself but it does not work because the variable $containsOutletTag == TRUE only at last node. Can you please tell me how I can do this? Here's what I have for now:

<?php
function countdown_preprocess_node(&$vars)
{
  if ($vars['type'] === 'rower') {
    $containsOutletTag = false;

    foreach ($vars['field_product_tags']['und'] as $tag) {
      if ($tag['tid'] == 1503) {
        $containsOutletTag = true;
      }
    }

    if (!$containsOutletTag) {
      drupal_add_css(drupal_get_path('module', 'countdown') . '/src/countdown.css');
      drupal_add_js(drupal_get_path('module', 'countdown') . '/src/countdown.js');
    }
  }
}


texts: How to move drupal into a subdirectory so non-drupal content works in the original folder?

texts:
I have a D7 site and then a lot of other non-drupal stuff I would like to keep in my joe/ folder on our server as joe/thing1/ joe/thing2/ etc. Right now, my folder joe/ just has the drupal installation and my other stuff is not deployed. I would like to move drupal into a subdirectory, but still have http://website/joe/ work as my original drupal site with clean urls, etc. Then I would like to be able to deploy my other stuff into http://website/joe/thing1, http://website/joe/thing2 etc.

How can I build an .htaccess file to serve drupal from a subdirectory unless a url points to an existing file? Or is that the correct way to go about this?


texts: Exclude users from users list in issue tracking

texts:
I'm trying to implement an issue tracking application with Drupal.

I have 4 clients and I want that each one of them will be able to access the site and add an issue.
I filter the project ID so any client see only his project issues.

The only thing I don't get how to do is to assign an issue.

In the "Issue" content type I created a "user Reference" filed called "Assign To" (which cause to Rules to send an email to the assigned user).

I want to be able to assign an issue to any client, but I want a client to be able to assign an issue only to me.

How can I do that?
If I can't exclude some users from the list (say-by role) - do you have any idea about different way to achieve the "Assign To" functionality?


texts: How does the events dispatcher map to map_save to a callback function?

texts:
MigrateEvents.php contains an event definition like this:

/**
 * Name of the event fired when saving to a migration's map.
 *
 * This event allows modules to perform an action whenever the disposition of
 * an item being migrated is saved to the map table. The event listener method
 * receives a \Drupal\migrate\Event\MigrateMapSaveEvent instance.
 *
 * @Event
 *
 * @see \Drupal\migrate\Event\MigrateMapSaveEvent
 *
 * @var string
 */
const MAP_SAVE = 'migrate.map_save';

If I grep the codebase for map_save, there is no other reference to it. What mechanism does Drupal/Symfony use to know the callback to call?


texts: Redirecting after submitting content - why this code doesn't work?

texts:
function MYMODULE_form_alter($form, &$form_state, $form_id) {
    if($form_id == "zdjecie_do_projektu_node_form" ||
       $form_id == "zdjecie_ze_szkolenia_node_form" ||
       $form_id == "referencja_node_form" ||
       $form_id == "zajawka_na_stronie_glownej_node_form" ||
       $form_id == "webform_node_form") {

        $form['actions']['submit']['#submit'][] = 'MYMODULE_node_submit';
    }
}

/**
 * Custom submit function.
 *
 * Redirect user to the site frontpage after node creation.
 */
function MYMODULE_node_submit($form, &$form_state) {
    $form_state['redirect'] = variable_get('site_frontpage', 'node');
}

The source for this solution is here: http://dropbucket.org/node/245

MYMODULE is of course replaced with real module name. The problem is that both functions are reached, however redirection  doesn't happen. Any ideas what am I missing here? Or what could interfere possibly with this code? I have no other custom modules and this is the only custom code. I tried with Overlay and without Overlay with no effect.


texts: Custom Module Remote Fails Checksum with Drush

texts:
Background

I have several proprietary Drupal modules that my company uses. We want to update these across all our sites. To that end, I've built an endpoint that produces code according to the (ill-documented) specifications required at https://www.drupal.org/node/542202#project%20status%20url

For those interested, the endpoint gets the project information from Bitbucket, where each core has a branch, then gets tags and parses out the tags as releases so it can get the newest one.

There's also some unzipping and re-zipping that goes on to put the returned .tar.gz in a format that Drupal accepts.

This works alright but there's a

Problem

While the GUI for Drupal works fine to update the module from the custom remote, Drush fails. Running drush up gives me the expected prompts, recognizes the new version, downloads the file and then fails. The message:

File {filename} is corrupt (wrong md5 checksum).

The mdhash in my XML file is correct, according to the md5 utility on MacOS. (It's calculated using PHP's md5_file utility). So, whenever I download the tar manually and check the hash, it's fine. But I cannot get drush to agree with me.

Any ideas? Thanks in advance.


texts: "This version is not compatible with Drupal 8.x and should be replaced."

texts:
The below theme files, which are the only files I have in my theme folder called 'Lychee', throw the error (in the 'Uninstalled themes' section of /admin/appearance):

  This version is not compatible with Drupal 8.x and should be replaced.

How should I resolve this? I followed this guidance: https://www.drupal.org/node/2349827

lychee.info.yml

name: Lychee
description: 'Mobile first theme.'
type: theme
core: 8.x
libraries:
  - lychee/global-styling
regions:
  - navbar: 'Navigation bar'
  - parallax: Parallax
  - content: Content

lychee.libraries.yml

global-styling:
  version: 1.x
  css:
    theme:
      assets/css/styles.css: {}


texts: custom entityreference widget not saving field

texts:
I am trying to create a custom widget for the entity reference field type which will be a hidden field with its value set to the current page's node id. This is my code:

function my_example_field_widget_info() {
  return array(
    'my_example_hidden_nid' => array(
      'label' => t('Hidden nid field'),
      'field types' => array('entityreference'),
    )
  );
}

/* implements hook_field_widget_form*/
function my_example_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $element['hidden_nid'] = array(
    '#type'=>'textfield',
    '#description'=>t('The nid of the Photo node which product line item refers to'),
    '#default_value'=>arg(1),
  );
  return $element;
}

I first tried this as a textfield, and saw that the form field was being properly populated.

This field is attached to a Drupal Commerce Line Item, to produce some custom functionality. However, when I clicked Add to Cart, and the Line Item was saved, this entityreference field was not saved into the database.
(Since I am adding a widget to a previously defined field type, I did not use any hook_field_schema()'s)

How can I fix this?


texts:
I have started building a new theme for my site. I use Foundation as the base theme and have followed the instructions in themes/zurb_foundation/STARTER/README.txt. I started off this work in a new GIT branch and everything seemed to work as expected, including functions in the template.php file. I then decided to merge this foundation branch to my master branch.

After activating the Foundation base theme and making my new sub theme the default theme in my master branch, everything works except for template.php which is now totally ignored. I have cleared all caches, I have run cron, I have double-checked the naming of the info file and all the functions in template.php... but I cannot get template.php to work.

Anyone? Maybe I should mention that compiling the custom.css file also still works.


texts:
How do you add a field where user can set hours when it's best to call for contacting. The Date field gives only days, months and years.

In this thread Webform: Time Field - Changing Variable Increments he states he has some time field for his Webform. But I can't track it down which module is that?


texts:
Migrating to Drupal 8 - I find a new restriction - in Views filter - Taxonomy term field cannot be more than 128 characters.....

In Drupal 7 I never had seen such a restriction, or it was more longer.... I could easily put some 15 Taxonomy Terms, without a problem....

Now - I can not put in Views filter 15 Terms....

not in row, due to 128 character limit, and not in several separate filters - I get Null outcome, if I try to add several Taxonomy fields one by one with additional terms....

How to add 15 terms in Views filter now, in Drupal 8?!


texts: How to prevent drupalSettings to sort settings object

texts:
I attach drupalSettings in a preprocess hook using code similar to the following one.

$settings = [
  'bcd' => 'BCD',
  'abc' => 'ABC'
];

$variables['#attached']['drupalSettings']['options'] = $settings;

When I print the content of drupalSettings using console.log(drupalSettings.options); I  get a sorted object.

{ 'abc' : 'ABC','abc' : 'BCD'}

Is this the normal behavior? How can I prevent it?


texts: Is this the correct way to add a page with hook_menu()?

texts:
I'm trying to create a page through hook_menu() so I can add my custom block with context instead.
function my_module_menu() {
    $items['my_page'] = array(
        'title' => 'my_page',
        'description' => 'my_page',
        'page callback' => 'my_function',
        'access callback' => true,
    );
    $items['my_page2'] = array(
        'title' => 'my_page2',
        'description' => 'my_page2',
        'page callback' => 'my_function',
        'access callback' => true,
    );
    return $items;
}

function my_function() {
    return '';
}

Is it the right way to do it?
I have some bug from time to time, like the block goes missing on those pages. Could it be related to that?


texts:
On the user/edit pages I would like to display a link based on a (text?)'field'
The link should only be displayed to users with the proper permission.
For this, I'll use the Field Permissions module.

My problem is that I don't to know how to output the field as a link.

I have tried the Link module but this seems to give users the ability to input a link.

In my case users should only see the link on their account page.

Any help appreciated.


texts: $base_path is not added to AJAX URL request in login form

texts:
I have a D7 site in a subfolder, and would like for AJAX requests to find the correct docroot folder.

When trying to login from localhost/mysite/user, AJAX sends a request to localhost/system/ajax. I've read that you can use the global variable $base_path for this, so I gave it a try, still the same error. I've checked in Firebug and indeed Drupal.settings.basePath does have the correct path. In settings.php is it written like this $base_path = '/mysite/';.

This made me wonder if the JS logic does not include the $base_path value by default and what would be a correct way to add this in. The site is tracked in Git, so I've also experimented with Apache configurations, such as ProxyPass, ProxyPassReverse, and ReWrite rules in order to prevent having to push changes that would risk breaking the site on the remote server.

I'm new to Drupal and not so experienced with Apache directives, any help here would be awesome :)


texts:
Sorry i thought i should ask this here as apposed to your CSS site as ive a feeling its something that Drupal is doing and not just a general css question.

When viewing the last comment time on the right of the main table of this page (and taxonony table pages) you will see that something is adding an  tag to my date field.
My site with the em added

The norm12 span class is what i have added and you can see that even making the font-style: normal with important added its still showing it with  tags and style about it.

Its only a minor problem but its driving me mad.

Can anyone see where the problem may lie?

Thanks


texts: Most maintainable way to make page with one top half and alternative bottom halves selected by tabs?

texts:
I want to make a page which has one top part, a row of two or more horizontal tabs beneath it, and alternative bottom parts which appear beneath that and can be selected by clicking on the tabs.

For example, imagine a page that someone might write about their cat. The top half is a photo of the cat and some text. At the moment, it's static, but I might later add a Twitter feed. Under it are tabs labelled "Poem", "Photo", and "Blog". The bottom half that gets selected when the user clicks on "Poem" is a poem, static HTML. That which gets selected when clicking on "Photos" is also static HTML, another image. And that which gets selected when clicking on "Blog" is dynamic: a blogroll implemented as a View.

Just to make sure that’s unambiguous, there are pictures of the top half and the three bottom halves at http: //www.j-paine.org/dobbs/kitty_page_top_264.gif, http: //www.j-paine.org/dobbs/kitty_page_poem_257.gif, http: //www.j-paine.org/dobbs/kitty_page_photo_296.gif, and http: //www.j-paine.org/dobbs/kitty_page_blog_279.gif. Apologies for the deformed HTML, but this thing only lets me post two links.

I’ve found quite a lot of methods that on first sight, may do what I want. These include the modules Quick Tabs and Node Tab, as well as the trick with views menus that Ron Golan describes in "Views Menu Tabs Quick Guide" (see https://www.urbaninsight.com/2013/11/01/views-menu-tabs-quick-guide). There are also assorted PHP code hacks. But I can't find recommendations about which solution is best for reliability and maintainability. It does appear that some of the techniques were written for older versions of Drupal, and may have been superseded.

One thing is that unskilled site administrators should easily be able to find all the content (tops, tabbed menus, and alternative bottoms). That might rule out of some of the modules: I can’t find the reference again, but at least one of them is said to implement its own special interface for keeping track of tabbed content rather than extending the standard Drupal interface.

This problem raised another question. How should I think about Drupal when working out how to do this? It’s well known that programming needs three key concepts, used both in describing control and describing data: sequencing, alternation, and repetition. If I were programming the problem in Pascal, I would represent the page as a record. The first field would represent the top half of my page; the second would represent the bottom halves. Because these require alternation, I’d represent them as a discriminated union. I’d also need some pragmatic information saying that the union is to be displayed using tabs and giving the tabs’ labels.

Now, it’s clear that some of the built-in Drupal menus implement that kind of alternation. I get the impression, actually, that they’re more important than the content itself, because users on various discussion groups have wondered why they couldn’t see their content, then been told by an expert that this was because it’s not attached to a menu. But I don’t think the Drupal documentation says this anywhere. A formal semantics of Drupal would be good, but I can’t find one. So when designing a structure like my page with one top and multiple bottoms, where should I start? What’s the equivalent of C.A.R. Hoare's famous essay "Notes on Data Structuring" that every computer scientist will know from the classic Structured Programming?


texts: Anonymous users can't use personal contact forms

texts:
I'm using the core Contact module, with personal contact forms on profile pages. I set both the permissions "Visit user profile" and "Use users' personal contact pages" for anonymous users, but I still just get a 403 when trying to view a user's contact page when logged out.

I am using Pathauto (and Subpathauto) for user profiles; I don't think that's the issue but it's worth mentioning.

Also, this is occurring on Drupal 7.


texts:
On D6.2 I'm using Garland. But instead of generating h1 tags for the title it is generating h2 tag.
What is the best way to make it generate h1 instead of h2?
Should I subtheme it and modify page.tpl.php?
Isn't there any settings or module which can do it?


texts: Fix problem in off-canvas menu module for Barrio Sub-theme

texts:
I need help with changing a Barrio(v 8.x-4.22) sub-theme of Drupal 8
 This is what I've done until now:

I installed the Barrio sub-theme
I installed the Responsive and off-canvas menu Drupal 8 module
I followed https://www.ostraining.com/blog/drupal/responsive-offcanvas-menu/

The menu appears at the bottom of the page
I don't know where the issue is and how to fix it.
I tried to enable the twig debugging (from here-> https://www.drupal.org/docs/8/theming/twig/debugging-twig-templates) and think that the problem is in the off-canvas menu settings, but I am unsure how to change them.


texts: Drupal Commerce: commerce-order:email is empty in checkout completion rule

texts:
I'm new to Drupal Commerce and I'm developing a site with anonymous checkout.

It seems that when the "Send an order notification e-mail" rule kicks in (checkout completion rules) the commerce-order:mail is empty and the email is not sent.

I have already disabled "Create a new account for an anonymous order" and "Assign an anonymous order to a pre-existing user" rules and a breakpoint on rules_action_mail() function proves that $to (mail recipient) variable is empty.

I'm using paymill and a custom shipping method module.

Any ideas?
Thanks in advance.


texts: Change role of users after deleting referred content via rules

texts:
I added an entity reference field to user referring to a type book.

I also created a rule that each time e user update that field, selecting one book, his role changes from authenticated to reader.
So let's suppose there's a book and five users pointing to that book. These five users are readers. What i would like to do is that when that book is deleted, those 5 users role change into authenticated, being no more readers.

What i need is a way to reach the referencing users when deleting a book.
I think adding multiple reference field from book to users could be kinda dirty, because there's already a connection between book and reader.

I've already created a rule that when a user change his book field, selecting no book, his role reader is revoked. I hoped that in this way, considering that when i delete a book all the users referencing to that book change automatically their referencies, their role can change too, but unfortunately it seems that this is not considered a "After updating an existing user account" condition.

How could i do that possibly using rules? If it is possible, but not via rules, can you explain me in details how can i do?


texts: "Simple FB Connect" module return page not found when user path replace with another module called "Rename Admin Paths"

texts:
Hi I am using "Rename Admin Paths" module for replace "user" path to "account" & working good. But today when I am trying to integrate "Simple FB Connect" module with my drupal 7 site, it return Page Not Found - when try to navigate domain.com/account/simple-fb-connect. But when i try domain.com/user/simple-fb-connect after disable rename_admin_paths module, its working, i can connect with facebook.

I am trying to replace all 'user/simple-fb-connect....' path to 'account/simple-fb-connect....' into simple_fb_connect modules files, but no luck!

Can anyone help me please... how can i configure simple_fb_connect with rename_admin_paths module.

Thanks.


texts: How to add users in organic groups using services Rest api?

texts:
I'm having problem while adding users in organic group. Here I'm trying to add user in organic group called "Supervisor", I'm using following json and Rest api :

Json :
{ "title":"Supervisor",
  "type":"group",
  "og_group_ref": { "und": [{ "target_id": "1921" }]},
  "field_records": { "und": [{ "value": "5" }]}
}

Rest api :
http://localhost/dev/test/node/1921

but, above json and api is not working, am I using correct json and rest api ?


texts: X-Drupal-Cache header not always appearing on page

texts:
I have a site which uses Drupal core anonymous caching.  However, I have noticed a very strange behavior. Sometimes I will load the home page and in the response headers will be the 'X-Drupal-Cache' header.  But if I reload the page again, the 'X-Drupal-Cache' header disappears.  I cannot understand how this could happen.

What might be the cause?

The response headers also containL Cache-Control:no-cache, must-revalidate, post-check=0, pre-check=0, which I understand will force the browser not to use a cached version of the page.

Strange thing is that if I access the same page using curl (e.g. curl -I http://example.com/), the X-Drupal-Cache header appears each and every time.


texts: Using variable_set with associative array

texts:
I use checkboxes in a form to capture a users selection as:

$form['mbo_block_config']['livembo_classes_details'] = array(
                '#type' => 'checkboxes',
                '#title' => t('Class Details'),
                '#description' => t('Choose class details to display.'),
                '#options' => $details,
                '#default_value' => variable_get('livembo_classes_details', array('c_id','c_cd_name')),
                '#required' => TRUE,
                );

The available options are stored in $details which is an associative array:

$details = array(
          'c_id' => t('Class ID'),
          'c_cd_name' => t('Class Name'),
          'c_cd_description' => t('Class Description'),
          'c_l_name' => t('Location: Name'),
          'c_l_city' => t('Location: City'),
          'c_l_full' => t('Location: Full Address'),
          'c_l_phone' => t('Location: Contact Number'),
          'c_s_FullName' => t('Staff: Name'),
          'c_start ' => t('Class Start Time'),
          'c_end' => t('Class End Time')
          );

I use variable set variable_set('livembo_classes_details', $edit['livembo_classes_details']); which works fine, however it flattens the array and changes the keys to values as per:

Array ( [0] => c_id [1] => c_l_phone [2] => c_l_name )

How can I retain the key/value format in the array as originally specified? For example:

Array ( [c_id] => t('Class ID') [c_l_phone] => t('Location: Contact Number') [c_l_name] => t('Location: Name') )


texts: How do I validate a number against a list of valid numbers?

texts: I want to validate a license number against a list of license numbers stored in vocabulary as taxonomy terms. The returned boolean value should then activate other form fields which are disabled by default.


texts: Disable all form elements when doing AJAX

texts: I have a form where every user input field is AJAX enabled, and I'd like to disable all of the form elements when one of them is changed - is it possible?


texts: how to see which user has assigned a content_profile content type?

texts:
I´m using the module
http://drupal.org/project/content_profile
for drupal 6

I want to make a view where I show all the users and a link to their content profile,
or even display some views from their profile..

Can´t seem to be able to do that, I don´t know where to pick the relation between the users and the content type

Currently my view is of the Usuer type..not Node..
I can handle PHP with customfield if I have to..don´t know where to start


texts: Add an additional custom submit handler to default search api Solr view filter?

texts:
I would like to run an additional submit handler every time a user searches a term with the default view filter provided by the search_api_solr module.

Here is my form altering code:

/**
 * Implements hook_form_FORM_ID_alter.
 */
function my_module_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if ($form['#id'] == 'views-exposed-form-solr-search-content-page-1') {
    $form['#submit'][] = 'my_module_handler';
  }
}

**
 * Custom submit handler.
 */
function my_module_handler(array $form, FormStateInterface $form_state) {
  drupal_set_message($form_state->getValue('keys'));
}

The problem is the that submit handler executes twice. It executes when the page loads (I think) and when the 'Search' button is clicked. Any ideas why this would be?

(I am trying to write all the terms searched by users (strings) to a database table.)

Thanks.


texts: Disable cache a custom block for anonymous user

texts:
I have a custom block, it displays in every pages with dynamic data calculates in every refresh, How can I disable cache for this block for anonymous users?

I try with:

public function build() {
  return [
    '#markup' => time(),
    '#cache' => [
      'max-age' => 0,
    ],
  ];
}

It won't work.

Edit:
I don't want to disable the cache for the entire page, I just need a specific block not to be cache.


texts:
Migrating D7 to D7 in 2 subdirectories:

/public_html/siteold/ with db=dbold
/public_html/sitenew/ with db=dbnew

I am using the UI of migrate_d2d. In a first run, I migrated users, files and content type "news". "news" content was migrated tot content type "article" with the same properties

All seemed to work well, but results were incomplete

The new uid did not match the old one
Images were not transferred

I tried to change the field settings, to no avail.

After two days of trying, I have no idea of the cause of the mismatch.

How can I fix this?


texts: Views conditional referenced field depending on user taxonomy term

texts:
I have a Content-type that an admin can assign it's nodes to other users, and users are separated by their taxonomy term.

I'm using Entity Reference field to reference the user and overriding the output of it using views to reduce the user list to my preference.

This is how user referencing works:

Each user has a taxonomy term (e.g. Editor, Moderator, BadAss,
UberSuperEditor, etc...)
Each term parents more than 100 of users.

I want the Admin to be able to filter the output of users based on their taxonomy before selecting and assigning the node to them.

I want to make a view and make a conditional relation based on the "Term" selected then show the related users of that term.


texts: How to print formatted contents of Computed Field in a custom template?

texts:
I am trying to edit a bit body of simplenews newsletter that's being sent.
I have a computed field that captures ~50 first words and saves it.
It is called : field_first_sentance and it's value is being saved in :

$entity->field_first_sentence['und'][0]['value'] .

In sites/all/modules/contrib/simplenews/simplenews-newsletter-body.tpl.php I added :

<?php print_r($entity->field_first_sentence['und'][0]['value']); ?>

I have tried with both echo and print and with l(strip_html(t($entity->field_first_sentence['und'][0]['value']))) and I've received same error.

But when I try to send a test newsletter I get this Error , which is basically saying that I can't have $entity in that file(simplenews-newsletter-body.tpl.php).

Is there a way to go around this and make it work ?

Thanks,
Michael!


texts: Access denied or 403 when loading image styles for private managed files

texts:
I have a custom entity that uploads files through the managed files setting and the private method. The upload works fine. However when I try to display the images in my templates or if I access them through the url generated by Drupal I get a 403 access denied.

So here is what I am doing:

/* @ demo_patient_weight.module */

/* First I get the current user */
$userCurrent = \Drupal::currentUser();
$userCurrentID = $userCurrent->id();

/* I load the data (list of ids) of my entity which is called demo_patient_weight */
$query = \Drupal::entityQuery('demo_patient_weight')->condition('user_id', $userCurrentID);
$entity_ids = $query->execute();

/* Loop through the ids and get the uploaded images */
$count = 0;
foreach($entity_ids as $entity_id) {
    $count++;
    $patient = entity_load('demo_patient_weight', $entity_id);
    // Get the file uri, weight_photo is the name of the field that uploads
    $file_uri = $patient->weight_photo->entity->getFileUri();
    $file_path = \Drupal\image\Entity\ImageStyle::load('medium')->buildUri($file_uri);
    // Assign the file path to a variable that twig can use in a <img /> tag
    $vars["page"]["patient_image"] = $file_path;
}

/* @ page--patient--weight.html.twig */
/* The code below gives me a 403 access denied for the image */
<img src="{{ page.patient_image }}" />

In the end I get a link like: /system/files/styles/medium/private/weight_photos/patient_0.png?itok=BAIbyx_X

And in my developer tools shows as 403 access denied. Any ideas?


texts: Is there an easy for my authenticated users to search other authenticated users?

texts:
I would like to allow my authenticated users the option to search through other authenticated users profiles (like when you allow people to change the filters on a view of content).

I've been searching through modules and documentation for a while now and can't seem to figure out how to solve this problem.

I was hoping that maybe their would be someway to create a view of users? Is that possible? If not, how can this be achieved?


texts: How to add and delete a user to another group using the Group module?

texts:
I am using Drupal 7 and the Group module. I would like to create  reaction rule or some code which automatically signs the user up to group 'blue', when they sign up to group 'red'.

I wouldn't mind using Rules or hard coding it. The only thing is that if the user leaves the first group, I want to be able to cancel their membership in the second group too.

What would be the easiest way? I have of course tried Rules without success and I cannot find a simple way to hard code it.


texts: Disable payment if Drupal Commerce Order Balance Total is <250

texts: I am trying to disable a payment option if the order balance total is over $250. I currently have the following, but it throws an error as there is nothing to drill down into after "order-total:"


texts: Let local drush call remote drush with `bash` or `sh`

texts:
I am trying to get database syncing with drush going. I installed drush on my webserver, but I only have the permission to run it with bash or sh before drush. (So with ./drush I get permission denied)

It seems that my local drush calls the remote drush without bash or sh, so I get permission denied when I try drush status for my @bla.remote.

Is there a way to tell drush to use these commands or can you think of another way to bypass this problem?

Could I write an alias somewhere into drush?


texts: Drupal 7: #autocomplete_path save id to hidden field

texts:
Basically I have the same problem as described here: How to make autocomplete return nid and name?.

I have a text input with ajax autocomplete:

$form['rmanager_id'] = array(
    "#title" => t("Manager"),
    '#type' => 'textfield',
    '#autocomplete_path' => 'members/managers',
    );

In /members/managers the function is invoked that returns {id => Name} pair. But when I select a name from the drop-down his id is inserted into the textfield. I would like to insert the name there and put the id into a hidden field.

@Clive who commented the previous question didn't give any code samples. I googled, but didn't find anything. Can somebody give a minimal working example to achieve this?


texts: theme_table drupal 7 issue - operator not supported for strings in theme.inc

texts:
Although i have found the fix of this problem, but i thought of sharing with others.

Problem is if you mention $rows & theme_table like following:

$row[] = array('data' => drupal_render($form[$key]['alt_name']), 'class' => 'alt-ing-name-td');

$output = theme_table(array('header' => $header, 'rows' => $rows,'attributes' => array('id' => 'recipe-id')));

then you will get following error:

Fatal error: [] operator not supported for strings in theme.inc


texts: User Profile Image not showing correctly

texts:
I want to show the profile and few content fields for a user profile. For this, I have used views module. Now the problem is that when I select imagecache preset to profile image(which I have defined as 150x200), the output is pathetic. It shows the profile images of around 63x63 size. I thought that the imagecache module might not be working. So I uninstalled and reinstalled the image and imagecache modules, but all in vain. Then I thought of checking into the imagecache folder whether the images are being resized, and to my amazement , the images inside sites/default/files/imagecache/profile_image/pictures/ folder were all of the dimension defined by me for profile image i.e 150x200 . So the problem seems to be only while these images are shown on the frontend.

Any idea about this?


texts: Module for cropping user picture immediately

texts:
I'd like users to be able to crop their user pictures immediately. That means:

After selecting the image file, it gets uploaded immediately (as opposed to waiting for the user to submit the entire profile edit form) and some kind of overlay, div, etc. appears that allows the cropping to be done.

As far as I can tell, a module does not exist that provides this functionality. If I'm wrong, please direct me to the module I'm looking for. If I'm right that it doesn't exist, what tips would you offer? Is there a module that will help get me part of the way, i.e. immediate upload, and then I can implement the rest (like just the cropping)?


texts: Custom module hook entity presave not 'firing'

texts:
I've seen other posts and did all the good things, I think... still not firing.

I use Commerce Kickstart 2 in Drupal 7

I want my module to be called for the hook_entity_presave event.

I followed the docs to create my custom module: call it 'Update Description'
I put my new mod in sites/all/modules/update_description

update_description.info
update_description.module

I named the files and added the appropriate info

name = Update Description
description = This module populates a description field based on the selected product attributes.
core = 7.x

I see, and enabled the module in the modules list, and I cleared cache

The module looks for a type of entity, and updates it:

function update_description_hook_entity_presave($entity, $type){
    $entity->changed = REQUEST_TIME;
    $vari_result = "";

    watchdog('update_description', 'type: ' . $entity->type, array(), WATCHDOG_DEBUG, NULL);

    if($entity->type == 'my_new_content_type' && $entity->product_id && $entity->revision_id) {
        // do stuff
        /// watchdog the results
    }
}

But I never see any log messages show up when I create or update an item of 'my_new_content_type', other than the default creation 'info' log message that happens anyway.

What do I need to do to get this my module to 'hook' into this call?


texts: Help with Drupal.behaviors and AJAX refresh

texts:
After a pause, I've been working on my Drupal 7 site again, and I have stumbled upon a minor problem regarding JavaScript and Ajax.

Thanks to this great website, I've learned of Drupal.behaviors, and I tried implementing my JavaScript code with it, so it shows up after an Ajax refresh within a view.

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

        var nmbr = 1;

        $(".moviescreenss",context).each(function () {

            var clrclass = "clr" + nmbr.toString();
            $(this).addClass(clrclass);
            addborder(clrclass);
            nmbr++;
        });

        function addborder(clrclass) {
            $("." + clrclass + " img").insetBorder({
            borderColor: get_random_color(),
            inset: 5
            });
        }

        function rand(min, max) {
            return parseInt(Math.random() * (max - min + 1), 10) + min;
        }

        function get_random_color() {
            var h = rand(40, 130);
            var s = rand(30, 75);
            var l = rand(40, 60);
            return 'hsl(' + h + ',' + s + '%,' + l + '%)';
        }
    }
};

})(jQuery);

I'm not that experienced with JavaScript, and I'm sure there are many possible improvements with the core code itself (e.g. the way functions are called).

What it does is add the jQuery inset border effect to every image link generated by the Views module, and color them with a random color within a specified range from reddish to green. (I somehow implemented this with a for-loop that adds a new "class+1" to each image, and the random HSL generator I found somewhere online.)

After adding the Drupal behaviors, the inset borders are still there after the AJAX action, but they are static and the hover effect is gone.

* UPDATE *
I have noticed this only happens afte clicking on a submit button. For example when using the VIEWS pager in ajax mode, the javascript applies fine

Any help would be greatly appreciated, as I'm certain it will help me understand JavaScript scripting better, besides new Drupal techniques


texts: Truncating text instead of wrapping in a view

texts:
I have a view that displays an image, title, star rating and user name of a custom content-type I have created in a grid. When  I have a very long title it messes up the layout of the view and makes it look bad as you can see in the below image:

Is there a way I can have long titles like the one below display with only one line and then truncate the rest with an ellipsis.  I.E. I would like the first content to have a title of "Very Long title for..." instead of "Very Long title for this project that will wrap to the next line".  This doesn't seem possible to do from the site builder, is there a module that might allow you to do this?


texts:
I'm using the revisioning module to handle the status of nodes. As far as the nodes go, they've been working perfect and the work flow is exactly what I want. However, I'm running into an issue when trying to construct a view.

What I'm able to do so far:

Create the view
Set the node type
Limit it to only nodes that have pending revisions

(I get the two nodes with pending revisions (an unpublished rev)

Get the nid of the node

Where I'm having issues:

I try to select the vid of the pending revision, but instead I get the vid of the currently published revision.

I'm not sure where to go. I've tried using "Type: Content" and "Type: Content revision" and get the exact same behavior. I've tried playing with Relationships and still get the same behavior, but I don't think a relationship touches what I need.

... This is incredibly irritating because I'm obviously getting the pending nodes that I want, I'm just not getting the vid for what's pending (which is what my filter uses to get those nodes in the first place) and instead getting it for what's published.

I can imagine there might be some headache because it's possible to have multiple pending revisions, in that case, I should see two lines for that one nid since nid and vid /should/ be unique.


texts: Rendering a Block Region in My Custom Theme

texts:
I am having my custom theme. In the theme.info i have a region latest defined

regions[latest] = Latest

How do i print that region in my theme? Is the below code correct?

<?php print render($latest);?>

I tried dragging the Recent Posts block to this, but nothing appears. What am i doing wrong?


texts: date_popup element not working when the form is rendered with ajax

texts:
How to attach javascripts to form rendered with ajax?

In particular, I have problem with popup calendars in my form. They are not showing, when my form is rendered with ajax.

I am rendering form with javascript as follows:

$.get('/event-form', {}, function(data) {
$('#event-popup-container').html(data);

This code calls ajax callback "/event-form". returned variable 'data' containes my form. This form is displayed on web page in HTML element $('#event-popup-container'). It works OK, just date_popup elements in form don't show popup calendars. Propably I  have to attach some javascripts somehow, when the form is not loaded with page load, but with ajax call. But I have no clue how.

I have such a code in my menu callback of path '/event-form':

<?php
  //...
  $event_form = drupal_get_form('ef_event__form', $event_id, NULL);
  $output .= drupal_render($event_form);
  drupal_json_output($output);
?>

Can anybody help, how to make work all needed javascripts, when the form is loaded with ajax?


texts: How to correctly invalidate a cached node when a menu link content is added/updated/deleted?

texts:
I'm currently facing an issue:

By following the contrib module's(menu_link_attributes) functionality, I altered the menu item's form to have a visibility by path option(almost the same as in the block config form).

I am saving the input data from the form in the menu_link_content's options column, then unsetting the menu item in hook_preprocess_HOOK() if the conditions are met.

The thing is, we have cached pages which are basically nodes(only on dev environment, the local one works as expected because caching is disabled) and the menu item is unset only after a CC.

I'm trying to add a cache tag to the node so that it's invalidated after I'm done with menu items.

/**
 * Implements hook_preprocess_HOOK().
 */
function prl_menu_item_visibility_preprocess_node(&$variables) {
  // Since all the pages are nodes and all of them are using footer menu, we add the menu_link_content cache tag and invalidate it
  // when a link is saved and supposed to be hidden on specific pages.
  $variables['#cache']['tags'][] = 'menu_link_content';
}

Unfortunately, no success.


texts: How to return a View's content in search results?

texts:
We have a page display of a view that contains two or more nodes, but when searching for a keyword that would pertain to those nodes, only links to the individual nodes are returned.  What we really want is just the link to the page display of the view to be returned, but it doesn't show up in the results list.

I'm looking into caching the View and index the cached content through a custom module, but i was wondering if anyone has come across this situation and can share their solution?

edited: made some clarifications.


texts: Is there a way to have a customized content add page form depending on who has logged in?

texts:
I have a website that operates through administrators. Obviously I have the ability to create content pages through drupal's dashboard, but is there a drupal included way (or module perhaps) that will allow me to limit what another logged in person could see? I know I can change permissions to what is accessible by different groups (i.e. users, partial admins, administrators, etc.). I want to be able to actually change what someone who isn't an admin will see. They shouldn't be able to see the drupal dashboard, for example, or certain sections of the "add/blocks" forms/create new content form.

If there is no option that comes defaul with drupal, firstly that is a huge undersight on drupals part, but is there another way to create this effect? One way I thought was to find drupal's core files that add the page (i.e. "node/add") and hardcode php permissions that check who the logged in user is. If they are admins, allow full priveleges, but if they are another group, then disable certain features of the page.

If this is the case, where can I find the files I'll need to edit? I'm having trouble doing so. It would be the actual form creation page that I'm looking for.

Thank you for any ideas and your time.