texts:
I am having issues with dates and time zones in Drupal 7. I have created a content type that stores the date in $field_event_date. When I use the Views module this works correctly.  However, I am using a template file to manipulate the display of this data. When I output the raw value, it is correct, so is the time zone; when I attempt to format it with the time zone format_date() seems to ignore the time zone value. Is there a proper way to do this in Drupal?

    print '
' . $field_event_date[0]['value']; // outputs 2011-11-04 21:30:00
    print '
' . $field_event_date[0]['timezone']; // outputs America/New_York
    print '
' . date('g:ia', strtotime($field_event_date[0]['value'])); // outputs 9:30pm
    print '
' . format_date(strtotime($field_event_date[0]['value']), 'medium', 'g:ia', $field_event_date[0]['timezone']); // outputs 9:30pm (????)

I have done this with just pure PHP this way:

// Get the timezone offset
$timezone = $field_event_date[0]['timezone'];
$remote_dtz = new DateTimeZone($timezone);
$remote_dt = new DateTime("now", $remote_dtz);
$offset = $remote_dtz->getOffset($remote_dt);

// Get the date
$start_date_string = $field_event_date[0]['value'];
$end_date_string = $field_event_date[0]['value2'];

// Apply the timezone offset
$start_date_string = strtotime(date("Y-m-d g:ia", strtotime($field_event_date[0]['value'])) . " " . $offset . " seconds");
$end_date_string = strtotime(date("Y-m-d g:ia", strtotime($field_event_date[0]['value2'])) . " " . $offset . " seconds");

// Build the date
$start_disp_date = date('l, F j, Y', $start_date_string);
$end_disp_date = date('l, F j, Y', $end_date_string);
$start_disp_time = date('g:ia', $start_date_string);
$end_disp_time = date('g:ia', $end_date_string);

This was working fine until recently a few dates started showing up about one hour off. I would prefer to use a Drupal centric solution (like format_date) since it might help me avoid odd occurrences like this one. Any advice for either approach would be appreciated however. This is all on a production site, so I just need to get it working.

Thank you for your time.

EDIT/UPDATE:

My PHP only solution was broken because of daylight savings time. So I replaced that code with this:

// Get the timezone offset
$offset = date('Z', strtotime($field_event_date[0]['value']));

// Apply the timezone offset
$start_date_string = strtotime(date("Y-m-d g:ia", strtotime($field_event_date[0]['value'])) . " " . $offset . " seconds");
$end_date_string = strtotime(date("Y-m-d g:ia", strtotime($field_event_date[0]['value2'])) . " " . $offset . " seconds");

// Build the date
$start_disp_date = date('l, F j, Y', $start_date_string);
$end_disp_date = date('l, F j, Y', $end_date_string);
$start_disp_time = date('g:ia', $start_date_string);
$end_disp_time = date('g:ia', $end_date_string);

Granted, this doesn't solve the problem with format_date(). While I'm going to stick with my PHP centric solution, others might have the same problem. Perhaps I am using the function incorrectly.


texts: How can I implement 3-way relationship (reference) between entities?

texts:
I have 3 entities: A,B — node types, C — user.
Node A has 2 reference fields, one to B and one to C.
What I need is to show in a view all B nodes for a certain C, which has a relation A-B=A-C


texts: entity_reference autocomplete: Allow multiple target_types

texts:
I'm creating a new custom entity and would like the ability for my entity_reference autocomplete field to be able to allow selecting from any arbitrary set of entities.

For example, let's say I would like the available autocomplete options to draw from:

two node types (page, my_custom_node)
users
the terms in the Tags taxonomy vocabulary

Can anyone lend me insight as to how this might be accomplished? I'm a somewhat experienced Drupal 7 developer, but Drupal 8 has been quite an uphill climb for me and I'm afraid that not all of the new concepts are clear enough to me yet to accomplish this task on my own.

Thanks!


texts: How do I use Facebook access tokens in body (custom script)

texts:
I am new to Drupal 7. I am using Drupal for Facebook and it can generate Access Tokens by using AppID and Secret. But is there way to use Facebook module's functions in the body of Article or Basic page? I want to add a custom script, which requires FB Access Token, but I do not know how to get it without recreating it from the scratch.

Thank you in advance.


texts: Detect jwplayer events with multiple videos on page

texts:
I want to detect onstart and oncomplete event separately on each video displaying on the page.

What i have done so far

  $display=array("type"=>"jw_player");
    $field = field_get_items("node",$nodeval, "field_video_upload");
     for($m=0;$m<=$viewcountvideo;$m++)
     {
         //if(isset($field[$m]))
         //{
         $vidcount = $m+1;
         $html.='

'.render(field_view_value("node",$nodeval, "field_video_upload", $field[$m], $display , $langcode = NULL)) ;

    $html.='
';
         //}

     }

//js code

(function($) {

  Drupal.behaviors.jw_player = {
    attach: function(context, settings) {
        var $this = $(this);

        jwplayer().onPlay(oPlay);
        jwplayer().onComplete(oComplete);

    }
  }
})(jQuery);

function oPlay(){

alert('Its started');
}

function oComplete(){
alert("Its complete!");
}

Videos are displaying fine on the page, I am having trouble with getting events on the videos. Its working only on the first video. How can i get events on each video?


texts: Views Infinite Scroll - Back Button Behaviour

texts:
I recently integrated the Views Infinite Scroll module which integrates the jquery autopager library with Drupal Views. You may see the result here.

The problem I am facing is related to the url. Every time a new set of data is loaded the pager integer is increased. Upon clicking on a product and then clicking your browser's "back" button, the browser keeps the page hash and load the content that was being viewed before.

The issue with that is that no previous loaded content shows up. The data set starts from the page number.

Any help is appreciated


texts: What's the difference between Page manager and Panels?

texts: I'm writing this question, because I see confusion all over the Drupal community about "what is Page manager", and "what is Panels".


texts: How do I solve extra characters in a date format?

texts:
This seems to be a known issue in drupal, personal commentary redacted.

So I set up a date format, and any non date-format characters get reprinted at the end of the date.

I first had my formatter set up as Y年m月, but read in the issue that I need to escape characters, so:

Format: Y\年m\月

Preview in Date and Time preview area: 2016年08月

Actual output: 2016年08月　年月

Looking in views where the field is being output (to json in case that makes a difference), there is no custom option for the formatter, so I couldn't try recreating the date formatter in views to see if that would work better.


texts:
I recently had a db crash on the site I am currently working on.  I was running sqlite, and the crash locked the db.  No matter what I tried, I couldn't get drupal to access the database again (killed the process, exported into a new db, reinstalled drupal).  So I decided to just migrate it to MySQL.  I converted the sql dump from the old database to MySQL syntax without too many problems.  I can import my nodes just fine, I cannot however get my content types, panels and views to import.

I have tried dbtng migrate, it recognizes both databases, however it keeps giving me schema errors that I can't get around.  ie. destination database does not contain table variable_store -> import variable store from sql dump -> destination database contains table varaible_store dbtng migrate cannot overwrite table.  That is an issue in and of itself, but I digress.

The original site is completely dead, there is no way I can backup from the Drupal UI.

TLDR
cannot import content types, panels or views from sql dump.


texts: Find the total dollar amount spent by shopper in Ubercart, using Views?

texts:
I'd like to run a report that will show info about each shopper, as well as the total dollar amount they have spent on my site. I know that the "Customer Orders" page (for instance, mysite.com/admin/store/customers/orders/1 for user #1) shows the total amount spent by an individual customer... how can I access that total amount in Views so I can build a custom report?

Thanks!


texts:
In my header region, I have two blocks: menu and search. I want to add some other HTML between them. I tried using {{ content.menu}}, but it doesn't actually do return anything.

I can split up the content with {{ content.field_type }}, but this approach doesn't seem to be working in region.html.twig.


texts: How to perform calculations using a field from another content type?

texts:
I have a spreadsheet as in the screenprint below:

Here are some details about the screenprint above:

I have 2 content types: Product and Invoice.
It consists of 3 datablocks:

Product: a table with 4 columns, and 1 row for each available product, such as the price for each product.
Invoice: a table with 4 columns, and 1 row for each invoice, which includes the total invoice amount, which is the quantity sold for a product, multiplied by the price of the product (derived from the product data block).
Total income per product, which is like a join of some of the columns of the Product data block with the Invoice data block, and to which "Subtotal" and "Page Total" row were added.

Any suggestions about building the equivalent of this spreadsheet in Drupal?


texts: Problem in theme-settings trying to save and modify file

