texts: Migrate D2D problems with files when databases on different servers

texts:
I am working on a complex Drupal 6 to Drupal 7 migration right now, and am leveraging Migrate and Migrate D2D.

Most of my content types have filefields on them.  I have my file and node migrations setup, and working nicely where the file migration is a dependency on my node migrations.

When my source and destination databases are running out of the same database server, then my migrations work.  When the source and destination databases are running out of different database servers, then my node migrations complain that there are unmet dependencies, even though drush ms shows that all of the file migrations ran (ie, no unprocessed items).

What causes this problem?  Is there a way to work around it?

In my instance, having both databases in the same server is a pretty suboptimal solution that I really would like to avoid.


texts:
I have created a custom module(a simple form) in drupal 7 using  https://www.drupal.org/node/717722 , i have successfully installed newly created module and able to save the form data. But i need an nid for this module which is being use by other module to perform series of tasks, i have been searching a lot about how can i found the nid of custom module ,but none of solution worked , also i have searched in the database table , other contents like webform , basic page and articles are there in database with there nid's but the newly created module's nid is not there ,can any one please help how can i find the nid of custom module and if there is no such nid then how can i set and nid for newly created module.

thanks in advance


texts:
I have a site where we want to send out information to "owners" of certain pages to tell the users how many page views the page got in the last month.

I think this could done 2 ways:

A module that keeps the a monthly count of page views. I have looked at Statistics Counter module but it seems to simple. It resets as soon as the new month starts. So if I wanted to send information for the last month it would lost as soons as the next month started.  Any other modules that keep this information for past months?  Or maybe I should just write a very simple module that would write the old month count to a history table before it gets reset.
Let Google analytics handle this. Either through custom code or a module query Google analytics with path, and date range.  Is there module does this already?

Other ideas on how to do this?

Thanks for any help on this


texts: Is it possible or/and how to restrict access to the block on th certain page using route name?

texts:
I am trying to restrict access to the block to be accessible only on the route:entity.user.canonical route.

Is it possible to define that on the block edit form?


texts: Running Drupal 6 with PHP 5.3 and Maintaining Security

texts:
I have a number of Drupal 6 sites that I can't upgrade at this time due to sheer lack of time to do so (it would be a major overhaul). Therefore, I am required to continue running PHP 5.3 on my server, but it is already EOL, and there are security fixes that have not been applied to it.

Are there other people here that are using Drupal 6 and PHP 5.3, while keeping their PHP secure? If so, how are they doing it? Is there a source for PHP 5.3 with backported security fixes, like an LTS version? I've seen Zend's version of that, but can't afford it. I saw Red Hat has RPMs with some security fixes backported into PHP 5.3, but not the most recent ones, at least as far as I can tell.


texts: Make multiple templates for site (new one for many pages)

texts:
So I have my page-front.tpl.php and page.tpl.php.  I'm making a music website for a client and literally only need like 5 or 6 pages.  How can I basically make a php page from scratch for each page?  Thank you.

P.S. I think I'd rather make it all from scratch than use panels


texts: hook_form_alter add field after submit button to exposed view

texts:
I'm trying to add a field that would be displayed after the submit button in the rendered HTML in my hook_form_alter.
e.g.
$form['include_card'] = [
  '#type' => 'checkbox',
  '#title' => t('Include gift card'),
  '#weight' => 25,
];

Weight doesn't seem to have any bearing on it.  How would you set that up?


texts: Is there a way to submit a form on an element's #ajax?

texts:
given a form like this:

function awesome_form() {

 $form['select'] = array(
     '#type' => 'select'
     '#options' => array(
        'hello' => t('Hello'),
        'good-bye' => t('Good Bye'),
     ),
     '#ajax' => array(
        'callback' => 'awesome_ajax',
        'progress' => FALSE,
     ),
 );

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

 return $form;

}

I want the ajax callback on the select box to fire a submission.
So for instance, when someone selects "Hello" the form submits and when someone selects "Good Bye" the form submits.
Right now (with the code above), awesome_ajax() fires like it's supposed to, but I can't seem to get the form to submit (save the data in the database).

Also, I would like it if there wasn't a visible submit button on the page (as the submit button is unnecessary).

How would I do this?

thanks!


texts: How do I cache a custom module that has points?

texts: I am making a site with users that have points. I have a custom module that calculates points for each user, but the page is slow when is calculating the points in real time, so what I want to do is making a cache the points so they don't need to be calculated anytime someone open the page. The page will be cached; if users want the status for their points, they can update them pressing the "Update" button. So I will write a function for that button to clear the cache.


texts:
I'm running drupal 7 with the secure login module and login toboggan. After installing it, going to http://site.com I see the usual site, with the login button.

The login form action has not changed, it remains a POST to /node?destination=node. Sure enough, if I login there my password is sent in the clear with a POST to http://site.com/node?destination=node

Any ideas on how I might start debugging this? The securelogin.module seems really straightforward, just some hooks. Is there a logging statement I can add there to see if these hooks are being called?

update I also noticed this other problem (probably the same cause).

Sometimes when I start a fresh browser and go to http://site.com I get 302's to https://site.com automatically. If I then log in the POST goes over https (good!) but I then get 302'd back to http://site.com, where I appear NOT logged in. If I just change the URL to https://site.com I can see that I am indeed logged in.

I am very confused.


texts: Create new node and assign it to user after they have been registered

texts:
I have one user role on d8 and have few additional fields on user account so when people are registering they can leave additional data. What I would like to achieve is that when user registers - new content of that specific type would be automatically created (node), assigned to him and the fields on that new content would be populated from those fields on user account which he filled during the registration process.
I was thinking that this is maybe achievable with the Rules but since couldn't find proper documentation for Rules in d8 not sure is this is doable that way.


texts:
I wanted to translate emails sent to users after signing up using different language than English. I know there is a way to translate the system emails from the account settings translate tab, so I added the translations as you can see in this picture.

This didn't work. Maybe this is not enough. I tested it (registering a new account using Arabic) and it is not working: The system emails are still sent in English.

Does Drupal send emails according to user's preferred language? If yes, how can Drupal send registration email in a language that is not English?


texts: Filter views by current user taxonomy profile field

texts:
Entity type: Book

I have entity type called "Book".
It has one field called "book_id".

Ex: science book(Book_name) -> 100(Bokk_id)
Maths -> 101
english -> 102

User:

I have user, he has one field attached with user profile called "book_name".
"Book_name" is a taxonomy reference field.

"Book_name" has one field called "book_id"

"Book_id" is free text field, it has more than one value by comma separator. Like 100,101,102.

Ex: user->book_name(taxonomy reference field)->book_id

Using views, I want to filter entity type "book" by current logged in user "book_name->book_id".


texts:
I need to add class="no-trans" to body, also edit the html tag.
How I can edit the {{ html_attributes }} and {{ body_attributes }} ?

my html.html.twig

<!DOCTYPE html>
<html{{ html_attributes }}>
  <head>
    <head-placeholder token="{{ placeholder_token|raw }}">
    <title>{{ head_title|safe_join(' | ') }}</title>
    <css-placeholder token="{{ placeholder_token|raw }}">
    <js-placeholder token="{{ placeholder_token|raw }}">
  </head>
  <body{{ body_attributes }}>


texts:
I am trying to merging content types while migrating to drupal 8 from drupal 7 and at the same time differentiating them with the taxonomy terms in D8.
E.g. The content types from D7 i.e. Article, Page, Blog will merge to a content types called "Media" in D8.
But in D8 "Media" content type, there will be a vocabulary "Type of content" with terms as Article, Page and Blog, so that while migrating from D7, the content of Article will be tagged to "Article" term in "Media" content type and same for others.

I am able to merge them to single content type in D8, by giving destination plugin for each content type as -

destination:
  plugin: 'entity:node'
  default_bundle: media

but not able to figure out how to tagged with "Type of content" vocabulary. This is additional field which is present in D8 but not in D7.

I tried to add

$row->setSourceProperty('field_type_of_content', $type_of_content);
$row->setDestinationProperty('field_type_of_content', $type_of_content);

code in hook_migrate_prepare_row() but not working...

Any suggestion. Thanks in Advance.

Regards
Sunil Singh


texts: In Drupal 7 with the Scald, is it possible to get the usage for a given atom, for example the nodes which are referencing it?


texts:
I'v got a question regarding dependencies & configuration. I created a module providing a content type, field type, widget & formatter.

While wanting to uninstall the module, I get the following message:

  The following reason prevents module from being uninstalled:

  Fields type(s) in use

So I go to structure, try to delete the content type & get the following:

  module's content type is used by x pieces of content on your site. You may not remove module's content type until you have removed all of the module's content type content.

I go delete all my nodes first as it seems this needs to be done first. I retry uninstalling the module & get message:

  Fields pending deletion

I run cron & am now able to uninstall my module with message:

  The following modules will be completely uninstalled from your site, and all data from these modules will be lost!

I can see that dependencies are met well, but this gives it a long run before one can uninstall a module.
Is there a way I can keep dependency integrity while once I am willing to uninstall the module to automatically remove configuration & content from start till end dependency?


texts: How to do field validation during migration?

texts:
I've a user migration class as shown here.

However for some reason users are created with empty required fields (such as e-mail).

How do I implement custom validation of the field during migration?

So I can fail the validation for specific row and continue the migration? So the specific rows won't be migrated and they will appear in the list of the one which has error in it.

Is there any method for that?


texts: How to display a specific page number of a views mini pager?

texts:
I'm displaying a view on a pager with a mini pager. It has total number 15 pages.

I want to display page number 5 by default. The the next link will point to page number 6 and the previous link will point to page number 4.

I have tried the below code.

function mymodule_views_pre_execute(&$view) {
  $view->query->pager->current_page = 5;
}

It just moves the page number in the page number, displaying it as page 5 of 15 but the views displaying the results of the page 1.

It it possible to set the default page number of a pager? How?
I'm using ajax in views.


texts: Programmatically Filter Node Access beyond permissions, views, etc

texts:
Short Version:

What would you say is the best way to filter how nodes appear (in a binary sense: published vs. hidden) to users based off of a dynamic value?  This solution is beyond the scope of typical modules like Permissions, Views, or Content Access.

Long Version:

My application calls for having select nodes display to select users based off of values changed over time. For instance, lets say a user wants access a node but both the users and the nodes change their location (daily).  When a customer views the site (or any page) I want them to only be able to see nodes in their specified range.  Because of this the basic Permission and Views and other stock Drupal modules seem to be ineffective.  It seems like it would be a bad way to use the Permission system because their are so many variables in the user / node relationship.  I can't unpublish nodes because they need to remain active to other users, processes, etc.  Even a dynamic Views filter with custom php code for my distance measurement would be ineffective because then nodes would still be accessible by directly inputting the URL.

Thus far, I am planning on using hook_node_load() to perform my calculations - determining the user and node relationship - and then only return nodes that are applicable.  This should prevent direct URL access to unavailable nodes, keep active nodes that exist but don't match the criteria, and by default control


texts: use drupal_add_js after external js scripts have already been loaded

texts:
I have a simple function to call on a specific page template.
I'm calling it using this

<?php
    drupal_add_js("
        jQuery('.row).equalize();
    ","inline");
?>

and it's using an included js library called equalize.js. Which is included like so

<script type="text/javascript" src="mysiteurl/js/equalize.min.js"></script>

I receive 'jQuery(...).equalize is not a function'. but I'm assuming that's because

<script type="text/javascript" src="mysiteurl/js/equalize.min.js"></script>

is being called after my inline js. This only needs to be called on one page. Is there a way to force it to run after the external js file is loaded? Or is there something else I'm missing?

Note: When I run the inline js after the page is loaded in the console in the inspector it works fine.


texts: Understanding Pantheon Workflows and Best Practices for Deployment to an Active Site

texts:
I've currently moved an active user site over to Pantheon. It's structured and themed extensively using Panels Everywhere, Panels, Views, and Display Suite.

What I would love to do now, is on the Dev/Test version is to revamp the site structure and display. But while that work is being done, every day new users are interacting with site changing its content, uploading files, etc...

From this previous post...

  Pantheon: pull code and config from dev, but preserve content in live?

I understand that the following is a best practice...

code should go from dev -> test -> live
database should go from live -> test -> dev

My question is in this scenario, how can I work on my site (ala Panels, Views, Display Suite) in a Development environment and then push those changes to the Live environment?

There seems to be no way to do this purely in Pantheon since a large majority of the site changes will be on the DB, and if I push that to the Live environment, it will override all the new and changed user content.

Can someone point me in the right direction on this? I seem to be chasing my own tail about how I should be going about this in a sustainable fashion.


texts: How to display related data along with node

texts:
I have a custom table that contains data related to certain nodes. I'm using EVA (Entity Views Attachment) to display some of this data along with the node, which works great.

However, I now want to display a single value from a related table when viewing a node.

I guess this could also be done using EVA, but creating a view to output a single value seems like the wrong approach(?)

In this case, the table does not contain entities. It is defined using hook_schema(), and made available to views with hook_views_data () in Drupal 7.

Thanks for any thoughts on the best way to proceed.


texts: what should I use as placeholder for a html img element?

texts:
To keep it simple I've left some out of my img field.
here's my code:

$markup = t("", $img_src);

I've tried format_string() but that also retuns:

<img src="path/to/image">


texts: Workbench sections - notify users in a section on state change

texts:
I want to, for example, use rules to notify all users in a particular section that an item of content in their section is 'awaiting moderation'.
Is there a way in Rules to get access to a node's Workbench section?

I can get access to the workbench access term id/menu id, depending on the scheme I'm using, but how can you find the users in that section from there...


texts: Is there a way to add JS to a page node Head tag directly from the page editor?

texts:
I am using Google Experiments for split testing and I need a different script for each page.

Adding a different script per page can be tedious if there is no way to add the script from the page editor.

JS Injector or Tracking Code, can only add JS to the Head of a page via a third settings page, where one needs to insert the URL of the page along with the code.

I don't want to create a rule for each page and then set one URL for each rule.

Is there a module that puts a textarea in the editor's page that will make this happen?

Something like Code Per Node but it doesn't allow the <script> tag to be inserted in the textarea field on the node page editor, which can't be used.

the JS code to insert for Google Experiments is:

<!-- Google Analytics Content Experiment code -->
<script>function utmx_section(){}function utmx(){}(function(){var
k='xxxxxxx-27',d=document,l=d.location,c=d.cookie;
if(l.search.indexOf('utm_expid='+k)>0)return;
function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.
indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c.
length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write(
'<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl':
'://www')+'.google-analytics.com/ga_exp.js?'+'utmxkey='+k+
'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date().
valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})();
</script><script>utmx('url','A/B');</script>
<!-- End of Google Analytics Content Experiment code -->


texts: Custom filter disabled after approximatively 45 minutes

texts:
I am developping a filter to render equations in nodes as images from LaTeX code using mathtex library ( http://www.forkosh.com/mathtex.html ).

The filter works quite well, my filter is active, the content is filtered, the node is cached using Boost and the HTML file is containing teh filtered HTML code.

BUT : after several minutes (arround 45 minutes) my filter is disabled (not visible in the input format adminpage, see below) despite that the module is still activated in the module page and the content is not filtered anymore.
BUT : when I desactivate/reactivate the modules, OR when I delete all caches, the filter is reactivated, the content is filtered again. And approximatively 45 minutes after it's not filtered anymore.

I try to do the same filter but using the Custom Filters module and I had the same behavior.

I supposed that the cron job had an influence, but content become not filtered BEFORE cron is executed (every hours).

Someone has an idea from where does the problem can come from ?

I'm running :
Drupal 7.23 using lots of modules : http://sites.uclouvain.be/selt/files/selt-modules.txt

Some captures to illustrate :

Content not filtered, as after approximately 45 minutes :

Content filtered, as after cache flushing or de/reactivation of module :

Administrative page for format "Full HTML" showing activated mathtex filter :

Administrative page for format "Full HTML" not showing filter :


texts:
I have the following set up. I vagrant machine with d8 site setup.
The files are common. I have replicated the DB in my laptop outside the host so I can run the behat tests faster. The DB is a dump of the one in the vagrant host.

Behat for host:

default:
  suites:
  default:
    contexts:
      - FeatureContext:
        - "/vagrant/images/behat"
        - 813
        - 1855
      - Drupal\DrupalExtension\Context\DrupalContext
      - Drupal\DrupalExtension\Context\MinkContext
      - Drupal\DrupalExtension\Context\MessageContext
      - Drupal\DrupalExtension\Context\DrushContext
  extensions:
    Behat\MinkExtension:
      selenium2: ~
      base_url: http://mysite.dev  # Replace with your site's URL
    Drupal\DrupalExtension:
      blackbox: ~
      api_driver: 'drupal'
      drush:
        alias: 'local'
      drupal:
        drupal_root: '/vagrant/drupal'

Behat for local:

default:
  suites:
    default:
      contexts:
        - FeatureContext:
          - "/vagrant/images/behat"
          - 813
          - 1855
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MessageContext
        - Drupal\DrupalExtension\Context\DrushContext
  extensions:
    Behat\MinkExtension:
      selenium2:
        browser: chrome
      base_url: http://mysite.dev  # Replace with your site's URL
    Drupal\DrupalExtension:
      blackbox: ~
      api_driver: 'drupal'
      drush:
        alias: 'local'
      drupal:
        drupal_root: '/home/user/Projects/myproject/vagrant/drupal'

When I run the following scenario on the vagrant I can log in while in my local machine it fails to log in.

 @node
 Scenario: Create a node
   Given I am logged in as a user with the "administrator" role
   When I am viewing an "article" content with the title "My article"
   Then I should see the heading "My article"

How can I resolve this?


texts: How move_upload_file calls to custom stream_wrappers class

texts:
In a node form, I upload a image to the server via ajax and before to send to the uri, I want to optimize the original image (not a image style).
How is possible that from move_upload_file that is a native php function calls to a custom class with hook_stream_wrappers
My uri:

gs://my-image.jpg

From here:
function drupal_move_uploaded_file($filename, $uri) {
  $result = @move_uploaded_file($filename, $uri); // this function calls to custom class
  // PHP's move_uploaded_file() does not properly support streams if safe_mode
  // or open_basedir are enabled so if the move failed, try finding a real path
  // and retry the move operation.
  if (!$result) {
    if ($realpath = drupal_realpath($uri)) {
      $result = move_uploaded_file($filename, $realpath);
    }
    else {
      $result = move_uploaded_file($filename, $uri);
    }
  }

  return $result;
}

Calls to:
<?php

/**
 * @file
 * Implements DrupalStreamWrapperInterface.
 */

class OSCaddieGCSStreamWrapper implements DrupalStreamWrapperInterface {
  ....
}


texts:
The site I'm working on at the moment has a competition that requires the following workflow:

User creates an account
User pays fee with PayPal (ideally a button)
User enters multi step/page form

I'm at a loss as how to best implement this:

The Webform Paypal module allows me to include a button but when I put it on the first page of my form it doesn't redirect me back to continuing the rest of the submission after payment.

The Payment for Webform module has too many steps:

First you have to click 'add payment' which opens a new window
Then you have to select a quantity
Then you have to select a payment method
Then you're taken off site

The Webform Paymethod Select module has the same issue as the first module except I get a 404 after completing a payment.

I'm wondering if payment should be part of the form at all? Is it possible to hide the webform until a successful payment has been received? I guess I'd have to write something custom for that.


texts:
I want to call a block on a page by AJAX. This is appearing in content and not in a block region.

[Use case: I have a View listing countries and their details; I want to add, at the top of the View, the user's country. I want the page to be cached, hence using AJAX to call back a View Block]

In the header of my view I have:

In hook_menu I have

$items['example/test'] = array(
    'title' => 'AJAX Delivery Test',
    'page callback' => 'show_example_block',
    'delivery callback' => '_basic_print',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );

I then have two functions:

function _basic_print($page_callback_result){
  print $page_callback_result;
}

function show_example_block(){
  if (isset($_COOKIE['country'])){
    return views_embed_view('example', 'example_block', $_COOKIE['country']);
  }
}

This works fine, but I'm wondering whether I'm missing anything. Is there a simpler, slightly more native way of doing this?


texts: Media module tokens vs. HTML in CKEDitor

texts:
I'm going to try my best describe the nightmare this has been, and hope there's a solution.

Using the media module, when you add an image, the text inserted looks like this:

[[{"fid":"64","view_mode":"file-wysiwyg","type":"media","attributes":{"height":"200","width":"400","class":"media-element file-default"},"link_text":null}]]

Makes sense, and seems extremely useful. You can specify the view mode, and you'll be able to adjust all images that are using "default" in the future by just updating that particular view mode.

We had problems with this though.

The entire view mode contains a lot more html than just an  tag. If you try to right or left align, it'll align the image... but the rest of the divs/etc. stretch out and effectively make it useless.
Our client wanted captions on pictures. My first thought (despite knowing how bad of a practice it is) was to just tell them to use tables; top row the image, second row the caption. The problem with that seemed to be that when rendered, it would pull the image out of the table.
We had all kinds of issues trying to resize the image, since it relied on the view mode; but, that makes sense and I could easily see limiting them to a set number of sizes.

1 wasn't terrible, and we might have looked for some kind of CSS solution (say, overriding any float:clear), but since caption wasn't an option, we went with the CKEditor image2 plugin. The problem was that as soon as you added a caption (it actually used the  and  structure for those), it would turn the whole thing into HTML instead of the media tokens. So, that above snippet would turn into:

Caption

This is where everything goes haywire from a user standpoint. The users have no clue what a view mode or media tokens are, and even if they did, there's no way to go back to the media token aside from removing and reading it. They don't understand the differences in behavior between media tokens and HTML, and it's not something to easily explain. But, it's also something that seems so basic that I'm hoping someone has a better solution for all this, because I can't find anything to fix this. Any solutions I can think of are stop gaps that kill off some other function; for instance, if there was any way for Media not to use tokens, it'd be easier for the users to understand, but then we'll have users manually resizing 3mb images to thumbnail sizes...

Naturally, this is also an issue with audio and video, but images is where the problem comes up the most.


texts: Clean URLs disabled even though module-rewrite is on

texts:
I have a manually installed LAMP environment on Ubuntu 15.10 Desktop and when I came to install Drupal 8 on it i've seen that clean URLs are disabled, so I turned on the Apache2 (2.4.12) rewrite module in the terminal via:

sudo a2enmod rewrite

Than I got:

Module rewrite already enabled

And yet when I cleared the browsers' cache and refreshed the installation page I still get:

  Clean URLs Disabled.

  Your server is capable of using clean URLs, but it is not enabled. Using clean URLs gives an improved user experience and is recommended.

So, if I turned on the rewrite module, why Drupal 8 still can't use them?


texts: How do I modify email headers when using Rules to send mail?

texts:
I'm using the Drupal 7 Rules module to trigger and send emails on specific events, but need to modify the email headers before the message is sent.

What would be the appropriate way to add 'reply-to' headers (as used in RFC 5322) to specific outgoing emails that are sent using the Drupal 7 Rules module?

The following works when using drupal_mail() but I do not see how to apply this hook when using Rules.

function hook_mail($key, &$message, $params) {
    switch ($key) {
        case 'key_name_here':
            $message['Reply-to'] = $params['mail'];
            $message['subject'] = $params['subject'];
            $message['body'] = $params['body'];
            $message['headers']['Reply-To'] = $params['mail'];
            break;
    }
}
// One note to the above script, lines 4 and 7 seem redundant and likely need work.


texts: Where should libraries be copied to sites/all or sites/all/modules?

texts:
I currently have it in both locations, but figure this is incorrect. The problem is, when I try to remove it from sites/all/modules the superfish module complains, and says that it's needed.

What am I doing wrong?


texts: Instead of creating a block for each view, I simply display the master views in the panels on my website. As that works perfectly until now, I'm wondering why one should create a view block. Do they have any advantages over master views? Is my way of acting risky in a sense?


texts: On the home page of a site I want to list each node as an individual slideshow. Each node shown will be of the same content type. I am using views slideshow and panels if it helps.


texts: programmatically change link URL in view

texts:
I have a view that shows all of a particular user's content (content the user has created on the site). This works fine, but I need to link the results (title field) to the pages where the content is displayed - not to the original node of the created content.

Since the content types may be different, I guess I need to set the URL's programmatically.

For example one content type is "projects" projects are displayed at site.com/projects/!arg

Another content type is "photos" photos are displayed at site.com/photos/!arg.

How do I write a conditional that will set the URL's correctly?


texts: Views to show nodes filtered by referenced user

texts:
I am really confused about this. Tried with the Entity reference view but can not get the result working for me. It should be very easy to do it.
I have a node called Book. Book has a field field_author that is referenced to USER.
I am trying to show the related books by the same referenced user.
Book 1:
Title: Book 1
field_author: user50 //id of this user is 50

Book 2:
Title: Book 2
field_author: user15

Book 3:
Title: Book 3
field_author: user50

Book 4:
Title: Book 4
field_author: user50

My view should display Book 3 and Book 4 when viewing Book 1 (URL:: example.com/node/1) and display Book 1 and Book 4 when viewing Book 3 (URL:: ecample.com/node/3) and so forth.


texts:
So for my project there will only ever be one payment method with is Credit Card by Sage Pay.

Essentially I want to remove the pane where you select a payment method and
set the payment method always as Sage Pay. I want to hide payment selection from the user.

This way after entering user details the user can go straight to the payment gateway redirection. How would I go about this?


texts:
I'm new to Drupal and its SQL API, and I am trying to update a row in a table I created.

// Admin form
function admin_Form($form, &$form_state) {
  $dbval = getVals();
  $form = array();

  $form['firstname'] = array(
    '#type' => 'textfield',
    '#title' => 'Fornavn',
    '#id' => 'fornavn',
    '#value' =>  $dbval['firstname'],
  );

  $form['lastname'] = array(
    '#type' => 'textfield',
    '#title' => 'Efternavn',
    '#id' => 'efternavn',
    '#value' =>  $dbval['lastname'],
  );

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

  return $form;
}

function admin_Form_submit($form, &$form_state) {
  $update_zoho = db_update('zoho')
    ->fields(array(
      'firstname' => $form_state['values']['firstname'],
      'lastname' => $form_state['values']['lastname'],
    ))
    ->condition('lastname', 'lastname', '=')
    ->execute();
}

Everything gets executed and the message gets displayed, but the row is not updated.

Can anyone point a newbie in the right direction?
These are the table structure and the values is contains.

    title, firstname, lastname,  city, ... lots of colums
    ------------------------------------------------------
          - Bolli    - lastname - KBH  ....
          -          -          -
          -          -          -
          -          -          -


texts: Superfish Menu - Submenus (Child Menus) first link is always ParentMenu link. How to remove this?

texts: In my superfish menus, sub-menus (child-menus) show parent menu link as 1st option. Always. How do I remove this? See the photo for example:


texts:
I have a content type foo, that has a media field and a body with text. I want to list the most resent foo on  whit a specific visualization: double column layout for a foo that has media which is previewed left and on the right is a summery of the body. If there is no media then simply show the summary of the body.

I can create a block bar in Views module, that list all the foo and show this block on .
I can create a Node template of type foo with Panels module that has the required layout but I don't know how to apply that on the list of foos in bar.

Do I need to use in Panels Node template?
My selection rule is: This panel will be selected if NOT (media is set to ""), and Current path is "front". (not working).


texts: hook_menu to change menu button item by checking group membership

texts:
I am using Organic Groups and I have used this post to override the roles and permissions of OG Groups.

I need a hook to alter a button on my main menu that changes depending on whether the user is a member of a group (has any role in that group) or isn't a member of a group (and therefore hasn't got a role associated with his username)

The default button that always shows is 'add' when a user is associated with a group that button needs to be changed to 'remove' - with the according URL

I have created the following using this Drupal page:

function my_module_menu() {

    $items['link'] = array(
        'title callback' => 'change_link',
        'title arguments' => array(1),
        'page callback' => 'go_to’,
        'page arguments' => array(1),
        'access callback' => 'user_is_logged_in',
        'menu_name' => 'main-menu',
        );

    return $items;
}
function change_link($gid) {
  if(og_is_member('node', $gid)) {
    return 'Remove';
  }
  else {
    return 'Add';
  }
}
function go_to($gid) {
  if(og_is_member('node', $gid)) {
    drupal_goto('www.mydomainurl.com/remove');
  }
  else {
    drupal_goto('www.mydomainurl.com/add');
  }
}

As well as fixing the above code - what does the array(1) do in page and title call back? --> I just copied them as is from the Drupal API page... (Does it look for the 'gid' in the last 2 functions?

UPDATE: (if any user of the site are part of any group - regardless of role -  they will see only the 'remove' button if they aren't part of any group they will see the 'add' button.)


texts: Views - user/role has access to edit node

texts: I'm trying to set a view that shows only the nodes that current user or role has access to edit. I've tried with contextual filters and relationships but with no luck. Anyone know how to restrict it?


texts: Aggregating JavaScript generates errors and breaks JS functionality

texts:
My website is working well but I was required to aggregate CSS/JS by enabling the system.performance.js.preprocess config key.
Once the JS code is within one single file I got some errors that doesn't show up when JavaScript is not aggregated:

Uncaught TypeError: Cannot read property 'bindAjaxLinks' of undefined
    at HTMLDocument.<anonymous> (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:579)
    at HTMLDocument.dispatch (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:3)
    at HTMLDocument.q.handle (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:3)
    at Object.trigger (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:4)
    at HTMLDocument.<anonymous> (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:4)
    at Function.each (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:2)
    at r.fn.init.each (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:2)
    at r.fn.init.trigger (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:4)
    at initContextual (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:500)
    at js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:532
Uncaught TypeError: $autocomplete.autocomplete is not a function
    at Object.attach (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:899)
    at js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:174
    at Array.forEach (<anonymous>)
    at Object.Drupal.attachBehaviors (js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:171)
    at js_gQksidT9DzO4kWsJTVsAaOllA_i35znbvgoaoo5Ut8c.js:356
    at HTMLDocument.t (js_BKcMdIbOMdbTdLn9dkUq3KCJfIKKo2SvKoQ1AnB8D-g.js:4)

This breaks the entire JS functionality of my site like drop-down menus and slideshows.

I'm using a custom theme based on Acquia's Cog. My theme looks like this:

name: 'My Theme'
type: theme
description: 'Custom Cog subtheme for my website.'
core: 8.x
base theme: cog
libraries:
  - mytheme/fonts
  - mytheme/fontawesome
  - mytheme/global_styles
  - mytheme/slick
regions:
...

And my theme's libraries file:

global_styles:
  css:
    theme:
      css/styles.css: {}
  js:
    js/dist/scripts.js: {}

The js/dist/scripts.js file is a JS file built with npm and gulp.

I have read in other answers this may be caused of undeclared dependencies since the undefined variables could be loading before the Drupal ones. I tried to split it into another library and set dependencies like this:

global_scripts:
  js:
    js/dist/scripts.js: {}
  dependencies:
    - core/drupal
    - core/drupalSettings
    - core/jquery
    - core/jquery.once

But there's no effect at all. Any hints on how to solve this?


texts: Why is search disabled by default for anonymous users?

texts:
I noticed that search is only permitted to logged in users on drupal.org and I'm wondering why. Apparently it's also disabled for anonymous by default in Drupal 7, and I see people discussing how to enable it to anonymous users, but no-one explains why this default setting exists.

I assume there's a performance issue or opening for a DOS attack?

I'm particularly interested at the moment because we're currently having DB issues (overloading the max permitted connections) and we have D7 with search enabled for anonymous users.


texts: Migrating (import) rest/api (json) data into node using migrate_plus and migrate_tools modules

texts:
I’m trying to migrate some data from a remote rest/api (json) using the plugin source url. Here is my current migration iml file. I created a content type 'produkt' to match the fields from the remote data.
I also enabled the migrate_plus and migrate_tools

# Migration configuration for products.
id: product
label: 'Product'
migration_group: Products
# Here we define the migration source
source:
  plugin: url
  track_changes: true
  cache_counts: true
  data_fetcher_plugin: http
  data_parser_plugin: json
  urls: 'https://base_url/endpoint’
  item_selector: data/
  fields:
    -
      name: uuid
      label: 'uuid'
      selector: uuid

    -
     name: title
     label: 'title'
     selector: name

  ids:
    uuid:
      type: string

  authentication:
    plugin: oauth2
    grant_type: client_credentials
    base_uri: ‘base_url’
    token_url: '/oauth/token/'
    client_id: my_id
    client_secret: ‘my_client_secret’
  headers:
    Accept: 'application/json'
    Content-Type: 'application/json'

  destination:
    plugin: 'entity:node'

  process:
    type:
      plugin: default_value
      default_value: produkt

    title: name
    field_uuid: uuid

    sticky:
      plugin: default_value
      default_value: 0
    uid:
      plugin: default_value
      default_value: 0

  migration_dependencies:
    required: {}
    optional: {}

  dependencies:
    enforced:
      module:
        - migrate_products

Running the command
drush ms
provides the following error:

‘Class 'Sainsburys\Guzzle\Oauth2\GrantType\ClientCredentials' not found in /usr/share/nginx/html/modules/contrib/migrate_plus/src/Plugin/migrate_plus/authentication/OAuth2.php’

Could some one help me try to understand what is happening or how I can handle this issue?

Thank you in advance

Update:
I stopped trying to import from from the a http data_fetcher and switched to the file data_fetcher. My migration yml file looks now like this.

# Migration configuration for products.
id: product
label: 'Product'
migration_group: Products
# Here we define the migration source
source:
  plugin: url
  track_changes: true
  cache_counts: true
  data_fetcher_plugin: file
  data_parser_plugin: json
  include_raw_data: true
  urls: /sites/web/files/data/data.json
  item_selector: data
  fields:
    -
      name: uuid
      label: 'uuid'
      selector: uuid

    -
     name: title
     label: 'title'
     selector: name

  ids:
    uuid:
      type: string

  destination:
    plugin: entity:node

  process:
    type:
      plugin: default_value
      bundle: produkt

    title: name
    field_uuid: uuid

    sticky:
      plugin: default_value
      default_value: 0
    uid:
      plugin: default_value
      default_value: 0

  migration_dependencies:
    required: {}
    optional: {}

  dependencies:
    enforced:
      module:
        - migrate_products

After runing the drush drush ms, I got following ouput

file parser plugin: could not retrieve data from /sites/web/files/data/data.json
 Group: Products (Products)  Status  Total  Imported  Unprocessed  Last imported
 product                     Idle    n. v.  0         n. v.

Could someone please help understand what is wrong with my migration file?

btw, that's how my json file looks like:

{
  "data": {
    "uuid": {
      "value": "ed64784-cjjhd6",
      "patient": false
    },
    "name": {
      "value": "Name",
      "patient": false
    },

How to specify the value of the uuid as ids?
Thank you in advance

Sincerely


texts: Commerce Kickstart: How do I fix a SQL error on string length after using Features Override to save customizations?

texts:
After reading the update instructions on Commerce Kickstart (Installing & Upgrading), I attempted to use the Features Override module to save my customizations/configuration prior to updating to the most current version of Commerce Kickstart. I have changed menus, user profiles, etc. and would like to keep those updates intact.

I followed the instructions posted on the project and generated a "Feature.tar" file.

Attempt #1:

Selected all items shown in Features Override dropdown (179 items)
Downloaded the file
Enabled the new feature through "Modules" UI
Received this set of error msgs [truncated for demo purposes]:

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'info' at row 1: INSERT INTO {system} (filename, name, type, owner, info) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => sites/all/modules/features_override_0916/features_override_0916.module [:db_insert_placeholder_1] => features_override_0916 [:db_insert_placeholder_2] => module [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => a:12:{s:4:"name";s:25:"Features Override 09-2016";s:4:"core";s:3:"7.x";s:7:"package";s:8:"Features";s:12:"dependencies";a:2:{i:0;s:18:"commerce_kickstart";i:1;s:4:"node";}s:8:"features";a:2:{s:12:"features_api";a:1:{i:0;s:5:"api:2";}s:23:"features_override_items";a:153:{i:0;s:61:"facetapi.search_api@product_display:block:field_blog_category";i:1;s:58:"facetapi.search_api@product_display:block:field_brake_type";i:2;s:56:"facetapi.search_api@product_display:block:field_hub_type";i:3;s:64:"facetapi.search_api@product_display:block:field_intended_use_alt";i:4;s:59:"facetapi.search_api@product_display:block:field_primary_use";i:5;s:85:"facetapi.search_api@product_display:block:field_product:commerce_price:amount_decimal";i:6;s:71:"facetapi.search_api@product_display:block:field_product:field_axle_size";i:7;s:71:"facetapi.search_api@product_display:block:field_product:field_build_kit";i:8;s:67:"facetapi.search_api@product_display:block:field_product:field_color";i:9;s:72:"facetapi.search_api@product_display:block:field_product:field_frame_size";i:10;s:86:"facetapi.search_api@product_display:block:field_product:field_product_specific_options";i:11;s:73:"facetapi.search_api@product_display:block:field_product:field_wheel_sizes";i:12;s:64:"facetapi.search_api@product_display:block:field_topic_related_to";i:13;s:25:"field_base.commerce_price";i:14;s:30:"field_base.field_blog_category";i:15;s:23:"field_base.field_images";i:16;s:54:"field_instance.commerce_product-product-

Attempt #2

Same as above
Generated the file & saved it directly to the server under "Advanced Options"
On refresh, received same error msg as above.

I watched an Acquia tutorial on Features that seemed to show the creation of "Features" as something very straightforward, but I can't seem to get through the process.

It looks like I have a string length issue. Where do I set the max length of a column input? (System >> Info).

Any tips? Any tutorials or videos that you recommend?


texts: Are there any ways to speed up a complicated webform?

texts:
I'm sorry for probably stupid question.

But there is a problem we discussed with the client.

There is a complicated webform with about 180 components (including a lot of formula fields). (the tab node/*/webform)

Beside that, the webform contains about 30 conditionals.(the tab node/*/webform/conditionals)

Also the site owner can periodically change these formulas.

Some users can complain that the webform works a little slow.

Are there ways to speed up the webform without change it to a custom form + AJAX ?

Or, maybe, the simplest way is to upgrade hosting to more powerful one and with more powerful channel ?


texts: Multiple blogs per user, each with a blog profile page

texts:
I'm trying to to create a site where users upon admin approval, can have multiple blogs, typically differentiated by language.

Each blog should have a profile/landing page specific to that blog.

I can simply create a taxonomy term where a given term is a given blog name and I can use the Taxonomy Permissions module to restrict a given term to a given user.

The part that I'm having trouble thinking through is the admin side setup so that someone who doesn't know a lot about Drupal would be able to simply set up a new blog.


texts: How can I add superscript character in a textfield

texts:
I am looking for a way to use superscript characters in a Drupal textfield. When I copy and paste from a Word document, Drupal changes it to plain text.

Expected Result: m2

Actual Result: m2

What’s the correct way to use the superscript in fields? How can I enable special character support?


texts: What do I add to template.php so I can render regions in a page created in hook_menu()?

texts:
I need to recreate a lot of pages after removing Panels from a site.

In order to print regions in node tpls, I added this to theme_preprocess_node. That's fine but it doesn't work for custom pages.

// Get a list of all the regions for this theme
  foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {

    // Get the content for each region and add it to the $region variable
    if ($blocks = block_get_blocks_by_region($region_key)) {
      $variables['region'][$region_key] = $blocks;
    }
    else {
      $variables['region'][$region_key] = array();
    }
  }

I tried adding that to theme_preprocess_page but it doesn't do anything.

Here is my module. The divs print fine but the regions don't get printed.

function custom_pages_menu() {

    $items['classes-admin/%'] = array(
        'title' => t('Classes'),
        'page callback' => 'page_sidebars',
        'access arguments' => array('edit field_diary_date'),
    );
    return $items;
}

function page_sidebars() {
    $page_return = "";
    $page_return .= '

';
    $page_return .=                     render($region['sidebar_left']); // or $page
    $page_return .=             '

';
    $page_return .=                     render($region['sidebar_right']); // or $page
    $page_return .=                 '

';

    return $page_return;
}

This seems like a pretty common thing to do but google isn't giving me anything to work with. I don't want to add them to page.tpl because it's a very complex site and I only want it this way, if possible. Any help appreciated.


texts: How can I lock a user profile field after registration?

texts:
I have a custom field on my user's profiles; I would like it is filled out at registration, but then not changed on post-registration.

How can I achieve this?


texts:
I am trying to comprehend the data flow in a module.
The page is rendered with

template_preprocess_foo(&vars);

Can someone explain how to detect where the vars variable is initialized and in general to the overview of the data flow.


texts: How to get the field settings in drupal 7

texts:
Here is the scenario.

I have a taxonomy term reference field, which is referenced to a taxonomy vocabulary, for example it is associated with category vocabulary. Now I need to fetch the vid of the category vocabulary which is associated to that particular field.

or is there a way to fetch the field settings in drupal 7?


texts:
I have written a block, displayed on the right sidebar of my drupal 8 site. It reads the database, and shows today's reports. But the block's output is aggressively cached, so that it never shows the up-to-date details. The block's code is being called, and returns the correct data, but this is ignored. (Pages created by controller classes do similar work, but are not cached. What's the difference?).

After reading many help pages, I'm frustrated; I can't get the block to show up-to-date details. The solution seems to involve setting '#cache' on the render array returned, but I can't see how.

Help please!


texts:
I'm in the process of migrating a fairly large old site that has been migrated from Drupal 6 to Drupal 7, and now to Drupal 8.
There are a few issues about getting this done, but I have a grip on most of it. (I'm tossing a lot of functionality; in some cases the migrations are failing, but that's mostly okay.)
The BIG problem I have is that I cannot for the life of me get the file migrations to work. The Drupal 7 site has both public and private files. I shall leave the private files for the time being. I cannot even get the public files to move over. My first stab was at moving them through http:// so I have set the source to https://wis.community, but the Drupal 8 site never seems to touch the Drupal 7 website, and just fails on every file with an error message similar to the following one.

'/sites/default/files/images/151659850_3902971153115469_2314013813948011350_o.png' does not exist

The other website never gets hit. I've also tried changing the configuration by editing the d7_file.yml file and re-importing it, but that constantly fails the same way. It appears that, no matter HOW I try to set up the file migration, it doesn't work.
I'm obviously missing something basic here but I don't get it.
The migrate_plus.migration.upgrade_d7_file.yml config file looks like this.
uuid: da623100-323b-473f-9a67-5d6776cf586b
langcode: en
status: true
dependencies: {  }
id: upgrade_d7_file
class: Drupal\migrate\Plugin\Migration
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - 'Drupal 7'
  - Content
migration_group: migrate_drupal_7
label: 'Public files'
source:
  plugin: d7_file
  scheme: public
  constants:
    source_base_path: 'https://wis.community/'
process:
  fid:
    -
      plugin: get
      source: fid
  filename:
    -
      plugin: get
      source: filename
  source_full_path:
    -
      plugin: concat
      delimiter: /
      source:
        - constants/source_base_path
        - filepath
    -
      plugin: urlencode
  uri:
    -
      plugin: file_copy
      source:
        - '@source_full_path'
        - uri
  filemime:
    -
      plugin: get
      source: filemime
  status:
    -
      plugin: get
      source: status
  created:
    -
      plugin: get
      source: timestamp
  changed:
    -
      plugin: get
      source: timestamp
  uid:
    -
      plugin: get
      source: uid
  field_metatag:
    -
      plugin: d7_metatag_entities
      source: pseudo_metatag_entities
destination:
  plugin: 'entity:file'
migration_dependencies:
  required: {  }
  optional: {  }

How can I resolve this issue?


texts: How to disallow commerce checkout if no payment method is available?

texts:
With Drupal Commerce and Commerce Payment, when no payment method is available on the checkout, it displays this message: Payment is not required to complete your order. and the customer is still able to finish the checkout.

It's probably trivial, but I can't find a solution that doesn't involve calling a hook in a custom module.

The best solution would to actually display a webform when no payment method is available.


texts: Print Entity Reference Value from Entity Meta Wrapper

texts:
I have this code to get entity meta wrapper and print text fields. But I can't see how to print entity reference values.

$wrapper = entity_metadata_wrapper('my_entity', $entity);
print $wrapper->field_my_field->value();


texts:
How do I make a view block with picture of the currently logged-in user?
I am using Drupal 8.


texts:
I tried following the instructions from DockSal Boilerplate Tutorial and from Acquia BLT DockSal but still fails
Creating boilerplate-drupal8-blt_db_1  ... error
Creating boilerplate-drupal8-blt_cli_1 ...

ERROR: for boilerplate-drupal8-blt_db_1  Cannot start service db: error while mounting volume '/var/lib/docker/volumes/boilerplate-drupal8-blt_project_root/_data': failed to mount local volume: mount :/Users/brandonsmac/sites/docSal/starter-project/boilerplate-drupal8-blt:/var/lib/docker/volumes/boilerplate-drupal8-blt_project_root/_data, flags: 0xc00, data: addr=192.168.64.1Creating boilerplate-drupal8-blt_cli_1 ... error

ERROR: for boilerplate-drupal8-blt_cli_1  Cannot start service cli: error while mounting volume '/var/lib/docker/volumes/boilerplate-drupal8-blt_project_root/_data': failed to mount local volume: mount :/Users/brandonsmac/sites/docSal/starter-project/boilerplate-drupal8-blt:/var/lib/docker/volumes/boilerplate-drupal8-blt_project_root/_data, flags: 0xc00, data: addr=192.168.64.1,vers=3,nolock,noacl,nocto,actimeo=1: no route to host

ERROR: for db  Cannot start service db: error while mounting volume '/var/lib/docker/volumes/boilerplate-drupal8-blt_project_root/_data': failed to mount local volume: mount :/Users/brandonsmac/sites/docSal/starter-project/boilerplate-drupal8-blt:/var/lib/docker/volumes/boilerplate-drupal8-blt_project_root/_data, flags: 0xc00, data: addr=192.168.64.1,vers=3,nolock,noacl,nocto,actimeo=1: no route to host

ERROR: for cli  Cannot start service cli: error while mounting volume '/var/lib/docker/volumes/boilerplate-drupal8-blt_project_root/_data': failed to mount local volume: mount :/Users/brandonsmac/sites/docSal/starter-project/boilerplate-drupal8-blt:/var/lib/docker/volumes/boilerplate-drupal8-blt_project_root/_data, flags: 0xc00, data: addr=192.168.64.1,vers=3,nolock,noacl,nocto,actimeo=1: no route to host
ERROR: Encountered errors while bringing up the project.

This question was originally posted in StackOverflow


texts: Include Full Taxonomy Term inside a Content Type?

texts:
I'm working on a project where we want to pull in the title, description, and an image from selected taxonomy terms and include them in content of a predetermined content type. The content type is already displaying the Term with a link, but I want to display the description and an image along with it.

While I am sure this is possible, I'm not sure what the best method would be to accomplish this. I'd rather not hard-code it into a content-type template.


texts: Media library: don't include profile pics or remove from library without deleting

texts:
Our site allows users to create a profile avatar. We are also using the media module, version 2.19, which includes a media library. The library is useful, however, all of our users' profile images populate the media library, which is tens of thousands of images. I don't want our users to be able to select these and other images from the media library when writing their blogs.

Is there a way to exclude these from getting added or is there a way to remove images from the library without deleting the image altogether?


texts: Why isn't this functionality in submitForm firing?

texts:
I'm in the process of writing a module. The module works very well. In the module, I generate a form which consists of one submit button, and in the .module file, I'm calling that form and the submitForm works too. I was asked to move that button into a block, so I did. submitForm still works, but the main functionality doesn't. How come?

<?php

namespace Drupal\my_module\Form;

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

/**
* Generate button.
*/
class myModuleForm extends FormBase {

  /**
  * {@inheritdoc}.
  */
  public function getFormId() {
    return 'my_module_form';
  }

  /**
  * {@inheritdoc}.
  */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['my_module_btn'] = [
      '#type' => 'submit',
      '#value' => 'Do something'        ];
    return $form;
  }

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

  /**
  * {@inheritdoc}.
  */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $mpdf = new \Mpdf\Mpdf(['tempDir' => 'sites/default/files/tmp', 'default_font' => 'roboto', 'margin_left' => 6, 'margin_top' => 6, 'margin_right' => 6, 'margin_bottom' => 11]);
    ...
    ...
    ...
    $mpdf->Output($title."-".date("Ymd-His").".pdf", 'D');
  }
}


texts:
Firstly I'm extreamly new to drupal and right now I was given a task to edit a currently online published website. The old designer didn't left me with any idea but from what I was told, the website uses Drupal to operate. I'm more to the classical way of building a website, for example: I create the scripts and upload it to a server and the server published it online. So how do I acess the website's database to make all the necessary changes to the scripts?

Thanks in advance.


texts: Send mail using drupal_mail to cc and bcc

texts:
I want to send mails using drupal_mail function but somehow it is sending mail only to To and that to without message body. Below is the code which I am using.

$params = array(
'body' => 'plain text mail',
'subject' => 'Join this Event',
);

if(drupal_mail('join_this_event', 'some_mail_key', "ansari@infiniti-research.com", language_default(), $params, "noreply@test.com", TRUE)){
  echo "mail sent";
 }
 else echo "unable to send";

Below is the hook_mail function of the module

function join_this_event_mail($key,&$message,$params) {
$language = $message['language'];
switch ($key) {
    case 'send_link':
        $message['subject']=t($params['subject'], $var, $language->language);
        $message['body']=$params['body'];
        $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
        $message['headers'] += $params['headers'];
    break;
}

}

How can this be resolved? and why is this happening


texts: How to create an entity-reference field programmatically?

texts:
I'd like to know how to create an entity-reference field programmatically, and where should I put this script.
Could I call field_create_instance() in hook_form_alter()?


texts:
In a content type I have a links fields using Link Module which has Title and URL set. This is useful to link the external files but I have a requirements also to link the files stored in Networked hard disk.

In an intranet system there is a drive eg: Z drive, which is same for all the systems in Intranet. The drive is actually an intranet server which stores all the doc files for everyone's use. When System Admins set-up new computers they set-up in such way that server drive is always Z drive in any computer (company preference).

I have a task to link to the file from Drupal site, lets say the file path is:
 z:\popular-documents\how-to-use-pc.docx

When I give the above file path to link field, it changes the whole Link completely like:
http://localhost/Z%3A%5Cpopular-documents%5Chow-to-use-pc.docx

How can I use Link Module to link to the file and display the file link as it is instead of having http:// which link module adds by default.

The reason I have to use Link Module is I also want to be able to link it to external files too, lets say Google docs.

Not a requirement but good to have, if possible when the link is clicked it would open the file (I guess this is not possible from web interface).


texts: Drupal 7: How to add tags to a new content type?

texts:
Newbie here!

I go to Structure > Content types > Add content type and create a new content type.

But how can I add tags to my new content type, just like when you go to Content > Add content > Article, you get the option to enter a title, tags and body.

How can I add the capability to add tags to my new content type?

Thanks


texts: How to show a block between the body and a paragraphs field?

texts:
For a larger article content type on a Drupal 8 page, I want to have the following structure:

Title Image/Video

Body (the normal node body with the title and some text)

A contanct block

Paragraphs

For the title image/video I'm not sure yet whether I want to simply create 2 different article types or find some magic to do either the one or the other, but that's fine.

The body that comes next, will just follow as is and contain some introductional text. I guess, I have to write my own template to be able to place the image before the title, but that'll work.

Then, I want a simple block that contains some simple contact information (probably the same block in every article).

Then, there should follow a paragraphs field that'll hold several paragraphs for the rest of the article.

Do you have any ideas how I could place this block?

Thank you in advance for your help :)


texts: Domain Access but isolated user and content perfectly

texts: I try domain access module for different domains. But when using user reference in contents every user sees other users. Is it possible to isolate every domain users from other domains users.


texts: Is it possible to assign an anonymous user's flags to a new user on registration?

texts: So, I'm working on a sample request feature which allows anonymous users to flag items and submit sample/inquiry requests. I'm debating converting the form to automatically register the user on submission, but I'm wondering if anyone had a way of saving the anonymous user's flags to the newly created user?


texts:
I'm working with a very complex legacy D7 site, and very complex requirements (bleaugh).

Anyway: I'm working on a deeplinking system that allows a jump to the site, which then logs-in a user (this is based on an encrypted ID), does some other stuff like setting up cookies, and then jumps to the required page.

This is fine, except some of them are HTTP pages, which work, and some are HTTPS, which don't.

What happens is that when it arrives on the required page there is no logged-in user (so "Access Denied"). But if I then go to an HTTP page (like the front page), the user is logged in.

So clearly I need to set up the HTTPS session data before jumping to the required page. I've been through the Drupal session code but I can't figure it out.

I need to set the SSESSPHPID cookie and possibly some other stuff - but what and what's right? Any help would be appreciated.


texts:
Hello Drupal Community,
I am creating a menu which has a link to an "editorial". I created a taxonomy named "edito" and created articles (content type) that are tagged with this taxonomy.
I need to recover the last article tagged with this taxonomy in the menu as a link (see image attached). Does anyone have an idea of how to achieve this ?
Thanks,


texts: Need to limit Commerce Shipping Condition to only fire if there are no items that do not match

texts:
We need the condition to trigger only if the cart items match the categories listed and there are no products that do not match.
Is there a way to limit Commerce Shipping Method Conditions (Product->Order Contains Product Categories) to trigger only if the order products match the categories and there none that do not match?


texts: D7 - download files works for admin, not for other users

texts:
There is a content type for accepting job applications, including resumes and cover letters as files uploaded. The files are set to private.

The form/page is set to unpublished by default - largely to 'fix' some other wonkiness.

Users with admin privileges have no trouble downloading the resume and cover letter files.

The more limited users in HR cannot - Drupal returns a message

  You are not authorized to access this page.

I've been tweaking permissions trying to find the magic bullet. The HR user can 'Edit' the individual's application form, but even though the associated resume or cover letter file is shown as a link, once again, the HR role is not authorized.

Any ideas what permission I need to toggle? What's blocking the ability for the HR role to download the file?


texts: Is there a way to add clauses like accept = 'image/*' to input items via forms API?

texts:
I'd like to add "accept" attributes to some of the input fields for my site's content types -- to end up with something like <input type="file" id="edit-field-whatever-und-0-upload" name="files[field_whatever_und_0]" size="22" class="form-file" accept="image/*">, so that (most) browsers will limit the selectable items to .jpg, .png, etc.  I've tried doing this by adding an #attributes clause to a form's hook_form_alter handler, but haven't been able to find the right way to write the clause -- I can't get the accept clause to show up in the html.

In place of this, I'm currently adding it through some jQuery that runs on document.ready, but it would feel cleaner if I could do it through the forms api. Is this possible? Any hints out there?  Thanks!


texts: Creating and storing data in the database

texts:
I have created a forum in administer->modules in Drupal 6, and I have set the permissions also, but it is not showing in my site.
I do not know how the forum contents will be stored in database, and how to establish a connection to the database.


texts: How to print all values of a multi-value field, except the first?

texts:
Suppose that in a Twig template, I want to print the first value of a multi-value field, then something else, and finally all other values of the same field. Is there a way to do that?

I know how to get the first value of the field, but I don't know how to exclude that first value from the place where I'm printing all other values.

This is what I tried, but doesn't work:

{# print first field value #}
{{ content.field_foo.0 }}
{# print something else #}
<hr>
{# print remaining field values #}
{{ content.field_foo|without(0) }}

Alternatives for the last line that didn't work either:

{{ content.field_foo|without('0') }}
{{ content.field_foo|without('field_foo.0') }}

Looking at the code in twig_without(), I would expect {{ content.field_foo|without(0) }} to work, but instead the entire field disappears.


texts: Changing Site Background on button (and carrying it over to all pages on site)

texts:
i'm trying to create a drupal site where under the logo, there would be three options visisble (light, dark, color), and once the user clicks on one of them, the site background will change.

now i know that this is easy to do with javascript (button, changing css background-image element)

but, how can i carry it over so that if the user clicks on a link on the site, the background-image stays the same without revolting to default?

i couldn't find any resources on how to do it, but i would gladly appreciate all of your help and anyone else on the interwebs with the same idea :)


texts:
I need to redirect users function of his role using external authenticate.

In my form_alter() I have:

$form['#validate'] = array(
  'user_login_name_validate',
  'beneficiaire_authenticate',
  'user_login_final_validate'
);
$form['#submit'][] = 'beneficiaire_user_login_dispatch';

My function to authenticate:

function beneficiaire_authenticate($form, &$form_state){
  module_load_include('inc', 'beneficiaire', 'ws');

    if('admin' == $form_state['values']['name']){
        user_login_authenticate_validate($form, $form_state);
    }else{
    $authResponse = beneficiaire_ws_authenticate($form_state['values']['name'], $form_state['values']['pass']);
        if($authResponse)   {
            user_external_login_register($form_state['values']['name'], 'beneficiaire');
            $account = user_external_load($form_state['values']['name']);
            //var_dump($account);exit();
            $form_state['uid'] = $account->uid;
            $account->roles[4]= 'beneficiaire';
            user_save($account);
      $_SESSION['account'] = $authResponse;
        }
    }
}

And finally my dispatch function where the aim is to redirect users function of their account status / type:

function beneficiaire_user_login_dispatch($form, &$form_state){
  if($_SESSION['account']->temporaire){
    drupal_goto('update-password');
  }else{
    drupal_goto('order');
  }
}

My point is, each user is always redirected to /node. How can I redirect them function of account status ?

Thanks


texts:
I am trying to use ajax in my form to dynamically add options to the dropdown, with the click of a button. The value entered in the textbox must be added to the dropdown. However i am not sure how to retain the added values in the dropdown.
Currently only the recently added value remains in the dropdown.

This is my module code:

<?php
function dropdown_menu(){
    $items['dropdown_form'] = array(
        'title' => 'Dynamic Dropdown',
        'description' => 'adding more textfields',
         'access callback' => 'dropdown_access',
         'access arguments' => array(1),
        'page callback' => 'drupal_get_form', //used during form api
        'page arguments' => array('dropdown'),
    );
    return $items;
}

function dropdown_access() {
    return TRUE;
}

function dropdown($form, &$form_state, $no_js_use = FALSE) {
   $form['field_name'] = array(
      '#type' => 'textfield',
      '#title' => t('Field Name:  String, Woodwind, Brass, Percussion'),
      '#required' => TRUE,
    );

   $field_val = isset($form_state['values']['field_name']) ? $form_state['values']['field_name'] : '';

  $form['add_to_dropdown'] = array(
      '#type' => 'button',
      '#value' => 'Add To Dropdown',
     '#ajax' => array(
      'event' => 'click',
      'callback' => 'dropdown_callback',
      'wrapper' => 'dropdown-second-replace',
    ),
    );

  $form['dropdown_second'] = array(
    '#type' => 'select',
    '#title' => 'Dynamic Dropdown',
    '#prefix' => '
',
    '#suffix' => '
',
    '#options' => get_dropdown_options($field_val),
    '#default_value' => isset($form_state['values']['dropdown_second']) ? $form_state['values']['dropdown_second'] : '',
  );

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

',
    '#suffix' => '
',
    );
    return $form;
}

function dropdown_callback($form, $form_state) {
    return $form['dropdown_second'];
}

function get_dropdown_options($key = '') {
  $options = array(
    t($key) => drupal_map_assoc(array(t($key))),
  );
  if (isset($options[$key])) {
    return $options[$key];
  }
  else {
    return array();
  }
}

function dropdown_submit($form, &$form_state) {
  print_r($form_state['values']); exit();
}


texts: Why does a renderable array work in an if statement, but not show anything if I dpm it?

texts:
I have information stored in a renderable array (I'm reasonably sure that's what it's called), and can use it in an if statement, eg:

if (!empty($element['singleProduct'])) {
  //do something

but if I try to use dpm above this, eg:

dpm($element['singleProduct']);
if (!empty($element['singleProduct'])) {
  //do something

dpm shows nothing.

Obviously I do have devel on. I can dpm other things. And I've tried clearing cache and registry.

Would anyone know what's going on here?


texts: Using a Paragraph field value as a View filter

texts:
I am attempting to create a view and paragraph combination that allows for site authors to customize the content that they want to display.

What is currently working:

Within my site is the content type of Article
I have a view, called News, that is set up to display the published Articles.
I created a Paragraph called Article Scroller (article_scroller) that uses a Views reference field (field_view_ref_news) to display the above view.

The above setup allows authors to add the News view to any page, such as a Basic Page or another custom content type. This is all working great.

Where I'm stuck:

I want to take this a step further and allow for the content author to define a filter for the view, such as a location. To do this, I added an Entity Reference field to my Article content type called "Location" (field_location). This is populated with a value from a taxonomy list of states (e.g. Texas).

I then added this same field (field_location) to my article_scroller paragraph.

The idea is that an author would add Texas to an article, and then if they wanted to customize the view to show Texas articles only, they would also define this term within the paragraph.

From there, I'm not sure how to proceed. I'm pretty sure I need to add some kind of relationship and contextual filter here, but am struggling because the term/tid is not going to appear within the URL, and the options under "Provide default value" don't seem to be relating to what I want to do (at least, nothing I've tried from other posts and research has seemed to apply).

Another confusing thing is that I only have my one "field_location" field, but within the view, it appears as two different fields - one under the "Content" category and the other under the "Paragraph" category, which makes sense, but seems to complicate the contextual filters even more as I have to choose between "Content: Location" and "Paragraph: Location".

I know that one alternative method would be to create a view page/block for each location, Texas, California, New York, etc. I am just hoping I can do something a bit more dynamic.


texts: Simple Oauth oauth/debug?_format=json Internal Server error

texts:
When i try to test the ooauth/debug?_format=json endpoint through Postman i get the internal server error and error code 403 forbidden.
Even though i use a valid Authorization header with Bearer and the access token for a certain user. The endpoint works fine for anonymous user.
So i guess it's a permission error or the token expires even though i've set a big expiration date for testing purposes.
Has anyone encountered the same issue as me? If yes did you manage to solve it? I follow the tutorial step by step from the official simple_oauth module page in drupal. Thanks in advance for reading this.


texts: Set a content type's teaser image (right outlined)

texts:
So I'm looking to get the image of the teaser display from the bottom outlined to the right. Here's screenshots to make it clearer.

As you can see, I've already managed to do it once, but I can't reproduce.
Also, can't find how to get the "add to cart button" on the product.


texts: Why isn't the value for a new Boolean field rendered?

texts:
I added a new Boolean field to a content type. For some nodes, I did set this field.

Still, the field value is not shown on the node page.

Why?

I realize that, as long no value is set for the new field, it isn't present in the database, but (as seen in the screenshots) on that node, the field is set to true and it should be shown on the node page, shouldn't it?


texts: How to put google map field in my form of my custom module?

texts:
i like to build a form field based on google map, where user can put in their address, city and country, then the map will automatically search for it.
and then you can put a pin to define the exact location, which the expected output is latitude & longitude which will be saved during form submit.

how to approach this? is there any module in Drupal 8 that i can use during form generation?

maybe something like:

 $form['map'] = array(
      '#type' => 'gmap',
      '#otherProperty' => propertyValues,
 );

Thank you,
AnD


texts: What's wrong with the fetch rss feed code?

texts:
The hook_block() code is the following.

   // …
   case 'view':
      $url = 'http://example.com/feed'; //the site's rss url
      $blocks['subject'] = t('on the bookshelf');
      $blocks['content'] = _mymodule_fetch_feed($url);
      return $blocks;
   // …

function _mymodule_fetch_feed($url,$num_itmes=3){
  $http_result = drupal_http_request($url);

  if ($http_result->code == 200) {
      $doc = simplexml_load_string($http_result->data);
      if ($doc === FALSE) {
        $msg = "error parsing booksheld xml for %url: %msg.";
        $vars = array('%url'=>$url,'%msg'=>$e->getMessage());
        watchdog('goodreads', $msg, $vars, WATCHDOG_WARNING);
        return t("Getting the bookshelf resulted in an error.");
      }

      return _mymodule_block_content($doc, $num_items);
    }
    else {
      $msg = 'No content from %url.';
      $vars = array('%url' => $url);
      watchdog('goodreads', $msg, $vars, WATCHDOG_WARNING);

      return t("The bookshelf is not accessible.");
    }
  }
}

function _mymodule_block_content($doc, $num_items = 3) {
  $items = $doc->channel->item;
  $count_items = count($items);
  $len = ($count_items < $num_items) ? $count_items : $num_items;
  $template = '
'.'
%s
by%s
'; // Default image: 'no cover'.
  $default_img = 'http://www.example.com/images/nocover-60x80.jpg';
  $default_link = 'http://example.com/feed';
  $out = '';
  foreach ($items as $item) {
    $author = check_plain($item->author_name);
    $title = strip_tags($item->title);
    $link = check_url(trim($item->link));
    $img = check_url(trim($item->book_image_url));

    if (empty($author)) {
      $author = '';
    }

    if (empty($title)) {
      $title = '';
    }
    if (empty($link)!== 0) {
      $link = $default_link;
    }
    if (empty($img)) {
      $img = $default_img;
    }

    $book_link = l($title, $link);
    $out .= sprintf($template, $img, $book_link, $author);
  }

  $out .= '

'. l('Goodreads.com', http://example.com').'
';
  return $out;
}

I put this code in my module; it can get the data, but the links are all the same.(http://example.com). How can I make it work?


texts:
I'm on drupal 8, and I'm trying to figure out how to get the current node id in an override of views-view-unformatted.html.twig.

I have a view filled with titles with added links and I want to add a class to the one the corresponds to the current node id.


texts:
I have views for solr search result and I have highlight processor enabled. There seems to be cache issue effecting search result. Search results are rendered array of entities. For example: If I search 'content'. I see my result highlighting word 'content' correctly but when I search for result 'extraction', in the page with both words 'content' and 'extraction', it highlights 'content'. I used

\Drupal::service('page_cache_kill_switch')->trigger();

in views pre_render but didn't work as expected. Views advanced setting already has caching set to none.

Can anyone help me disabling cache for this particular view?

Thank you.


texts: Group items in Views by value in Field Collection

texts:
I have a content type (content type X) containing a Field Collection field.
This Field Collection field consists of a Node Reference (content type Y) field and a text field.

I would like to create a view where I group items based on the nodes selected in the field collection field.

An example:

Node 1:

Field collection:

Node ABC : text here
Node BCA : text here

Node 2:

Field collection:

Node BCA : text here
Node CDE : text here

The view showing these items would look like the following:

ABC

Node 1

BCA

Node 1
Node 2

CDE

Node 2

How would I be able to create a view like this?
I'm sure I need to use relations, but honestly I have no idea where to start.

Thanks for any help in advance!


texts: When I save a user account as an admin, I get logged in as that user

texts:
I'm experiencing a strange issue that I'm having a really hard time debugging.

When I save a user account (of an authenticated user) as an admin, the account is saved, but when the page reloads I get an access denied and I am suddenly logged in as the user I saved, not the admin.  This happens whether I save the account in the UI (via the People page) or save the account using a rules action.

Recently, I added a custom function and modified a few of my rules, so these changes are likely to be the cause of the problem.  The site is version-controlled using git, so I can roll back to a working version, but I would like to attempt to determine what I did wrong.

I have Netbeans working with Xdebug.  I just don't know where to set breakpoints or how otherwise to start looking for the source of this problem.


texts: Single Sign On (SSO) with Active Directory (AD)

texts:
I have some issues with the single sign on option from LDAP.
Currently it is possible that users can manually login on the website based on their AD credentials. This works with the LDAP module.

But whenever I enable Automated single sign on I get different problems.
I also enabled windows verification in my ISS.

problems i encountered
 - cannot find map /user/login/sso
 - when i try with other pc www.(myip)?q=/user/login/sso i get the error
" you were not authenticated by the server, use your credentials  below".

How do I make so it log's a user from the AD auto in ?

additional details:
 drupal 7.43
IIS
i test locally and with other computer in same network


texts: Display page hierarchy on "Content" page of Admin Panel

texts:
I'm currently working on a  Drupal application that has two content types (Floors, and Things). I'm using the Node Hierarchy module to declare child pages. The current structure goes something like this.

Floor 1

Floor 2

Floor 3
Floor 4

Thing 1

Floor 5

...etc

I'm looking for a way to display this relationship on the admin dashboard instead of just having Drupal list every piece of content I want to have some sort of indication that one piece of content is a child of another.

Does anyone know of a module that can do this for me, or a way I can implement this myself?

Cheers


texts:
I found a tutorial for a nice menu for my site.

Everything went well till step 7; when I enter this in Views3 on Drupal 7, I get this error message:

  Display "Block" uses fields but there are none defined for it or all are excluded.

How can I solve this?


texts:
How do I add CSS styles for a specific page?

For example, I want the <body> background color on a specific page to be different from the background color used on the front page.
I've looked into hook_theme_preprocess(), but I am confused on how I should implement it.


texts:
I want to add 2 jquery scripts to my website that have to be executed on every page.

Smoothstate

<script src="jquery.smoothState.js"></script>
<script src="functions.js"></script>

If i read some websites I don't understand how to add them. I can call the js file's in my .info file or is there an other way? I also read about template_process_html() to add js to my theme but in what file i have to put this?

Can someone help me out with this.


texts: Prevent the email registration module from appending the user ID as a suffix on new user's username

texts:
I'm a newbie in Drupal and I have an issue with the User module (I think).

In my user registration form there is no username field but there is email field provided by the Email Registration module. When users register, Drupal generates a username from given email using its first part before @ and appends user ID to it. For example: if I will try to register with email user@mysite.com, Drupal will generate username for my account user_123 where 123 - is user ID.

How can I change this default behavior and prevent Drupal from adding _123 to generated username? Is there is any solution to get rid of the username, and use the email?


texts: How to get selected term ID from drop down while ajaxing?

texts:
I can't get name or ID from selected drop down during ajaxing. I was trying with code below:

if(isset($form_state['values']['submitted']['company_name'])){
    $company_ID = $form_state['values']['submitted']['company_name'];
    $form['submitted']['company_name']['#value'] = $company_ID;
}

Why is $company_ID empty?


texts:
I have the following configuration with my drupal website:

Taxonomy vocabulary: Procedure
Users Role: Doctor
Node Type: Surgical Operation

When I create a "Surgical Operation" node, I can select a procedure (abdominoplasty, breast augmentation, etc...) and a doctor (users with doctor role) via entities.

What I would like to do now is create a View that displays what operations have been performed, how many times, and by what doctors in a table:

So far I have tried the following modules without success:

Views Aggregator Plus;
Views Calc;
Views Table Group;

How should I proceed? Should I create a module myself to display these informations?

Thank you for your help.


texts: Detect when 'Remove' is clicked on a file widget form element?

texts:
I have a handful of file fields that have the following default Drupal behavior:

User can upload a file
User can upload another file in place
User can remove file

Standard config. Whats happening is the user wants the file being replaced to be deleted before the new one is uploaded, and thus, avoiding the issue where files have their names replaced with _N identifiers to ensure unique filenames.

This is because they are referencing physical file paths from the menu and WYSIWYG fields - which means the old replaced file is being referenced instead of the new one. Since these are core file fields and over 100 files have been uploaded, I cannot switch out to a Media field. I'm also not sure if that would even solve the problem at hand, anyway.

Is there any way I can hook into this widget via form alter, detect a click on the upload field, and if a new file is being added, delete the old one in place so that the file being uploaded the name stays intact and thus preserving link targets?

I have looked at the form with both hook_form_alter and hook_field_widget_form_alter - but I am not really seeing anything I can use to hook into.


texts: Views Galleriffic- pagination does not show

texts:
When I updated the Views module to 6.x-3.x-dev, pagination stopped being shown in Views Galleriffic 6.x-1.x-dev.

http://demo.dolphin-sch.ir/Doctor/content/asas

My settings are:

Use pager: Paged, 9 items
Style: Galleriffic Gallery
Enable Bottom Pager: yes

And I have 17 images.

Please guide me.

I want to show pagination like this link:
http://demo.dolphin-sch.ir/nagara/fa/galleriffic/95


texts:
I use this field definition in the entity "message" class.

$fields['fichier'] = BaseFieldDefinition::create('file')
  ->setLabel(t('Fichier attaché'))
  ->setSetting('file_directory', 'messagerie/fichier') // dossier d'upload
  ->setSetting('max_filesize', '10MB') // taille max du fichier
  ->setSetting('file_extensions', 'pdf doc txt xls zip rar mp3 mp4 csv jpeg jpg ppt') // extensions autorisées, à séparer par un espace
  ->setSetting('description_field', FALSE) // si on veut activer un champ « description »
  ->setDisplayOptions('form', [
    'label' => 'hidden',
    'type' => 'file_generic',
    'weight' => 0,
  ])
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);

In the associated form I need to set this field a multiple field (I can't find a way to set cardinality in the definition field).
How can I do that ?


texts: How to filter views result using the views_php module?

texts:
I have 2 integer fields in views , first field is 'field_code' and second field is 'field_rank',
Finally I want filter views result, with views_php module.
I use this code but it does not work,

$math = ($row->field_code / $row->field_rank) * 100;
if ($math < '30') { return TRUE; }

Please can someone help me to fix this problem.


texts:
I have the business drupal theme aplied on a test site, in this theme u have a slideshow on the front page. I wanted to display it on every page so I copied following code to page-tl.php

    <?php if (theme_get_setting('slideshow_display','business')): ?>
    <?php
    $url1 = check_plain(theme_get_setting('slide1_url','business'));
    $url2 = check_plain(theme_get_setting('slide2_url','business'));
    $url3 = check_plain(theme_get_setting('slide3_url','business'));
    ?>

                    <a href="<?php print url($url1); ?>"><img src="<?php print

base_path() . drupal_get_path('theme', 'business') . '/images/slide-image-4.jpg'; ?

>">
                    <a href="<?php print url($url2); ?>"><img src="<?php print

base_path() . drupal_get_path('theme', 'business') . '/images/slide-image-5.jpg'; ?

>">
                    <a href="<?php print url($url3); ?>"><img src="<?php print

base_path() . drupal_get_path('theme', 'business') . '/images/slide-image-6.jpg'; ?

>">

<?php print check_markup

(theme_get_setting('slide1_desc','business')); ?>

<?php print check_markup

(theme_get_setting('slide2_desc','business')); ?>

<?php print check_markup

(theme_get_setting('slide3_desc','business')); ?>

                1
                2
                3

    <?php endif; ?>

  <?php print $messages; ?>

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

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

  <?php endif; ?>

  <?php if ($page['home_high1'] || $page['home_high2'] || $page['home_high3']): ?>

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

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

     <?php endif; ?>
     <?php if ($page['home_high2']): ?>

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

     <?php endif; ?>
     <?php if ($page['home_high3']): ?>

<?php print render($page

['home_high3']); ?>

     <?php endif; ?>

  <?php endif; ?>

Now the sliding effect is gone (except on the front page), so I thought that there was missing javascript. However I can't find a solution...

U can see the problem on Click for problem here


texts:
I inherited a Drupal 7.22 site that uses Panels 7.x-3.2 (and Panels Everywhere 7.x-1.0-alpha1 and Ctools 7.x-1.3) and I've tried Panels Breadcrumbs module for the breadcrumbs.  The site has a few panel pages that features content in tabs using CSS (see screenshot, script also pasted below).  The content featured within each tab is a mini panel.   The label for each tab is not a menu item.

I was wondering if it was possible to generate separate breadcrumbs for each tab...so for example, if you were on Tab2, the breadcrumb would display as Home > [Top-Level Section Name] > [H1 of page] > Tab2.  And if you were on Tab3, the breadcrumb would display as Home > [Top-Level Section Name] > [H1 of page] > Tab3.  Currently, the URL does not change when you click between tabs.

I'm thinking I may need to change the way the content is currently displayed.  I tried creating a panel page for the content featured in each tab and linking the tabs to the new pages, but the URLs do not  change when I click between tabs, even when it's hyperlinked to a page.

I've also looked into Path Breadcrumbs and Crumbs, but haven't gotten them to work.

Script for Tabs (used within Panel Page):

Tab1

Tab2

Tab3

CSS for Tabs:

ul.tabs {
    position: relative;
    left: 0;
    margin-left: 0 !important;
    display: block;
    width: 855px;
    height: 41px;
    margin: 0;
    padding: 0;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    margin-bottom: 25px;
    /* Resetting Styles */
    padding-left: 32px;
    padding-top: 3px;
    padding-right: 32px;
    list-style: none;
    background: url("img/bg-orange.png") repeat-x; }
ul.tabs li {
    float: left;
    margin-right: 5px;
    padding: 10px 15px 6px 15px; }
ul.tabs li:hover, ul.tabs li.open {
    color: #000 !important;
    background: #FFF;
    -moz-border-radius: 10px 10px 0 0;
    -webkit-border-radius: 10px 10px 0 0;
    border-radius: 10px 10px 0 0;
    cursor: pointer; }
ul.tabs li:hover a, ul.tabs li.open a {
    color: #000; }
ul.tabs li a {
    display: block;
    text-decoration: none;
    color: #FFF;
    font-size: 14px;
    font-weight: bold; }

Any guidance/advice would be great.
Thanks!


texts: How to override default class of custom text field in views?

texts:
How can I change the nothing in the "views-field-nothing" class of a custom text field in views?

I just can't find the appropriate setting...


texts: Change search results pager to mini pager?

texts: How to change search result's pager to mini pager. I want to change default pager to mini pager in that search result page. Please help me. Thank you.


texts: Reaction after click on custom link inside views

texts:
I have a views which select all not validate "event". And the purpose is to add a button to validate the "event".
My hope is when I click on the button a popup ask you to confirm the validation. if yes i want to use rule to make this action.
My issue  is that i don't know how to begin it


texts:
So I've uploaded a private file. It can be accessed like following:

http://drupal8.dev/system/files/2016-12/README.txt

How can I change how that file is accessed?

http://drupal8.dev/files/README.txt, etc.


texts: In drupal 7, for field widget type, what is "server side" used for?

texts: I created a new content type and added a text field.  While creating the text field I am given three options for the widget type: Server Side Only, Hidden Field, and Text Field.  The "Server Side Only" and "Hidden Field" come from the Hidden Field module.  Can someone explain when Server Side Only would be used?


texts: I am new to drupal 7 theming. I see that there is a variable called $page_top  in html.tpl.php file, which contains HTML markup for the header section of the body. I want to override this and print my markup. How can I do that in template.php file, or is there any other way?


texts: Create content type based on filtered results of other content types?

texts:
I'd like to create a content type where the user can select criteria from an existing content type to form a unique list of content.

For example, let's say I have a content type called shoes with the fields size, color, and price.  (It may not be relevant to the example, but let's say that size and color are stored as lists, and price is stored as a decimal.)

I'd like a user to be able to create a new node of content type called list (or something to that effect) where they could select values from the three fields within shoes, and store the result as a unique list node (e.g. "all size 8 red shoes under $50").

What's the best method to achieve this?  Is this a job for Entity Views Attachment?


texts: Is there a module that will add an image field that displays an image from an off site source?

texts: Im on d7. I'm looking for a way to have images displayed on my site from another image hosting site such as imgur or imageshack. Right now I've been using the media module for uploading images to my site and it works great, but I don't want to store the image on my server. I need the ability to "source" where the image came from, but the media module doesn't store that info, it just downloads the file. thanks for your suggestions.


texts: Display definition of the term searched for - above search results

texts:
Beginning a search on google with 'what is psych'... triggers auto completion with 4 suggested phrases - arrow down through each and you will see its definition appear above its pertaining results:

How can I add a definition of the terms (if available) above the results? Ideally would like to use auto complete. I've attempted to achieve this with the Google custom search engine and Google site search modules. Unfortunately, the Google Dictionary service appears to no longer be supported by Google.

I explored another option such as using Solr search api and coding a second custom call from a definition source such as Wordnik and then combining that result with the Solr results. I think this may be feasible but not sure yet how will combine the results.

How could I combine search results to include a definition and/or is there a better way to include a definition of what the user may be searching for, above the actual results?


texts: Hide results of drupal view when filter value is empty after search

texts:
Help needed, how to hide all results of a view when filter value is empty, after search button pressed.
(I have this: Set Advanced | Exposed Form | Exposed Form Style to input required. Not working well. When open view OK, but for empty search field, and search button pressed all appear)
I know there are lot of solutions  here: (5 years old) https://www.drupal.org/node/358546 but I can't find those options in views in Drupal 7.
Can somone provide a working solution for Drupal 7 and Views version 7.x-3.x?

Explain question, end the operator for VIN and kod sterownika set to: "is equal to"


texts: Is there an alternative Drupal 7 module for the Advertisement module?

texts: We are looking to upgrade a site to from Drupal 6 to Drupal 7 that uses the Advertisement module. There is an alternative module to the Advertisement module for D7?