texts:
I have downloaded a template and  what i want to achieve is that i can upload a file from the template option without using the ftp client. I have three slideshows and the code that i have implemented is the following:

  $form['busi_settings']['slideshow']['slide3'] = array(
    '#type' => 'fieldset',
    '#title' => t('Slide 3'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  $form['busi_settings']['slideshow']['slide3']['slide3_desc'] = array(
    '#type' => 'textfield',
    '#title' => t('Slide Description'),
    '#default_value' => theme_get_setting('slide3_desc','participacionciudadana'),
  );
  $form['busi_settings']['slideshow']['slide3']['slide3_url'] = array(
    '#title'        => t('Custom Image File'),
    '#type'         => 'managed_file',
    '#description'  => t('Upload a custom image for your site.'),
    '#default_value' => theme_get_setting('slide3_url'),
    '#upload_location' => 'public://imagessliders',
    '#upload_validators' => array(
        'file_validate_extensions' => array("png jpg jpeg gif"),
    ),
    );
    $image_custom_index = theme_get_setting('slide3_url');
    if (isset($image_custom_index)) {
        $fid = theme_get_setting('slide3_url');
        $file = file_load($fid);
        if ($file->status == 0) {
            $file->status = FILE_STATUS_PERMANENT;
            file_save($file);
            file_usage_add($file, 'slide3_url', 'slide3_url', 1);
            // Sets a Drupal message just for clarity.
            drupal_set_message(t('Image saved.'), 'status');
        }
         if ($file) {
          file_usage_delete($file, 'slide3_url', 'slide3_url', 1);
          file_delete($file);
        }
    }

I have a lot of errors, the upload is permanent but i cannot replace or delete an image, having a PDO ERROR in all cases...
While im working with it, i would appreciate any help you can provide me. Thank you.


texts:
I can't add links to any of my menus.

I go to the menu, click on add link, and fill all the required data; I get the message, "Your configuration has been saved." It doesn't seem it is what it is done.

All modules and core are updated to the last versions.


texts: Newbie Simple D and Views question about grouping and "exclude from display"

texts:
First time Views project simple question about Views and a HTML list of nodes with Taxonomy term.

I have a basic list of nodes with shared taxonomy terms. The page displays all the nodes and taxonomy terms. When I add a group (under Style: HTML List), I see a new page element added duplicating the taxonomy term. Then, under fields is a checkbox, "Exclude from display" which has a description to suggest this fixes the duplicates when using groups.

Now all the data is excluded! None of the other Field items has this Exclude checked. Each time I made these updates the changes were made immediately. Still, I cleared the cache before posting this missive. Why is all my node data missing from the page with this one use of Exclude? Is this a bug?


texts: I am unable to develop this but was wondering if there is any modules out there or at least some guide to work on HSBC Payment method for Ubercart 3.x ?


texts:
I would like to be able to change a users password in code.

Since user_load returns an object, and user_save wants an array, this is non-trivial.

I assume someone has figured out a quick and easy way to do it.

My current solution looks like:

db_update('users')
  ->fields(array('pass' => user_hash_password('some_password')))
  ->condition('uid', 1)
  ->execute();

But I don't like that this bypasses most hooks.


texts: I have several field collections from different content types. I'm looking to allow users to go to one place to edit these fields as a form. Is this possible?


texts:
I am working on an already existing site that has content.
There is a content type with field date and time. I need to remove the time component and just be Date only without deleting any content along the way. If the time data is lost, that is fine.
Can I simply delete the field and recreate it with date only? Or will that delete the existing data?


texts:
I am building an Android app that talks to Services module using REST endpoint.  When I post any content without setting the "has_js=1" cookie to the REST endpoint in JSON format, my content is never accepted by Drupal or Service module.

What is the use of has_js cookie and why do I need to send along with my POST requests?

Update:

Following is my code to post the article content type. If I do not add the has_js=1 cookie, article won't be posted to Drupal site.

 protected Integer doInBackground(String... params) {

        //read session_name and session_id from passed parameters
        String session_name=params[0];
        String session_id=params[1];

        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost("http://ec2-54-***-**-***.us-west-2.compute.amazonaws.com/cmac/rest/node");

        try {

            //get title and body UI elements
            TextView txtTitle = (TextView) findViewById(R.id.editTitle);
            TextView txtBody = (TextView) findViewById(R.id.editBody);

            //extract text from UI elements and remove extra spaces
            String title=txtTitle.getText().toString().trim();
            String body=txtBody.getText().toString().trim();

            //create JSON object to pass to Services endpoint
            JSONObject json= new JSONObject(" { \"title\":\""+title+"\",\"type\":\"article\",\"body\":{\"und\":[{ \"value\":\""+body+"\"}]}}");

            StringEntity se = new StringEntity( json.toString());
            se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
            httppost.setEntity(se);

            BasicHttpContext mHttpContext = new BasicHttpContext();
            CookieStore mCookieStore      = new BasicCookieStore();

            //create the session cookie
            BasicClientCookie cookie = new BasicClientCookie(session_name, session_id);
            cookie.setVersion(0);
            cookie.setDomain(".ec2-54-***-**-***.us-west-2.compute.amazonaws.com");
            cookie.setPath("/");
            mCookieStore.addCookie(cookie);
            cookie = new BasicClientCookie("has_js", "1");
            mCookieStore.addCookie(cookie);
            mHttpContext.setAttribute(ClientContext.COOKIE_STORE, mCookieStore);

            httpclient.execute(httppost,mHttpContext);

            return 0;

        }catch (Exception e) {
            Log.v("Error adding article",e.getMessage());
        }

        return 0;
    }


texts: global link in views is displaying %3f etc

texts:
I have made a global text variable inside a view which I set as a link. This link contained parameters of the other fields found in the view. This is the link I set it for:

subscription_status?staff_action=reject&first_name=[field_first_name_value]&last_name=[field_last_name_value]&email=[field_email_address_value]&teamid=[field_team_nid]&nid=[nid]

This worked fine. Now, all of sudden it stopped working. Now the end part of the url reads:

  subscription_status%3Fstaff_action%3Dreject%26first_name%3D%0A%20%20Jo%26last_name%3D%0A%20%20E%26email%3D%0A%20%20myemailaddress%40gmail.com%26teamid%3D%0A%20%20Varsity%20Girls%26nid%3D381&staff_action=reject&first_name=_%20%20Jo&last_name=_%20%20E&email=_%20%20myemailaddress&teamid=_%20%20Varsity%20Girls&nid=381

it repeats everything and adds in a lot of replacers ie: %3f. Why is this all of a sudden happening and how can I stop it?


texts: Private files aren't blocking direct access to image files

texts:
I'm currently very confused by how private files work:

I have a content type that has an image field and a file field.  Both
are set up to use private file access for their contents.
Node access on the content type is working correctly.
A user who does not have access to the node cannot get to the contents of the file field -- they get an access_denied page when they try to load the URL of the file.
However, they DO have access to the image file, via the image's url (/system/files/...): hitting the image URL in a browser brings it right up.

Are there any insights out there about why the image file is leaking through, and what I can do to stop it?   I've explored hook_file_download and hook_file_download_access, and have been putting watchdog statements throughout the image and files modules trying to track this down, but to no avail.  Thanks!


texts: How do I iterate through views result with pagination in a template file?

texts:
I am using Drupal 7.8, built a custom cck type, populated it with content, and created a view with full pager of 10 items per page.

I'm modifying the views theme Row Style Output - views-view-fields.tpl.php to do something, but every-time I try to collect the entire views result set, I only get the first 10.

ie.
foreach($view->result as $id => $data) {
   // track $data->field
}

How do I bypass the pagination limits so that in my views template I have access to all the results (which is over 20+)?

Here is an example layout of my cck type -

CCK TYPE: Videos; CCK FIELDs: title, body, url, date_recorded

date_recorded is a custom date format which only has Month, Year.

The view filters and groups these fields by date_recorded, and uses full pager for 10 items like so :

Feb 2012
- Video 1
- Video 2

Dec 2011
- Video 3
- VIdeo 4

...

PS - This is the 2nd part of a question that began here - Alternative ways to group results of a view by CCK field?


texts:
In one Drupal 6 based site there are product pages like : example.com/product1, example.com/product2 etc but in Google search engine result pages(SERP) it is instead taking us on clicking to url's to like : example.com/product1?page=2 or page=1 or other pages and so on.

This site has Nodewords installed and has meta-description defined for each page. But in case of url's like example.com/product1?page=2 meta-description isn't appearing.

The front-page seems to be set to "/node" so I can see in the bottom of the front-page as 1,2,3,4 ... links for pagination.

I simply want Google to index the page like example.com/product1 and not example.com/product1?page=2.

Why this could be happening and how can I resolve it?


texts: How to filter users based on user's profile field in ACL

texts:
I am new when it comes to drupal.I am using FlexiAccess for ACL. I have a long list of users and want to filter out users based on one of the user profile fields such as country_of_origin.

I am thinking to add a new combo "Country" and command button "Add Country" before "Add User" combo box to filter the users.

Should I use other modules to do that or there is a better way to accomplish that?


texts: I am wondering what is the best way to replace each of the internal links, e.g. 'Bookmark this' etc., with images?


texts: How do I print the node add form in block.tpl.php?

texts:
I am using Microblog. How do I print the node add form in a block?

I tried node_add('microblog'), but it doesn't work for me; then, I tried drupal_get_form('microblog_node_form'), but I am still getting nothing.


texts: How can I add the sku code in [commerce-order:commerce-email-order-items]

texts: While the shortcode [commerce-order:commerce-email-order-items] is used to send several commerce emails, it does not includes SKU code. How can I add sku code or edit the output of [commerce-order:commerce-email-order-items]


texts:
We try to deploy drupal application in our production server.we face this strange error
"Lost connection to MySQL server at 'reading initial communication packet', system error: 110" after deploying.we made all necessary corrections in settings.php and also give Grants to webserver to access DB in DB server. Webserver and DB server physically two different servers.

We are able to connect the DB server from web server through command line.Also no firewall enabled in both servers.any one guide me to resolve this issue.

Thanks


texts: How to drop all MySQL tables using drush?

texts:
Normally I could drop and create database from scratch, but what if user doesn't have permission to do that?

Also I wouldn't like to specify my credentials in the command-line (1. it's hard to type, especially complex passwords, 2. it's not safe as it get stored in shell history files and on the process list).

Therefore how I can drop all tables using drush?

Related:

How to drop all MySQL tables from the command-line?
MySQL DROP all tables, ignoring foreign keys


texts:
I'm trying to setup an alternate modules and themes directory which I can track with GIT separate from the contributed modules directory.

Following this question, I created a directory in the following structure:

/var/www/Mysite
       -sites/samplesite/modules/mymodule

mymodule was working just fine when it was based in sites/all/modules/custom/mymodule but once moved it was no longer listing on the modules page, nor the features page - mymodule is features generated.

I attempted the following directory structure:

/var/www/samplesite
       -sites/samplesite/modules/mymodule

But it's still not working.

Can anyone please help me with this problem?


texts: I get "/tmp is not writeable by the webserver" on migration

texts:
I migrate a Drupal website from Apache to IIS.All the image that customize whit ImageCach not shown and I get this error "/tmp is not writeable by the webserver"!
please help me soon!:(


texts: How to display $date in node.tpl.php using a preprocess function in template.php

texts:
I want to check if the node is not a static page, and display $date in "node.tpl.php" within this
:

I currently have this in my node.tpl.php file:

<?php print $date; ?>

I currently have this in my template.php file:

function thebridge_preprocess_node(&$vars) {
  if($vars['type'] != 'static_page') {
  }
}


texts: How to enable user search in Apache Solr?

texts: I have Apache Solr running on my site, but would like to get it to index users as well as nodes, so that a single search request will bring up matching users as well as nodes.  What do I need to do to make this possible?  I found some pages talking about installing the Content Profile module to create nodes corresponding to users, which solr could then presumably find, but Content Profile doesn't seem to have made the jump to Drupal 7.  Is something like this required, or will Solr just do this once I tweak some configuration step that I apparently missed?


texts: Content Type Fields, populate field with usable data when adding new content

texts:
Trying to build a site that majoritly just uses Views and data structures defined within Drupal itself (aka: almost no programming on my end, though if it boiled down to it I will)

Trying to make a Music Album manager. Each album is a content type, and each track is a content type. I have in the Track content type a field called "Album" as a drop-down list which I wish to populate with existing Album records.
Problem is, I have no idea how I'm supposed to do that..

Is there a method? is there a module? is there anything I can do? There must be a way somewhere, I would hate to have to drop the entire process here and start from scratch again


texts: What is the difference between the Trigger and Rules modules?

texts: Both the Trigger and the Rules modules provide many event-driven actions, but there are still several difference. What's the major difference between them? When should I pick one module instead of the other one?


texts: how to identify when a user is viewing their profile?

texts:
I'm relatively new to Drupal and have created a module that among other things uses hook_menu() to add a link to a user navigation "my gallery" this all works well except this link appears when a user views another user's profile. So what i want to do is add some code to tell Drupal not to display this link when a user is not on their own profile.

I'm guessing I need to change the access callback from user_access to a custom callback that carries out this check. Any help would be greatly appreicated.

My code so far is the following one.

global $user;
// get name of current user
$currentUser = $user->uid;
// get profile url
$profileUrl = arg(1);
// compare usernames to determine whether the user is on their own profile.
if ($currentUser == $profileUrl) {
  // user is on their profile, display link
  $profileUrl = "i'm home";
}
else {
  $profileUrl = "away";
}

$items['user/%user/gallery'] = array(
  'title'            => $profileUrl,
  'page callback'    => 'drupal_goto',
  'page arguments'   => array('gallery'),
  'access callback'  => 'user_access',
  'access arguments' => array('access content'),
  'type'             => MENU_LOCAL_TASK,
);

return $items;

The problem is it seems to get fixated, so if I start on the admin profile it correctly displays "I am home"; however, if I view another profile this doesn't change as it should. How can I fix this?


texts:
I have a custom module that provides a path that sends an email (mimemail) with a pdf attachment generated from the print_pdf module that comes with the print module.
Here is what my HOOK_mail function looks like.

function custom_send_email_mail($key, &$message, $params) {
  $node = $params['node'];
  $user = $params['user'];

  $message['subject'] = t($node->title.' attached');
  $message['body'] = 'Hello '.$user->name.'

Please find '.$node->title.' attached.';
  //$message['params']['attachments'][] = $attachment;

  module_load_include('inc', 'print_pdf', 'print_pdf.pages');

  $attachment = array(
    'filecontent' => print_pdf_generate_path($node->nid),
    'filemime' => 'application/pdf',
    'filename' => $node->title.'.pdf',
  );
  $message['params']['attachments'][] = $attachment;

}

The problem I have is that the pdf versions of pages use a template file, which works fine when navigating to the pdf version url, ie. /printpdf/nid but when getting the pdf file string with the (silly named) print_pdf_generate_path() function, it does not use the template file.


texts: How to get newly created node ID after Feeds importing?

texts:
I programmatically executed feeds importer to create new nodes. I have to set some fields programmatically after importing. I check the hooks in feeds.api.php, and didn't find a solution. Is there any way that I can get the newly created node ID by the importer?
Thanks


texts: Access argument string for all administrators to access menu

texts:
I have implemented a hook_menu method in a module i'm writing.

The problem i'm facing is, i'm not able to pass an access argument that grants access to all the administrators.

The only one able to access the page is the admin account that was made upon installation.

Any help would be appreciated. This is the code.

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

    $items['admin/config/people/raffle'] = array(
        'title' => 'Raffle',
        'access callback' => 'user_access',
        'access arguments' => array('administer site configuration'),
        'file' => 'raffle_admin.inc',
        'page callback' => 'raffle_abc_view',
    );
    return $items;
}


texts: Is there an easy way to call a migration from a controller for debugging purposes

texts:
I am trying to debug a migration and having issues getting xdebug to work with drush as I described in this issue.  Would there be an easy way for me to call a migration from a controller (I am able to text xdebug from browser)?

For example, I would like to debug this:

drush mi upgrade_d6_field_instance

I was thinking to create a custom module that adds a controller that I can call the migration from the browser. The only option I cant think of is to recreate a lot of the functions from migrate_tools in the controller but I feel like there has to be an easier way.


texts: How to theme view header Global: Text Area?

texts:
I'm trying to stick a flexbox in a view's Header Global: Text area and there's a wrapping paragraph tag that I'm trying to theme away. The views-view.tpl.php only has 'print $header' inside the 'view-header' div so the errant 'p' must be rendered into the $header variable.

I can trim the paragraph tags from the $header variable in template.php with a post render hook, but I'd rather modify a tpl file.


texts: Drupal 7 as an Oauth 2.0 and/or 1.0a provider

texts:
I am trying to make my Drupal 7 site a Oauth provider. I have found the Drupal modules for Oauth 1, yet I am having trouble with finding Oauth 2.0 provider modules and I am not sure that Drupal supports Oauth 1.0a.

I found this project at Drupalcode: http://drupalcode.org/project/oauth2.git it supports Oauth 2.0 for Drupal 6. While browsing to the repository I saw the tags: "7.x-1.x-dev" and "7.x-1.x-Rj" (don't know what this Rj stands for..) which made me very happy. So I checked out the code and put that, together with the latest http://code.google.com/p/oauth2-php/ in my Drupal installation. However when I wanted to enable the module in Drupal 7 and it says: "This version is not compatible with Drupal 7.x and should be replaced."

Furthermore, while implementing a OAuth-PHP client for my OAuth 1 setup, I found that Drupal does not return a "verified token". I read somewhere that this is implemented since OAuth 1.0a to fix a security bug. Does Drupal support OAuth 1.0a? If so what am I missing if I don't recieve a Verified token?

Has anyone got any idea if this module should work in Drupal 7? (the tags confuse me) and if not is there another module for Oauth 2.0 for Drupal?

Thank you in advance


texts: Sort 2 views in a page by 2 different ways

texts:
I have a simple view, i create a page and a block for view and place them in a page, but How can I sort them in different way:

View Page (sort with nid : asc)
- View Block (sort with nid : desc)
- How can I do this with php field (use with Views_PHP)

Have a nice day
THanks.


texts: Dynamic frontpage image changes every hour

texts:
I want to have a frontpage with images changing every hour. As it is the frontpage, the page is cached.
Can this be done with views?
I'm thinking of creating a views block which shows a random image but I'm lost on the refresh every hour part.


texts: There are no entities matching. BaseFieldDefinition entity reference error for taxonomy

texts:
My Code looks like this:
$fields['color'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Color'))
  ->setDescription(t('The color of the fruit.'))
  ->setSetting('target_type', 'taxonomy_term')
  ->setSetting('handler', 'default:taxonomy_term')
  ->setSetting('handler_settings', ['target_bundles' => ['Color' => 'Color']])
  ->setDisplayOptions('view', [
    'label' => 'above',
    'type' => 'author',
    'weight' => -3,
  ])
  ->setDisplayOptions('form', [
    'type' => 'entity_reference_autocomplete',
    'settings' => [
      'match_operator' => 'CONTAINS',
      'size' => 60,
      'autocomplete_type' => 'tags',
      'placeholder' => '',
    ],
    'weight' => -3,
  ])
  ->setDisplayConfigurable('form', TRUE)
  ->setDisplayConfigurable('view', TRUE);

I have a vocabulary with the name : 'Color'
I have 3 terms in it : 'Red', 'Yellow', 'Green'
The error I'm getting is this :

I'm trying to figure out what went wrong.


texts: Heartbeat - user delete comment from node -> delete also from heartbeat stream

texts:
I'm using Heartbeat to show activity on the site. When user post comment to the node Heartbeat activity stream shows that comment. But when user delete comment it does not delete it from the Heartbeat activity stream.

How to delete comment also from Heartbeat activity stream? This should be done of course automatically when user delete comment from the node.

Same thing for deleting nodes.

In the Rules there was no Heartbeat log delete possibility.


texts: Can't download files. Garbage code displays

texts:
I have  Drupal website and my users can no longer download files. (docx, xlsx, etc). In firefox only, when the user clicks a link to download a file the page displays garbage code.

I read elsewhere the solution is to add the following, but it didn't work. Instead, the user is prompted with a dummy download for the application type each time the page reloads.

drupal_set_header('Content-type: application/octet-stream; charset=utf-8');

I have a simple module which has a page that spits out the links to the files. In this module I added the above to the hook_init() function.

I've never encountered this problem before, and I'm not sure why it started. Any help would of course be greatly appreciated. If I find a solution before someone replies with the answer I'll post it here for future reference.


texts: What is your recommended Banner/Slider module for D7?

texts:
I am searching for module that create banner/slider effect for D7.

Have a check on this page:
http://drupal.org/node/418616

Mostly not yet port to D7.

What are your recommend modules?


texts: How to make 2 different code run acording to different cron schedule?

texts:
I have 2 different code running under hook cron like below:

function custom_module_cron(){

  // First here code run for posting nodes to Facebook pages
    (this should run for cron tab Ist )

  // Second code runs for sending new posted links in form of digest
     to users according to their selected hours. (This should run for cron tab 2nd )

}

For above process I have different cron tabs running on my server such as:

http://oexample.com/cron.php?cron_key=something7rsds

For Facebook at : 23:30,  23, 21,  and many more  hours

For Digest at : 7 , 8 , 10 and many more

How can we differentiate that each code run according to required hours.
Can we make different urls to run for different code  to prevent running of code at unwanted hours? I am using rough technique by using in_array for current time and hours in cron tab but thats very handy and I think its not solution.

Please suggest what I can do to make my codes run according to separate schedules ?

Thanks!


texts: Redirect the page after login with using modal form

texts:
I want to redirect the page after user login. for login i have using modal form.  I already use the Login designation module but its not working.
Any idea how do this?


texts:
I've got a view with a contextual filter for an entity reference field. The contextual filter fetches the current node id from URL as filter criteria. The individual rows of the view are rendered as content in teaser view mode (not using fields), so basically it uses node--nodetype--teaser.html.twig to render the results. The view is attached to nodes using the EVA module

I now need the value of a field from the host/contextual node in node--nodetype--teaser.html.twig (the template used by the views row). I know how to query entities and fields, but I don't know which hook to use and how to get the node ID of the contextual filter.

How can I get the contextual filter ID and which hook should I use to pass the contextual filter down to the node teaser template?


texts:
I'd like to assign a specific role when a new user registers on my site using the regular registration form, beyond that of just "authenticated user".

How can I do this?


texts: Register nodes seen in a view as not "new"

texts:
I have a view of nodes, the only place those nodes will be seen is in the view - never as individual entities. These are short "updates". When someone has seen an update, I no longer want it marked as "new" (as in drupal's 'content: has new content' functionality).

Is it possible to trigger whatever it is that makes entities 'read', but when that node is loaded into to a view on a page the user is viewing?


texts: duplicate order_number in commerce/orders

texts:
I have a shop implement with drupal commerce, I have a problem, I have 2 method on payment method1 and method2,
in payment step, when user select method1 and go to bank to pay,it has a order record in commerce/orders , when the payment with method1 not  successful in commerce/orders  ,status is processing, after payment with method1 not successful drupal come back to payment step and if user select method2  I see another record with same order_number in commerce/orders,
The problem is here when the  user accomplish payment with method2 ,  the 2 record status field will set to "completed" and manager of site dont understand finally by which method payment finished,

anybody know where is the problem and how can correct it?


texts: Change workflow transition state of translated node

texts:
I have a content node that has several translated nodes attached to it. My goal is to set the workflow transition state of translated nodes according to the state of the "original" node.

The problem is, that the "original" node properly changes its workflow transition state, but the translated nodes are untouched.

My code so far (called in a form_submit handler):

$entity= \Drupal::routeMatch()->getParameter('node');
$user = User::load(\Drupal::currentUser()->id());
$formToState = $form_state->getValue('field_workflow_state')[0]['workflow_transition']->getToState()->id();
$existingTranslations = array_keys($entity->getTranslationLanguages());
$currentLanguage = \Drupal::languageManager()->getCurrentLanguage()->getId();
$fieldName = 'field_workflow_state';
foreach ($existingTranslations as $translationAbbreviation) {
  if ($currentLanguage !== $translationAbbreviation) {
    $translatedEntity = $entity->getTranslation($translationAbbreviation);
    $currentSid = $translatedEntity->$fieldName->value;
    $transition = WorkflowTransition::create([$currentSid, 'field_name' => $fieldName]);
    $transition->setTargetEntity($translatedEntity);
    $comment = $form['field_workflow_state']['widget'][0]['comment']['#value'];
    $transition->setValues($formToState, $user->id(), \Drupal::time()->getRequestTime(), $comment, true);
    $transitionId = $transition->execute(true);
    $translatedEntity->$fieldName->value = $transitionId;
    $translatedEntity->save();
  }
}

The transitions seem to be executed correctly, but if I check, they are still in the old state.
Can someone point me to where the problem is?

Edit: I noticed, that I get several Warnings 'Transition is executed twice in a call. The second call for node 1 is not executed.' when trying to update the workflow state of all of the nodes translations. That could explain that the state of the translations doesn't update. But how can the workflow state of the translations be synced to the main (in this case english) one?


texts: Access values from multiple field forms as elements of one form

texts:
I'm trying to create entities from my custom form. To do that, I created "Add more" button, where I'm dynamically adding new elements that I'm attaching fields to by using:

field_attach_form('myentity', $entity, $form['wrapper']['myentities'][$key]['fields'], $form_state);

I would like to create entities in submit callback with field values from those elements.

The problem is, that when I have a multiple elements, inputs for the same type of fields of different entities have the same "name" attribute (eg. field_myfield[und][0][value]), which means that I can access only the value from the field of the last entity in the submit callback, which means that I cannot fill my entity with proper values before saving. I tried to put '#tree' => TRUE up the form tree, and unset this value on field level, but it didn't change an input name, and "values" structure.

How can I have in my submit callback access to all of the field values, so I could use them for creating entities?


texts:
i want to add custom class for each term

function sometheme_preprocess_field(&$variables) {
  if ($variables ['links']['#title'] == "Consulting"){
    // I'm lost here // how can i assign class here or even add a custom picture // Please help
  }
}


texts:
I am pulling my hair for the past half of the day trying to figure out what is wrong. Here is my hook_schema function:

<?php

function image_gallery_schema() {
  $schema = array();

  $schema['gallery'] = array(
    'description' => 'The main store for gallery entity',
    'fields' => array(
      'id' => array(
        'description' => 'Primary key for our table of gallery',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'uid' => array(
        'description' => 'User id',
        'type' => 'int',
        'not null' => TRUE
      ),
      'title' => array(
        'description' => 'Title of the gallery',
        'type' => 'text',
        'not null' =>TRUE,
       ),
      'created' => array(
        'description' => 'Creation time',
        'type' => 'int',
        'default' => 0,
        'not null' => TRUE
      ),
      'changed' => array(
        'description' => 'Changed time',
        'type' => 'int',
        'default' => 0,
        'not null' => TRUE
      ),
      'gall_description' => array(
        'description' => 'Description of gallery',
        'type' => 'text',
        'not null' =>TRUE,
       ),
    ),
    'primary key' => array('id'),
  );

  $schema['photos'] = array(
    'description' => 'For storing photos',
    'fields' => array(
      'id' => array(
        'description' => 'Primary key for photo',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'g_id' => array(
        'description' => 'Gallery id',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'full_path' => array(
        'description' => 'full photo path',
        'type' => 'text',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'short_path' => array(
        'description' => 'short photo path',
        'type' => 'text',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'img_description' => array(
        'description' => 'Image description',
        'type' => 'text',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array('id'),
    'indexes' => array(
      'g_id' => array('g_id'),
    ),
    'foreign keys' => array(
      'gid' => array(
        'table' => 'gallery',
        'columns' => array('g_id' => 'id'),
      ),
    ),
  );

  return $schema;
}

I checked all the brackets and everything seems to be in place. It does create gallery table, but fails to create photo table. Error I get:

  Syntax error or access violation: 1064 You have an error in your SQL syntax;

I was trying to see how gallery schema is different from photos but I can't find anything. Maybe something is wrong with indexes and foreign keys? I checked multiple examples and everything seems to be the same. If someone could help me out, I would be more thank thankful.


texts: Drupal 7 field widget - allowed values list

texts:
I need to have a select widget but with custom allowed values per user. Since in D7 I cannot use php code, I was wondering if there is some kind of hook I could use to achieve that functionality.

Thanks


texts:
What would be the best way to set up several nodes so that some of the content is linked to a single document stored on the server?
For example, I want a document that has some official rules on it and display it on several pages by only editing the source document.


texts: Render a field from an entity reference in twig template?

texts:
I have a node that has an entity reference field to a Media entity. That media entity has a field on it "caption". I want to render this caption directly in my twig template, so instead of doing this:

{{ content.field_media_item }}

Which would output the entire rendered media entity, I just want to output a field from that media entity. I've tried this:

{{ content.field_media_item[0]['#media'].field_caption.value }}

Which works, but since it's already rendered output, all the HTML from that value is escaped. So <p> tags appear as literal <p>. I could tack on a |raw at the end, which actually seems safe to me since I know the output has already been rendered and passed thru the field formatter, but seems wrong?

What's a better way of doing this? Using a pre-processor to access the field data from the reference media entity and passing it through a field formatter again or something? That actually seems inefficient since the caption field data was already rendered properly, and I'd be passing it thru the formatter again.


texts:
I am using the panels module and the mini panels modules.

I have mini panel with two section (left and right).
For my design, I want to add a picture on the left side of each section. These pictures are not supposed to come from any node or content, they are just pictures for design purpose only.

How can I do that?
If you suggest CSS, I will be happy to understand how?

I am a newbie, and building my first Drupal site, so I will appreciate any help.

Thanks.


texts: I have a drupal installation running in a vagrant virtual machine.  This works fine, but when I try to use Drush on this site I get very peculiar behavior.  The modules that are listed when I run "drush pm-list" are all from a non-existent Drupal 8 installation.  I have tried setting --root= and --uri= but to no avail.  Drush simply ignores my real Drupal 7 installation and instead outputs non-existent modules from a non-existent installation??


texts:
I'm trying to add a block to an existing panel. The dialog opens but then I see this error,

  The requested page "/panels/ajax/editor/select-content/panels_page_wizard:landing_page/bottom" could not be found.

and the ajax spinner never stops. The panel module is currently up to date, and google doesn't return any hits for the error.

I can create a brand new panel page, and the same problem occurs.


texts: How can I add a css class (.empty-panel-region) to Panel's regions that don't contain any panes?


texts: Views: display entity reference fields as view fields

texts:
I have a content type (1) with an entity reference field that point to another content type (2).

I'm trying to create a view where I want to display fields of content type 1 mixed with the FIELDS of the content type 2.

When I go to add fields in my view I can see the fields of content type 2 but the output is empty, the only thing I can do is display the rendered content type 2 with all of its fields.

Is there a way to output single fields of content type 2 as view fields?


texts: How to export custom entity using Features?

texts:
I am trying to export custom entity using Features module but I am not able to see anything under create features.

I have enabled exportable as TRUE in hook_entity_info.

I have already added entity_exportable_schema_fields() under my custom schema .


texts: Bind payments and auto return a certain amount of it with PayPal

texts:
I had the idea to create a Drupal site with the feature of bid wars between two users in a certain product.

User A and User B will pay the same amount of money which will be bind in the website. Then both users will have something like a mini game between them and when both users mark the war as finished, both amount of money will moved to one of their PayPal account. Except of a fixed fee percentage.

Example:

User A and User B pay 50$ each of them.
After their "fight", user B wins and he gets 100$ - 2% fee= 98$.

Is there any way to do this automatically with the PayPal module or with another indirect solution?


texts:
In a drupal8 module install file I have used drupal_execute() function like as follows

drupal_execute("content_copy_import_form", $form_state)

But this resulted in an error

  Call to undefined function drupal_execute().

Any solution?


texts: Feeds mapping to Entity ref by Entity ID not working

texts:
I’ve created a Feeds importer for a commerce product variation type. The product type is a commerce mp3 file. In it’s content type the mp3 refers to an album product. So in the Feeds mapping there is a target that reads ‘Album reference (Entity reference by Entity ID)’.

so far nothing has worked to get the mp3 product to refer correctly to it’s album reference. The album btw, is also a commerce product.

In my latest test example, the album name is ‘So Open’. I confess i’m not clear exactly on what an Entity ID is?! In looking at the Album on it’s Devel page i see the vid and nid are both 626.

my attempts have include the following:
’So Open’ -> error,
So Open (no quotes) -> error
626.

This latter 626 does not generate an error but also does not populate the field correctly once the product is created. That ref. is simply left blank.

Perhaps the problem is I don’t understand what an Entity ID really is.

Does anyone know what i should be putting there? and how to find out that product’s Entity ID?


texts: I am attempting to create/enable the UI to allow users to create translations in D8, and I need to create locales (e.g. en-us, en-gb, en-ca for English, es-mx, es-es for Spanish, etc). I've gone through the directions I've been able to find, and I am not seeing where to add specific locales after adding the base languages (at admin/config/regional/language). Or in the Translate tab on content items. Where do I go to enable specific locales?


texts: In Views how to configure a contextual filter to exclude the node being viewed?

texts:
I have the following setup: a content type (event) can have a "mother" event, which is configured as entity reference (Basically it's the same event on another date).

I have a view for a single event which is embedded in a panel pane and another view for the other similar events (with the same "mother") in another panel pane on that page.

This works pretty good, except when i try to filter out the event that is shown on the first pane from the second pane, so that this one isn't shown twice.

The view for the "related events" has a contextual filter of the nid and relationship to the "motherevent" which is set to "required".

Now you would say, check the exclude field for the contextual-filter. Yes, this works, but with a side effect: all other events not related to the "mother" are shown as well.

I feel like I have arbitrary tried all possible combinations of "set relationship" / required and so on, but with no effort. I even tried a second contextual filter of the nid with different settings... I don't get it.

Can someone please explain how this could be achieved? Thanks a lot!


texts: Get text_long field value with EntityMetadataWrapper

texts:
I am trying to get data from a text_long type field using EntityMetadataWrapper, and from what I'm seeing on the interwebs, I should be using something like this:

$wrapper->{$field}->value();

or

$wrapper->{$field}->value->value();

However, if I use the first one, I get an array with format and value keys, but if I try the latter, I get an Call to a member function value() on null` error.

Do I have to use $wrapper->{$field}->value(); and manually get the value from the array? Or is there a more direct method? I've looked through the class, I don't see another method that gets the value data.


texts: How to display the TID of a term reference field in a content type?

texts:
In Drupal 8, I have a blog content type with a taxonomy term reference field called category.

How can I print out the Term ID of the taxonomy term of the category field in my node.html.twig file.

I can print the term name using {{ content.field_category }} but I also want to print out the term ID which should be a unique number. How should I go about doing this as I have search for days without any clue?


texts:
I'm asking if it exists a drupal module that let you make a preview of a link like the Facebook do.

In another way a display format which it gives a preview.


texts: Meaning of "Query results" and "Rendered output" in Views cache?

texts:
Previously I've set the "Query results" and "Rendered output" cache to 1 hour.

What I need is:

Cache for 1 hour
Update the cache immediately when related node updated

But when updating node, it takes exactly 1 hour for the views page to be updated.

I'm quite confuse about what is "Query results" and "Rendered output"?

Is "Query results" the GET request?


texts:
composer global update

  Changed current directory to /home/ckosloff/.composer Loading composer
  repositories with package information Updating dependencies (including
  require-dev) Your requirements could not be resolved to an installable
  set of packages.

  Problem 1
      - drush/drush dev-master requires codegyre/robo ~1.0.0-beta1 -> satisfiable by codegyre/robo[1.0.0-beta1] but these conflict with your
  requirements or minimum-stability.
      - drush/drush dev-master requires codegyre/robo ~1.0.0-beta1 -> satisfiable by codegyre/robo[1.0.0-beta1] but these conflict with your
  requirements or minimum-stability.
      - Installation request for drush/drush dev-master -> satisfiable by drush/drush[dev-master].

The above is what I get when running composer global update.

Steps taken:

I updated composer to latest build via self-update
I added the line minimum stability:"dev" to composer.json

Drush is not getting updated to the latest version.
How can I solve this?


texts: Make a gmap view embeddable on another site

texts:
The website I'm building has a google map view. I want to provide a code snippet to site visitors to let them embed this gmap view on their own site. Does anyone know of a way to accomplish this in D7?

I saw this question over at the SO main site, but it appears to be D6-specific since Embed Widgets doesn't have a D7 release and Web Widgets only has an abandoned D7 release. So I'm wondering if there's another way to do this.


texts: Comparing entity against previous entity in views

texts:
Say my view lists people and their salaries using data from their profile..

Abby, 10000, O
Amelie, 10000, O
Alan, 15000, O
Ben, 15000, O
Bertie, 20000, O
Boris, 20000, O
Carl, 20000, O
Carol, 25000, O
Derek, 25000, O

How can I change the third column to an X when the salary changes?

Abby, 10000, X
Amelie, 10000, O
Alan, 15000, X
Ben, 15000, O
Bertie, 20000, X
Boris, 20000, O
Carl, 20000, O
Carol, 25000, X
Derek, 25000, O

I'm guessing I do it in hook_views_pre_render($view), but there are so many variables/objects in the $view, I don't know where to start.

I don't think it matters, but I'm using views_data_export to output this into a CSV.


texts: Where can I find the link between field answers and the user who submitted it?

texts:
Noob here. I can't figure out how entity forms stores which user submitted each answer for it's fields on the database.

All I can see is a table for each field, and the columns within being: Entity_type, bundle, deleted, entity_id, revision_id, language, delta & Field_(the name of my field).

None of which tells me which user submitted each answer. Yet drupal and entity forms clearly knows which user submitted each answer, because when I go to (Administration > Structure > entityform types > my form > form submissions) I can see a table of every submission with the name of each user who submitted it, and I can see all their answers.

So where the heck is this being stored on the database? If it matters, my database was built with phpmyadmin.

Thanks in advance for your help, I really appreciate it. I'm sorry if my terms are all jumbled and wrong.


texts: Is there any documentation for the UUID module?

texts:
I think I need to utilize the UUID module to make universal ID's for some taxonomy terms. However, after installing the module it doesn't seem to do anything and the configuration interface has only one button that does nothing.

I can't find any helpful articles, tutorials, or documentation for this module. Anybody have any suggestions?


texts: How to display menu bar over slideshow block?

texts:
On my site, I am not able to show menu bar over the slider block in content. When I click the menu over the slide image, part of it disappear under the slide block.

When I click on the Services menu, it shows odd things. This problem is not persist on IE.


texts: Changing the output order of Nodewords meta tags in head

texts:
I have a request to change the order that meta items are printed in the head using the contrib module Nodewords in D6.  More specifically the property would like the description to appear before the keywords (per their SEO consultant).

Is this possible?  Fruitless?  Stupid?

I have searched with no results so far.


texts:
I need to add a Javascript file only once immediately after logging in - which will open another URL in a new window.

Without using _SESSION what'll be the right place to add drupal_add_js function only once after logging in?

Is there a hook which is called in the very first logged-in page?


texts: admin approval required for specific roles registered using profile2_regpath

texts:
I am using profile2_regpath for registrations .

I have 3 roles. Students, Centers and Organisations. Is it possible to activate the users which are registered for Student role without admin approval ?

The users who registered for centers or organizations role must need admin approval.

Default "Account settings" in Drupal have the option to activate users without admin approval but I can not specify the roles there.

Any clue? or any other module which I should be using instead profile2_regpath


texts: Commerce Order Total Tax line via EntityMetadataWrapper

texts:
I need the final tax amount for an order found on the commerce order total. when using dpm and entity metadata wrapper i can't seem to break it out in order to grab the value.

$order = entity_metadata_wrapper('commerce_order', 3);
dpm($order->commerce_order_total->getPropertyInfo());


texts: If statement for page template in node template file

texts:
Is it at all possible to check for a page template NID before outputting some text in a custom node template file?

I have a custom node template file and I am using that data in a custom page template file. I have checked in the past the NID of a node using the following that that works:

          if (($node->nid) == '25732') {
            print views_embed_view('lead_view',"page");
          }

Now I want to check whether the page template file is 1234. I tried using $page, but I don't think that is right.

          if (($page->nid) == '1234') {
            **Stuff here**
          }


texts: Scroll to search results on Views Exposed Filter submit button

texts:
Hi I've made an 'Advanced Search' using Views + Display Suite in Drupal 7.

https://www.oldertenants.org.au/research-library-advanced-search

There's too many search filters so the default behavior of the submit button scrolling the user back to the top of the #content div confuses the user to think there are no search results.

How can I scroll the user to the results div instead (i'd also have to work out how to include a #results id in the results div) - or perhaps just not link to any div, simply refresh the results?

It would be ideal to achieve this using ajax but if its easy not a problem to be refreshing the page on search.

Thanks in advance for any suggestions!


texts:
I have a problem whereby any files uploaded into the private directory cannot be viewed - returning a 404 not found error. The images upload ok and get placed in sites/default/files/private directory. The image path when trying to view is in the form /system/files/image.jpg which I believe is correct.

Firstly I found that there are conflicts with the Fast 404 module. Disabling this module makes the private files now work on my staging server, but not on our live server.

Could there be any server-side settings that could be affecting this?

What else should I be checking?


texts: Backup and migrate backs up previous backup

texts: The backup and migrate when backing up my drupal site adds the previous backup to it which makes the backup twice the size of the original backup. How do I solve this as my backups keeps increasing in size?


texts:
I'm using an Entity Reference field (unlimited entries) and a View to include desired Beans on node pages. How can I create a view similar to node/%/backlinks which allows me to see all the nodes that reference a particular block?

So far, I have a View of Content. It includes a relationship to the Referenced Entity (Block) and a Contextual Filter on Block ID. I want to include this View as a menu item on the Block itself, but blocks aren't displayed with their BID, they use a transliterated version of the label as an alias.

I need to find a way to access the Block ID from the alias, or somehow expose a transliterated version of the Label through Views.


texts: Error 500 and WSOD after restoring backup

texts:
Good morning to all.
I'm totally new to Drupal and I'm sure this is a newbie question but...I'm stuck in a error 500 after restoring a database backup.
Here are the steps I have done:

Install backup and migrate plugin in the production site
Create and download a complete backup
Install Drupal 7 on my local machine
Create a drupaldb on mysql
Go to localhost/install.php and follow the wizard creating the same user I have in the production website
Activate the corporate theme
Activate all the plugins I need as the production website

Until here the website works perfectly. I can create content and translate it and see it normally.

Import the backup in my local installation using the same plugin.

And here the website breaks
I can access to localhost/es/user and see the login form, but I cannot login. i can switch to localhost/en/user and see the page rendered in english but I cannot login either.

Submitting the login form or trying to access to any other page in any kind of browser (tested with Firefox and Chrome) give me ERROR 500.
Nothing appears in apache error.log

I have repeated several times the process, even reinstalling apache but nothing works.
I double checked my files permissions (777 locally), and the apache, mysql and drupal versions (the are all the same in both environments)

I tried even with a manual backup of the mysql DB but nothing...

It seems obvious is something related to the content I import but I cannot discover what is because in the apache2/error.log nothing is written.

Any suggestion? Thank you

UPDATE

As I don't have yet enough reputation to answer directly in the comments I have to update my question.

My settings.php point to the right db (and the user has all the permissions)
The website is not a subdirectory
If I copy manually the contents pof a page (in the 2 languages) it works perfectly, so I suppose in not matter of a .htaccess misconfiguration
I tried (as suggested here) the opposite import flow too: follow the wizard, restore the db without enabling any module and.. it didn't worked. (enabling only B&M neither)

The only interesting thing I noticed until now is when I write localhost I'm redirect to localhost*/es.

And more, If I write localhost/es/?q=node/80 the url is rewritten correctly with the most friendly url localhost/es/productname but the page still gives error 500 and nothing is rendered.

SECOND UPDATE

I have created a virtual machine with vmware to build a new environment, in this way I can be sure there is nothing "dirty" in my apache or php or drupal. I followed this tutorial

Everything has gone well at first try until I restored the db. After that.. ERROR 500 again!


texts: Hundred of Thousands of database records and how to safely delete them?

texts:
Hi
I've been asked to work on a Drupal commerce site and I'm not very familiar with this module.

The idea is to use an existing database and export it to 'quickstart' a new site.
I'm to keep all the products but delete all the customers and transactions data.
But when I look at the DB of the existing site it's packed with hundreds of thousands of stuff that I don't understand.

The product catalog only includes 50 or 80 products or so but in the database I see an incredible number of rows in some of the table and I don't know how I can safely remove all this data without breaking the database. Here is what I see in php/myadmin:

field_revision_commerce_unit_price   ~210,219 InnoDB    utf8_general_ci 129.7 MiB   -
field_revision_commerce_total    ~211,353    InnoDB utf8_general_ci 128.7 MiB   -
field_data_commerce_unit_price   ~210,696    InnoDB utf8_general_ci 128.6 MiB   -
field_data_commerce_total    ~209,449    InnoDB utf8_general_ci 127.6 MiB   -
field_revision_commerce_order_total ~210,849 InnoDB utf8_general_ci 125.5 MiB   -
field_data_commerce_order_total  ~210,129    InnoDB utf8_general_ci 119.5 MiB   -
field_revision_commerce_product  ~210,384    InnoDB utf8_general_ci 82.5 MiB    -
field_data_commerce_product  ~210,384    InnoDB utf8_general_ci 81.4 MiB    -
field_revision_commerce_line_items ~211,257  InnoDB utf8_general_ci 81.4 MiB    -
field_revision_commerce_display_path ~210,521 InnoDB    utf8_general_ci 77.5 MiB    -
field_data_commerce_display_path ~210,521    InnoDB utf8_general_ci 76.4 MiB    -
field_data_commerce_line_items   ~210,393 InnoDB    utf8_general_ci 75.4 MiB    -
field_revision_field_dept_date   ~210,384    InnoDB utf8_general_ci 69 MiB  -
field_data_field_dept_date ~210,384 InnoDB  utf8_general_ci 68.9 MiB    -
commerce_line_item   ~211,134 InnoDB    utf8_general_ci 34.6 MiB    -
commerce_order   ~210,442 InnoDB    utf8_general_ci 34.1 MiB    -
commerce_order_revision ~212,036 InnoDB utf8_general_ci 26.1 MiB    -

I'm really lost here isn't there a quicker way to delete all the unnecessary data while keeping the product catalog intact?
Thanks


texts: When the line <?php print $page; ?> is encountered in the html.tpl.php template, what happens that make the page template (page.tpl.php) come into action?


texts: How to filter a view's attachment by clicking the links on the main view and using AJAX

texts:
I have a view listing node titles of a content type, using Views Accordion to group them by categories. And an attachment display attached to it which shows an individual node filtered by node id (exposed filter or contextual, I can use any of them).

What I want to achieve is, if I click on a title on the main view, the attachment should be updated via AJAX to show that node.


texts:
Examining for http headers, I mentioned the header "X-Drupal-Cache HIT".
I use varnish reverse proxy.

Is it necessary for this header to appear? Can I make it be ommited? If yes, how? Would that have negative implications?


texts: Simplify Panels "Add content to" popup with fewer options for end users

texts:
Echoing this unanswered question on D.O.

Is there a way to limit (and possibly reorganize) the Panels content types and panes presented to website editors?

Basically taking it from this:

To this:

I tried using some of the cTools API alter hooks, but no dice.  Any pointers?


texts:
I'm using the Services module for rest services.

Is it possible to add my custom namespace in rest XML output.


texts: How can I programmatically insert date field values?

texts:
I have a bunch of values from a .sql export that are in the datetime format (same format that date fields take in the DB). I'm creating nodes using these date values. How can I insert these values into the date field?

I tried:

$node->field_data_field_date['und'][0]['field_date_value'] = $datetime_value;

but it didn't seem to work. Any ideas? Thanks!


texts: Append current query string to private file urls?

texts:
If I use template_preprocess_file_link, can I add the current url query string and append it to the link per user? Will this link be cached for all users?

Update:

This appends it, but does seem to get cached:

  if (preg_match('/private:\/\//i', $file_entity->getFileUri())) {
    $query = \Drupal::requestStack()->getCurrentRequest()->query->all();

    if (!empty($query)) {
      $options['query'] = $query;
    }
  }

  $variables['link'] = \Drupal::l($link_text, Url::fromUri($url, $options));


texts: error when trying to clear the cache in drupal

texts:
I was going to use mailchimp module to create my newsletter but an error revealed saying that i should  install the version 2.0 of librairies, so i delete both modules, started again,that worked just fine .
When i went to  settings of mailchimp, this error revealed:

  1)Fatal error: Call to undefined function
  mailchimp_signup_entity_access() in
  C:\Users\user\Sites\devdesktop\drupal-7.37\sites\all\modules\entity\entity.module
  on line 657

So , i tried to clear caches ,another error revealed:

  2)
   i-Warning: Invalid argument supplied for foreach() in
  drupal_schema_field_types() (line 7159 of
  C:\Users\user\Sites\devdesktop\drupal-7.37\includes\common.inc).
  ii-Notice: Undefined variable: field_types in
  drupal_schema_field_types() (line 7162 of
  C:\Users\user\Sites\devdesktop\drupal-7.37\includes\common.inc).
  iii-Warning: array_keys() expects parameter 1 to be array, null given
  in drupal_schema_fields_sql() (line 7179 of
  C:\Users\user\Sites\devdesktop\drupal-7.37\includes\common.inc).
  and Recoverable fatal error: Argument 2 passed to
  SelectQuery::fields() must be of the type array, null given, called in
  C:\Users\user\Sites\devdesktop\drupal-7.37\includes\entity.inc on line
  317 and defined in SelectQuery->fields() (line 1301 of
  C:\Users\user\Sites\devdesktop\drupal-7.37\includes\database\select.inc).

 any help please!


texts: Get field value from inline entity form (multiple values)

texts:
Here is the situation:

1- I'm creating a content type.
2- I have an inline entity form (Multiple Values) in my content type.
3- My inline entity form asks a number (integer).
4- In my content type, I have a "computed field" too, that has to add integers given from entity nodes created in inline entity form into itself.

Please tell me how to get values from inline entities (multiple values).

Is there any "array" solution to get all of them?


texts: Is Drupal following W3C standards? How to change the DOCTYPE?

texts:
I tested two of my sites in W3C validator. One site passed the test and other site gave me lot of errors. Site2 was having the doctype -//W3C//DTD HTML+RDFa 1.1//EN instead of HTML5. But site1 was having HTML5.

How to change the doctype to HTML5 for Site2?


texts: HOOK_entity_presave: field not accessible

texts:
I have been brooding on this problem for a while now and i can't figure it out:

I am trying to retrieve and finally modify two values of my entity. With the first one (field_registro) it works, with the second one (field_final_note) it doesn't.

Both fields are of type Number (integer) with no restrictions.

This is how my hook looks like:

function mymodule_entity_presave(\Drupal\Core\Entity\EntityInterface $entity) {
  var_dump($entity->field_registro); // works
  var_dump($entity->field_final_note); // NULL
}

When i dump the whole entity i can see both fields (the second one should be empty and be set programatically, the first one has a user value).

See the dump here: https://pastebin.com/wcpyDt9h

I can see that there is clearly a difference in the structure, but i can't figure out WHY and HOW to fix it.

Can anybody point me in the right direction please?


texts: Remove header and footer of the page when export node to pdf using print module

texts: When I use the print module for export node to the pdf file are facing a problem that I could not handle that it automatically generates header and footer for my page pdf. I want to remove the header and footer of the page. Can someone guide me how to deal with it. Thank you very much.


texts: How to add a prefix - suffix to a view title

texts:
I am using Drupal 8. I want to add Prefix and suffix to view title.
I tired with following code but in result html is not rendering.

function Hook_preprocess_page_title(&$variables) {
$variables['title_prefix'] ='

';
$variables['title_suffix'] ='

';

}

Result

My Title


texts:
I have a view with horses for sale. I have another view with a filter of field_sold = yes.

Currently there are no horses for sale. I want to add a No Results Behavior "Currently we have no horses for sale."

I tried in Structure > View > Sold > Custom text (field) > NO RESULTS BEHAVIOR but I don't see the message?


texts: How to remove empty div created by routing.yml file by specified routes?

texts:
I have 2 routes

games.one:
  path: '/math/one'
  defaults:
    _controller: '\Drupal\games\Controller\GamesController::one'
    _title: 'My Title'
  requirements:
    _permission: 'access content'

games.two:
  path: '/math/two'
  defaults:
    _controller: '\Drupal\games\Controller\GamesController::two'
  requirements:
    _permission: 'access content'

Route games.one has _title and Route games.two does not have. Now the issue is When I access route game.two, It shows an empty div for title.

How to remove this empty div?


texts: "Questions that may already have your answer" Stackexhange Module For Drupal

texts:
is there a module for drupal
when you write a title to a question it suggest the answer i.e

"Questions that may already have your answer" on Stackexhange

Many thanks for your help


texts: How can we sort view result, depend on cookie set or not

texts:
I have created a view to display slideshow from specific content type.

Now I have a condition that if visitor is new then slideshow will sort according to custom field "slider order".
And if user visited already then slideshow will sort according to post date.

I have tried this from "hook_views_query_alter" but I want this to be done from view only.

I applied some custom sorting in views but not working (actually I have no idea about custom sorting in views)

Please let me know the conditions.

Fields: title, description, Image

Filter: content type= slider

Sorting: Post date (desc)   [here I need your help]


texts: Remove drag table in field collection module drupal 7

texts: Hihi. Hi all. I have a content type and in which I created a collection field using field collection module. I set the value for the field collection that is unlimited. In field collection including some certain fields. Then I proceeded to create content for this content type. I discovered that the field collection module enables drag row and show weight of the current row. Now I want to remove drag and drop function and the weight of that row without knowing how processing. Expect people to help me handle this problem. Thank all.


texts: Composer updating to 8.9.0beta2 instead of 8.9.0

texts:
I'm currently using the drupal/core-recommended project and I'm having issues updating to 8.9.0.

Some reason composer is updating it to 8.9.0-beta2.

Steps I took to update was go into my composer.json file and changed:
"drupal/core-composer-scaffold": "^8.8",
"drupal/core-recommended": "^8.8",

TO
"drupal/core-composer-scaffold": "^8.9",
"drupal/core-recommended": "^8.9",

Then ran composer install

Then it just downloads the beta version instead of the stable version.

Anyone know why?


texts:
I've been testing the various overlay modules trying to find a simple way to implement a very minimalist designed text I want to display when hovering over my logo img at http://stefanbjorklund.info/.

I'm using Zen 5.x theme

Here's what I want to achieve (see the left side under the logo, nevermind the background-color of the emaillink):


texts:
Hi [still new to Drupal]

Due to certain constraints I can't install drush. Am I able to work on Omega 4 without Drush? The organisation I work for has strict online security and firewall. I have a lot if issues installing drush. So I have decided not to install it and would like ti work on omega 4 without drush.

Does anyone have a good place to start, or can anyone point me in the right direction?

I'm look for tutorials, forums anything that can help. This has cost me time and now i need to hit the theme.

Please can you assist?


texts:
I need to do some stuff when the user clicks on the email link to validate his/hers account.

Is there a special event I could hook into or there is none and I should just use the login hook? Thanks.


texts:
On my Drupal site, I have a simple jquery file attached to the theme. This file is added in preprocess_node. The whole content of the file is as follows:

(function ($) {
  console.log("hello world");
  $('li').addClass('hello');
  $('div').addClass('hi');
})(jQuery);

Here is what happens when I run any Drupal page:

no javascript errors
the console shows "hello world "
in Chrome debug, div's do not have class "hi" and li's do not have class "hello"

I ran the same (without wrapper function) on jsfiddle for some basic html and the result was as expected, classes were added to div's and li's and can be seen in Chrome debug. So why is it not working in Drupal?


texts: How to store email sender info in message field using email contact module?

texts:
I am using email and email contact module. I added the field as following:

Front page displays as following:

When anonymous users enter name, email, subject and message, it sends email to recipient. However, recipient only gets the message from the Message field. recipient does not get any info on name, email, and subject.

I clicked the gear icon and i see the following:

Do I need to enter some token in the email body? If so, I have been struggling and not able to find out what tokens will go into the email body field so receipient will receive all the info.

In email body, I entered these:

  1[current-user:name] 2 [site:mail] 3 [site:name]  4[current-user:mail]
  5 [current-page:url].

In front page, I entered these:

  Name: john doe  Email: johnd@gmaidl.com    Subject:quote  Message:
  messsage body.

Recipient received these:

  1Anonymous 2 admin email 3 e-Shop | e-News 4 5 page URL

  message body

How can recipient gets what anonymouse user entered?


texts: A views page as “Output this field as a link” in a block (Drupal)

texts:
Hello I´m trying to get a link from my thumbnails gallery http://www.nellens.com/home/photos to the full size gallery http://www.nellens.com/home/photos-full for each "Photo" content type that I have, but when I put the node (I tried with 2 methods, first creating a text field where I put the URL and another following this tutorial drupal.org/node/1215544, so I put in this case [counter]), but nothing overwrites my output link, it always lands to /content, showing all the fields of my content type, and I just want to show my full size pics fields only, not all the fields. My content type is made by a thumbnail image, the full size images that have relation between them and a tag field. So I did create all as in the FAQ tutorial but when I try to overwrite the thumbnail in the block to show the relative images and to land to the page /photos-full, it just does not work, it always lands me to /content.

Thanks in advance.


texts:
I have the following params in settings.php to connect to an external database .

$databases['d8243']['default'] = array (
  'database' => 'drupal8',
  'username' => 'root',
  'password' => '123123',
  'prefix' => '',
  'host' => '192.168.1.243',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

And am using the following code to access some data from the db .

\Drupal\Core\Database\Database::setActiveConnection('d8243');
$query = "Select * from node__field_target_config_controller";
$result = db_query($query);
$obj = $result->fetchObject();
echo json_encode($obj);
exit;

My current server and the external db server are in a same network .

But am geting the following error :

  exception 'PDOException' with message 'SQLSTATE[28000] [1045] Access
  denied for user 'root'@'192.168.1.245'      [error] (using password:
  YES)' in
  /var/www-drupal/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php:149

Is there a different method to connect to remote db in D8 ? or how to do it ?

When i checked d6/d7 versions have an option to specify remote db like

$db_url = 'mysql://username:password@quranschools.org/databasename';

how to do this in D8 ?


texts: Where do I add a new cache context for an entity?

texts:
I have not been able to get adding a cache context to work for entities in drupal 8.  Specifically I'm going for headers:User-Agent. I tried many variations on the following in a module.

 use Drupal\node\NodeInterface;
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\Core\Entity\Display\EntityViewDisplayInterface;

 function hook_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display){
   if($entity->getType() == 'relevant_type'){
    $build['#cache']['contexts'][] = 'headers:User-Agent';
   }

 }

I'm trying to get node access to be checked when that context changes. I have also tried it in the hook_entity_build_defaults_alter() function.


texts:
I have below code in:

{% set img_url = item.image.url ? item.image.url : {{ base_path ~ directory }}'/images/default.png' %}

Twig file. How to make it work so it will take full default image path?


texts:
Apologies in advance for the long message but I am very new to Drupal and really have no idea what I'm doing sowill try to explain. My company has there website built in Drupal 7, we have a module installed which allows us to create single page blogs. What we'd like to be able to do is also create blog posts that can be split over multiple pages (if we choose).

As an example, if the user clicked on a particular blog post from our blog page they would be taken to the first page (as they currently do), then, at some point on the page we would like to have a next button which takes them to the second part of the blog post. Then on page 2 they would have the 'previous'/'next' buttons and so on.

I have tried installing a module called Smart Paging which looked like it would do the job, however I cannot for the life of me get it to work. Here is a breakdown of what I have done:

I've installed the module
Enabled it
Selected the 'Default page break method' as 'manual'
Amended the 'text formats' so 'Convert line breaks into HTML (i.e. < br > and < p >) for Smart Paging compatibility' is ticked
Unticked 'Convert line breaks into HTML (i.e. < br > and < p >)'
Added '' to the 'Limit allowed HTML tags' list
Move 'Smart Paging' up underneath 'Body' on Administration » Structure » Content types » Blog entry
Changed the format setting to 'Show Smart Paging settings during content editing of this content type'
Added '< !--pagebreak-- >' to a blog post

I have done all of the above but the blog post still just shows the text that I have written all on one page with no 'next'/'previous' buttons. I'm hoping I've just missed something simple which someone could kindly point out to me.

Thanks in advance.


texts: When can I, and when I can't rely on other module's classes to be loaded?

texts:
I'm writing pluggable system. For a given name, I want to test if there is defined class pluginActionName. If it is, I want to create an instance of it. If it's not, I want to create an instance of pluginAction (parent class for all pluginAction* classes). That's the easy part, and Drupal unrelated.

Difficult about Drupal is to know when classes are defined. Can I rely on class_exists

in my .inc code outside actual class? no?
in initializers for static properties? no?
in static methods of my class? sometimes?
in dynamic methods of my class? yes?
in helper functions that will be called by methods? only if it would be OK in method?

In italics is what I figured out so far, but I'm not sure about this and I cannot figure out exact loading order to tell why it's the way it is reliably.


texts: Set the Contextual Filter: Author uid. to a default user?

texts:
I have a view called Map Items showing a list of map markers in a chart.

Info: I have 3 Accounts in my drupal installation called person1, person2, and admin.

I've set the contextual filter to Author uid: User ID from Logged in user. and its working perfectly, but what I want some additional setting that when there is no logged in user I could set person1's map item to show. Right now when there is no logged in user the view shows the map item of admin user and not person1.

How am I going to accomplish this?


texts: Can't get Zgadzaj marketplace to install properly - checkout pane settings not in place

texts:
Whenever I enable marketplace on a fresh kickstart 1.x install, the checkout pane settings are not in place. The marketplace "Marketplace: Payment" and "Marketplace: Off-site payment redirect" are disabled right out of the box and I'm unable to place them in the right position. I followed the instruction here http://zgadzaj.com/commerce-marketplace-installation-and-use-cases and I have installed this module before so I'm not sure what the problem is.

My step of installation is

Install kickstart
enable entity reference
enable marketplace modules

That's all I did but the checkout pane setting is never in place. Everything else looks fine. The merchant role is created, I'm able to add stores, and setup PayPal for each store. Just the checkout pane is not in place. What am I missing?


texts: What are best practices for supporting and upgrading a list of contributed and custom Drupal module?

texts:
My organization has made the decision to build the next version of our website on Drupal 7 with the assistance of a consultant. The consultant will be responsible for the initial build and supporting the modules required by their functionality.

We will be responsible for supporting and upgrading the contributed and custom modules we install.

We anticipate the module list will be fairly long and management of module responsibilities will become an issue. We’re trying to come up with an easy way to track the modules installed on the site and whether they are the responsibility of the consultant or us. In a perfect world we would also be able to add notes as to why a particular module is needed.

Anyone know of anything already out there that would allow us to do this? We've looked but came up empty.


texts: Trying to save an image field on a user using services, but for some reason it isn't saving in base64

texts:
So my server (running Drupal 7) is getting this information:

[field_picture] => Array
    (
        [und] => Array
            (
                [0] => Array
                    (
                        [file] => iVBORw0KGgoAAAANSUhEUgAAAIwAAACMCAYAAA..... (the rest of a huge base64 string)
                        [filename] => test.png
                        [filemime] => image/png
                        [target_uri] => test.png
                        [filepath] => public://
                        [mimeType] => image/png
                    )

            )

    )

This is to a user endpoint, and this is the only field that doesn't update.

The rest of what is sent to the server looks like this:

[field_description] => Array
        (
            [und] => Array
                (
                    [0] => Array
                        (
                            [value] =>
                            [format] =>
                            [safe_value] =>
                        )

                )

        )

[uid] => 22
[roles] => Array
    (
        [2] => authenticated user
    )

And my AJAX to put this up:

    $.ajax({
        url: SITE_URL + "/" + ENDPOINT + "/user/" + localStorage.uid,
        type: 'PUT',
        crossDomain: true,
        headers: {
            'X-CSRF-Token': token
        },
        contentType: 'application/json',
        data: JSON.stringify(json),

...etc

The request doesn't fail (or at least it doesn't go to my error callback) - what is going on here and why isn't it saving?


texts: How do I change the style used by the "Archive" view to show the dates?

texts:
By default the "Archive" views module displays the dates as "May 2011." I want to change them to "2011 year May."

How do I do that? Is it possible?

from the instructions of googletorp: i made the following but it's not work. what's wrong with my code?

created a module named customviews. which have files(customviews.info, customviews.module, customviews.views.inc)
customviews.module has code:

    <?php
      function customviews_views_api(){
        return array('api'=>2);
      }

function customviews_views_data_alter(&$data) {
             // Set the argument to the handler you named above.
             $data['node']['created_year_month']['argument']['handler'] = 'custom_handler';
           }
customviews.views.inc has code

 <?php
   class custom_handler extends views_handler_argument_node_created_year_month {
     function construct() {
       parent::construct();
       $this->format = "Y year M month";
     }
   }

i have cleared the cache.

i put the function customviews_views_data_alter(&$data) into the .module file. it's still can't work. what's wrong with it?


texts: Migrate field collection to paragraphs and split into multiple paragraphs

texts:
I'm migrating a Drupal 7 site with field collections to Drupal 8 paragraphs, but I'm having some issues setting up the migration.
In Drupal 7 I have a News content type with a multi-value field_paragraph field collection field, which contains a lot of field. Based on the filled-in fields, I would like to create a paragraph or split them into multiple paragraphs during migration.
The field collection contains these fields:

field_paragraph_title
field_paragraph_body
field_paragraph_images
field_paragraph_quote
field_paragraph_cta_body
field_paragraph_cta_image
field_paragraph_cta_link
field_paragraph_attachments
field_paragraph_video
...

If field_paragraph_body is not empty, I should migrate to a text paragraph; if field_paragraph_quote is not empty, I should migrate to a quote paragraph; if field_paragraph_images is not empty, I should migrate to a gallery paragraph; and so on.
In the Drupal 7 site, in one field_collection item it's possible almost all fields are filled in. So during the migration I should split them into multiple paragraph items, but they will share the same original item_id. Will this give issues?
I'm confused and it's not clear on how to start with this.
On the Drupal 8 side, I have an Article content type with field_paragraphs.
I tried creating separate migrations for each combination, but it didn't work.
What is best practice for migrating these field collections?
This field is used on the News node type:

Here are the fields which are currently in the D7 Field collection:


texts:
I am trying to create a custom entity with user manageable bundles with very little luck.

I have been using a couple of other modules that do this very successfully like field collection and the latest version of the invite module.

Very simply, there is an event entity which has multiple types. The user should be able to create and manage these multiple types - similar to how users can create and manage multiple field collections.

My entity info is as follows:

function enf_entity_info() {
  $return = array(
    'enf_event' => array(
      'label' => t('ENF Event'),
      'entity class' => 'ENFEvent',  // defined - simple
      'controller class' => 'ENFEventController', // defined - simple
      'base table' => 'enf_event', // defined
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'event_id',
        'bundle' => 'event_type',
      ),
      'bundle keys' => array(
        'bundle' => 'event_type',
      ),
      'view modes' => array(      // I don't expect to need these
        'full' => array(
          'label' => t('Default'),
          'custom settings' => FALSE,
        ),
      ),
      'bundles' => array(),
      'label callback' => 'entity_class_label',
      'uri callback' => 'entity_class_uri',
      'module' => 'enf',
      'access callback' => 'enf_event_access',  // simply returns TRUE
      'metadata controller class' => 'EntityDefaultMetadataController',
    ),
  );

  $return['enf_event_type'] = array(
    'label' => t('ENF Event Type'),
    'entity class' => 'ENFEventType', // defined - simple
    'controller class' => 'ENFEventTypeController', // defined - simple
    'base table' => 'enf_event_type', // defined
    'fieldable' => FALSE,
    'bundle of' => 'enf_event',
    'exportable' => TRUE,
    'entity keys' => array(
      'id' => 'type_id',
      'name' => 'event_type',
      'label' => 'label',
    ),
    'module' => 'enf',
    // Enable the entity API's admin UI.
    'admin ui' => array(
      'path' => 'admin/structure/enf-event-types',
      'file' => 'includes/enf.admin.inc', // includes the form functions
      //'controller class' => 'ENFEventTypeUIController',
    ),
    'access callback' => 'enf_event_type_access',
  );
  return $return;
}

the bundles are then added in in the alter

/**
 * Implements hook_entity_info_alter().
 */
function enf_entity_info_alter(&$entity_info) {
  foreach (enf_get_types() as $type => $info) {
    $entity_info['enf_event']['bundles'][$type] = array(
      'label' => $info->label,
      'admin' => array(
        'path' => 'admin/structure/enf-event-types/manage/%event_type',
        'real path' => 'admin/structure/enf-event-types/manage/' . $type,
        'bundle argument' => 5,
      ),
    );
  }
}

The admin page seems to work - however, there are manage fields and manage display menu options on the page itself. These go to a

/admin/structure/enf-event-types/manage/%25event_type/fields

and
    /admin/structure/enf-event-types/manage/%25event_type/display

and there are notifications displayed and saving and such errors out.

It is possible to add types - the form is displayed and creates a new type on submit.

However, when clicking through the fields or display links, a 404 comes back

/admin/structure/enf-event-types/manage/test/fields
/admin/structure/enf-event-types/manage/test/display

It seems like it should really be very simple to do this but something is missing.

Any assistance greatly appreciated...


texts: In hook_form_alter how can I attach libraries on frontend only?

texts:
I'm trying to attach a js file to a form using hook_form_alter() but I don't want to js to be loaded on the administration template.

How can I achieve something like this? With what do I need to replace the THEME != ADMINTHEME part in the following code snippet?

/**
 * Implements hook_form_alter().
 */
function MYMODULE_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
  if (($form_id == 'node_CUSTOM_edit_form' || $form_id == 'node_CUSTOM_form') && THEME !== ADMINTHEME) {
    $form['#attached']['library'][] = 'MYMODULE/myLib';
  }
}


texts: How can I modify the code in taxonomy feature to include terms

texts: I have created a feature to export my taxonomy vocabulary.  How can I programatically modify it to add the terms as well ?


texts:
Im scraping a website, where the images has no extension, like:
http://www.website.com/image/media/42633

If i manually create a node at put the above link in external image link, via filefield sources, its fine.
The file is downloaded and inserted correct.

But if i use Feed and insert the same link, i get the error "The file 42633 has an invalid extension"

Is there any way i can make Feed, ignore the extension ?


texts: How to add a textbox in views filter criteria

texts:
There is a view in my site that has filter criteria. I need to add an extra textbox in views filter criteria then based on its value, remove some of the results.

This textbox is not in any of the fields of the view. The views_php module add a PHP field to both the fields and the filter criteria, but it doesn't create a textbox in filter criteria.

How can I do that?


texts: Accessing translation and language URL from hook_preprocess_menu()

texts:
I have setup language and translation in Drupal8 that affects my URL for example

myurl.com/ru
myurl.com/us
myurl.com/fr

What I need to do if find out which country is being accessed so I can add a variable to the twig theme layer

This is the hook that is working fine

/**
 * Implements hook_preprocess_HOOK() for menu.html.twig.
 */
function pnc_preprocess_menu(&$variables) {
    $code_to_access_language_url = 'this is a test';
    kint($variables);
    $variables['access_translation'] = $code_to_access_language_url;
    //print $code_to_access_language_url;exit;
}

I have found that under kint() there a lot of public methods for  translation but I am not sure how I access them or which one to access. I know I could regex the url, but there has to be a cleaner way to do it?


texts: Ubercart - different payment gateway settings per product

texts:
i want to be able to set one product as UC_CREDIT_AUTH_ONLY, meaning no charge will be made now. in the admin i can only change this setting globally, meaning that all my products will be charged UC_CREDIT_AUTH_ONLY. How can i get this to work only for one?

currently i'm using paypal website pro as gateway, but if i have to, i'll switch to athorize.net.

using drupal 6 + ubercart 2

Thank you.


texts: Lingotek Translation showing interim status for every translation

texts:
I am working with lingotek module in Drupal 8 and I am following all the procedures but still facing some issues on local setup.
The automatic translation is taking place and it is displaying interim status every time after the translation is done, which is a state where incomplete translations can be published.

So, the translation part is not fully completed. I have followed the steps on fresh installation but still getting nowhere.


texts: How do I remove the “submitted by” text on Views in drupal 7

texts: How Can I remove the "Submitted by" Text on Views in drupal 7. I know How to do this on pages, webforms. but how on views?