texts: Data Export Import modules total nodes storage limit problem

texts:
I import Mysql into Drupal 7 site using Data Export Import.

The progressing importing showing error message:

  Processed 263 (0 created, 0 updated, 263 failed, 0 ignored) in 27.8
  sec (568/min) - continuing with '1cf4f3dbbFile'

  Processed 260 (0 created, 0 updated, 260 failed, 0 ignored) in 27.3
  sec (571/min) - continuing with '1cf4f3dbbFile'

  Processed 258 (0 created, 0 updated, 258 failed, 0 ignored) in 27.5
  sec (564/min) - continuing with '1cf4f3dbbFile'

  Processed 253 (0 created, 0 updated, 253 failed, 0 ignored) in 27.5
  sec (552/min) - continuing with '1cf4f3dbbFile'

  Processed 255 (0 created, 0 updated, 255 failed, 0 ignored) in 27.4
  sec (558/min) - continuing with '1cf4f3dbbFile'

When it finished running, the nodes are not completely imported. Only 20-30% nodes are imported.

My Drupal 6 has 110,000 nodes. Would it cause the error?

Because I saw this information in the module note.

This release has been heavily tested on a Drupal 6 environment. Nodes with up to 140MB of attached files were exported and re-imported

If it is the problem to cause the error, how should I increase the nodes storage?


texts: Attaching Google PHP Library to custom module

texts:
How do I use an external PHP package in my own module?

This is the one I want to use: https://github.com/googleads/googleads-php-lib

I have some questions

Where should i put the library?
Where should i declare the library?
Should i include something like use

Thanks in advance


texts: How to make Posts/Blogs mentioning a user appear in the user's profile?

texts:
I'm using Drupal 7 and I created a simple page where users are able to create challenges and tag people in their posts. For tagging I used the Mentions module and it works fine, I'm able to visit tagged person's profile.

Now I'm trying to add all the posts/blog entries that are associated with that user to the user's profile. So that every time the user is mentioned, that post would appear on the user's profile.

Is that possible to do? If yes, what would be a possible approach?


texts: How to create a custom content type with a form

texts:
I have created a custom form. How would I go about creating a content type which calls the form? I have read several tutorials on creating content types, but I do not see how to include my form inside of them.

I am using drupal 7

Thanks in advance


texts: How can I display/hide a div based on taxonomy term value on node.tpl.php file?

texts:
I am not a dev, but am trying to show and hide a div for on a particular node type node.tpl.php file based on taxonomy term value.

can someone please let me know how to do this.

*I AM ADDING THE ANSWER HERE AS I AM NOT ELIGIBLE FOR ANSWERING *

I have a div which prints the taxonomy value of a node (where 30 is the vacabulary ID):

    <div class="node-r-status-tid-0 <?php print $term_css;?>">
        <?php print THEME_NAME_taxonomy_list($node, 30); ?>
    </div>

Below is the PHP code to make the dive show and hide:

    <?php
    if ($node->taxonomy[868])
      $tid = 868;  // This should be the taxonomy term id that you want to theme on
        foreach ( (array)$node->taxonomy as $term ) {
          if ( $term->tid == $tid ) {
            $term_css = " node-r-status-tid-" . $term->tid;
            break;
          }
        }

    if($node->taxonomy[869])
      $tid = 869;  // This should be the taxonomy term id that you want to theme on
        foreach ( (array)$node->taxonomy as $term ) {
          if ( $term->tid == $tid ) {
            $term_css = " node-r-status-tid-" . $term->tid;
            break;
          }
        }
    ?>

Using css classes I make the dive display:block or none.

Please let me know if the above code can be fine tuned further

Thanks,
Anand


texts: create a page view to have only one specific content type show

texts:
I'm using D7 and I am working on a blog page. I have created a content type called News, I created a view called News as well.

I want to firstly create a page, all the content that the type is News will be shown on this page, but not other content type.

I can't find where to specify content type in the view settings. Both CONTEXTUAL FILTERS and FILTER CRITERIA seem only have all the content, but how do I specify content type?

Thank you!


texts: Wrapper for each row in Views from custom module

texts:
I created custom module with Views style plugin, there I have some fields to configure this style and in separate inc file I have preprocess to store these settings and use values in Twig template file, so I have this:

<?php

/**
 * @file
 * Theme for Example views.
 */
function template_preprocess_views_view_example(&$variables) {
  // View options set by user.
  $options = $variables['view']->style_plugin->options;

  // Update options for twig.
  $variables['options'] = $options;
}

In templates folder I have views-view-example.html.twig file and everything is working very well.

Now, I want to wrap each result from Views (row) and need to create template file for this. At the moment I don't see any wrapper there, just fields directly.

Seems like I need to define my template file to override default views-view-fields.html.twig template file.

How I can do that in my module? Do you have some example of it?


texts: URL path to view with certain filters selected is altered by Drupal when used as a menu link

texts:
I have a view with different filter options. I need to create some links to the view that will automatically select certain filters simply by following the link.

If I copy the url created on the view page when you chose a filter, and then past the url into a new browser it works. The page loads with the same filter selection chosen.

  mysite/resources?tid%5B%5D=22&tid%5B%5D=23&tid%5B%5D=24&tid%5B%5D=25&tid_1%5B%5D=26&keys=

Howeve when I try and use the url as a menu path it doesnt work. It links to the page but without the filter selected. When I edit the path I can see that Drupal has changed it:

  resources?tid%255B%255D=25&tid_1%255B%255D=26&keys=

Ho can I stop Drupal changing the path so the links works as I want it to?


texts: omega 4 can't import external libraries Primary tabs

texts:
I am learning to work with omega 4, but I have problem with importing external libraries. I am using PhpStorm and it shows that it cannot resolve import.

source 'https://rubygems.org'

group :development do

 # Sass, Compass and extensions.
 gem 'sass'                    # Sass.
 gem 'sass-globbing'           # Import Sass files based on globbing pattern.
 gem 'compass'                 # Framework built on Sass.
 gem 'compass-validator'       # So you can `compass validate`.
 gem 'compass-normalize'       # Compass version of normalize.css.
 gem 'compass-rgbapng'         # Turns rgba() into .png's for backwards  compatibility.
gem 'susy'                    # Susy grid framework.
gem 'singularitygs'           # Alternative to the Susy grid framework.
gem 'toolkit'                 # Compass utility from the fabulous Snugug.
gem 'breakpoint'              # Manages CSS media queries.
gem 'oily_png'                # Faster Compass sprite generation.
gem 'css_parser'              # Helps `compass stats` output statistics.

# Guard
gem 'guard'                   # Guard event handler.
gem 'guard-compass'           # Compile on sass/scss change.
gem 'guard-shell'             # Run shell commands.
gem 'guard-livereload'        # Browser reload.
gem 'yajl-ruby'               # Faster JSON with LiveReload in the browser.

# Dependency to prevent polling. Setup for multiple OS environments.
# Optionally remove the lines not specific to your OS.
# https://github.com/guard/guard#efficient-filesystem-handling
gem 'rb-inotify', '~> 0.9', :require => false      # Linux

end

Could anyone help me with this? Thanks for all answers.


texts: How do I create a summary that is grouped by years first and then months in Views using contextual filters?

texts:
Instead of the default formatted result of «Created year + month»:

 - Diciembre 2014 (12)
 - Noviembre 2014 (20)
 - Octubre 2014 (23)
 - ...
 - Diciembre 2013 (13)
 - Noviembre 2013 (34)

I would prefer something like:

2014
 - December (15)
 - November (14)
 - October (12)
 - ....

2013
 - December (19)
 - November (21)
 - October (13)
 - ....

I'm using Drupal 7.


texts: How to change display mode based on result count (using grouping field)?

texts:
I need to create a view similar to below -

Term 01  // has more than one node associated

Teaser A
Teaser B

Term 02 // has only one node associated

Full node C

Term 03 // more than one associated node

Teaser D
Teaser E

I guess 'View (Display) mode' should be the one to rescue and I have also found a solution that uses 'hook_views_pre_render' to change the view mode dynamically (see - http://www.webomelette.com/drupal-views-pre-render-alter-display), when not using grouping by field.

However, the above solution does not work when grouping these teasers by field, since the $result->count is already set to the total number of results returned. Any ideas to solve this would be appreciated.

-gnat


texts: Menu block is not being displayed on the front page

texts:
I'm using the Menu Block content type to provide a list of the secondary level menu items down the left hand side of the website.

it works perfectly other than on the front page where I can't seem to make the menu Block display.

I'm using a Theme heavily based on Bartik (just with logos and colours changed), I can't find a specific front page template and have no idea what else to do.

I have changed the site configuration to use a basic page as the Home Page (but with this or the default home page it still doesn't work.

Anyone got any suggestions please?

Dave


texts: Is there a way to avoid anonymous user can see a node of a specific content type?

texts:
Is there a way to avoid anonymous users can see nodes of a content type, like a block or a view?

I can control the access with a view, but if I know the link for a node, I can  see it without first logging in.


texts: Is there a Drupal API function to get the list of nodes by type?

texts:
Is there a Drupal API function like node_load() that will return a list of nodes by a given type?

I've tried $nodes = node_load(array("type" => 'student_vote')), but it only returns one node.

I know I could code up something like node_load(), but I wanted to see if there might be anything like that out there already.


texts: Is there a MRSS module for drupal 6? I have been asked to create a mrss feed of a site video content. This will enable AOL to access all the videos of the site via mrss. Will I have to create a custom module to achieve this?


texts: How to avoid "The form has become outdated" after login in separate tab

texts:
I've read this and this and I can't see how to apply that to my situation, so asking another question.

not-logged in user visits a page with a form on it.
User opens a new tab and logs in.
User switches back to their first tab and tries to submit the form.
Gets the outdated error.

How can I accept the anonymous form submissions once logged in?

In my application it's quite possible that the user has quite a few pages open in different tabs before they log in.


texts: "syntax error, unexpected end of file" Upon enabling modules

texts:
I'm getting a syntax error when enabling modules.  This is happening intermittently and it isn't specific to any module in particular, which is making it impossible for me to track down.  Here is the error I'm receiving today:

  Parse error: syntax error, unexpected end of file in sites/all/modules/contrib/headerimage/headerimage.module on line 821

Line 821 is the very last line of the file, and the syntax looks fine to me.  When I get a similar error when enabling modules, it's always complaining about the last line.  There are never any missing brackets.  I've disabled any custom modules I wrote thinking that it could be my code causing this, but I've had no success.

I was wondering if anyone has run into this, if they have any suggestions, or possibly a method to troubleshoot this.

-- EDIT --

I was able to resolve the syntax errors for this particular module (headerimage).  I had to delete the very last line in two of the files and re-add them manually.  They were closing brackets "}".

I'm not convinced that this is the correct fix.  Maybe it's some kind of encoding issue?  Any thoughts?


texts: How to create a new properties to $node (or $user and so on)

texts:
I would like to add a properties to the node object (or user, file, etc).

I know that I can use a field, but it could be useful to do this.

Which is the way?

Thanks,
Sergio


texts:
I've looked at the core search module, and from what I've been able to tell so far, it searches on the body of a node.

What's the best way to get a search feature for a site that will search on specified fields of a content type?


texts: Variables / settings configurable in Admin UI?

texts:
I need a simple way to make some custom variables / settings configurable for an Editor in Drupal 8. They are not related to Drupal, only to the custom project. For instance, the editor shall be able to set an Affiliate ID that will be used in the external links of the site.

In Drupal 7, I would have used Variable: I would have defined some variables and they would have been editable under admin/config/system/variable.

Since Variable has not been ported yet to Drupal 8, I am looking for a simple way to get this done in D8.

One idea I came up with was to define some "Magic Nodes", like node/1 for my first variable, and then use its title to set the value. However, that looks very hacky and unintuitive to me.

Do you have any better idea?


texts: How can I list the users who are associated with a given Profile2 profile using Views?

texts:
I have a site that has an Organization content type. Each organization has an associated Profile2 profile that contains a reference to a Taxonomy vocabulary depicting the hierarchy of the organization. When users register, they are presented with the given Profile2 profile associated with the organization they belong to.

I am creating a report in Views that needs to display the following:

Organization

Hierarchy

User

I can establish a relationship between the organization and the Profile2 profile, and the profile and the taxonomy. However, I cannot find a way to establish a relationship between a given Profile2 profile and the users who are associated with that profile. Does anyone know if I should be able to establish this relationship, or is it going to require some custom Views code?

Or, if anyone has a better suggestion on how to create this hierarchy, I'm open to suggestions.

Thanks!


texts:
I'm looking for a group/community/post that can help guide me on the best practices for site building in Drupal 8.
I'm at a reasonable level for site building already but are seeking to share thoughts and ideas on best practices and the best way to build.
Anyone got any ideas?


texts: I'm getting errors from trying to upload images from 2 different fields, server or module issue?

texts:
Using Drupal 7 and Siteground hosting, when I try to upload images at registration I get this error, but randomly.

  An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size (128 MB) that this server supports.

The form has 2 image fields, a multiple upload and the standard user image field. Sometimes it works, sometimes doesn't work with both fields.

What could be wrong, hosting issue or module issue?


texts: Displaying Sub-content Types for RESTful Views in Drupal 8

texts:
I have two entities (Content types in Drupal 8), foo and bar, for which I've added basic RESTful views, /foo and /bar. These work fine.

I've also added bar as field in the foo Content type (a foo may have many bars), and when doing a GET against the /foo RESTful call, I see this:

[
    ...
    field_foo_children_bars [ ],
    ...
]

...but I do not see any of the fields from any of the bar objects that have been added to the parent foo.

What is the standard and natural Drupal way of displaying the sub-content type's fields in a RESTful call?


texts: Dynamic Payment Method required Input Field for Ubercart Checkout

texts:
I have a site running with Drupal 7.12 and Ubercart 3.0. I am creating a custom payment module which is used to pay by mobile phone. The workflow is:

User enters his mobile phone number in the checkout page
When he clicks on "verify phone number" he gets an SMS with a PIN which he has to enter in another input field.

The PIN field is a required field, but only if this specific payment option is chosen.

I know that i can add additional information by returning an instructions array in my callback method, like this:

function uc_my_payment_method($op, &$order) {
    switch ($op) {
        case 'cart-details':
            $build['instructions'] = array(
                '#markup' => t('Your mobile phone') . ': ' .
                     /* some markup for the new input fields */
                    '<br />'
            );
            return $build;
    }
}

But i am stuck at the form elements. Can you help me? Do you need additional information?


texts: Prevent Search Results Being Truncated - Drupal 7

texts:
Is there a way to prevent Drupal from truncating the search results?

That is, I do not want the search results shortened with a "..." added to the end of the result. I would like the full text.

Cheers in advance.


texts: configuration error directories not present

texts:
I am brand new to trying to create a web blog so I am hoping you can help me get started. I haven't been able to find answer online.

My status report has this error.

Configuration directories   Not present
Your sites/recoverypractices.dd/settings.php file must define the $config_directories variable as an array containing the names of directories in which configuration files can be found. It must contain a sync key.

I don't know what thes sync key is but I did find a sync folder here D:\Sites\devdesktop\drupal-8.2.5\core\modules\field\tests\modules\field_test_config
I found the following code in my settings.php file but I don't know exactly how to fill in the array or define the sync key.

@code
$config_directories = array(
CONFIG_SYNC_DIRECTORY => '/directory/outside/webroot',
);
@endcode
*/

Can you assist me in figuring out how to fix this error?

Thanks,
David


texts: How to save content created by selected roles in an external database?

texts:
My Drupal 7 site needs to have articles, faq, pages, blog (not confirmed) and forum. But client can't store any data coming from front end. It can include the registrations from front end. That data need to be stored on external database and admin and users will access that data from the drupal site.

More specific, if user add comment or topic in forum, it should be saved in external database, and if admin adds a page from admin, it should be saved in local database. Moreover, even registration done from front end, needs to saved in external database

I suggested that we can use complete database externally which can be done easily but suggestion is rejected. Anyone can tell me any solution?

Note: the only solution I can think of is to create a custom module and use hooks for database functionality where I will check which content type is been called (means create, read, update and delete) and depending on that I will switch the database execute the query and return the data. I need to confirm which hooks I need to use.


texts: Print title of block group to allow for collapsible group

texts:
Currently I am working on a site where I need groups of blocks which should be collapsible. The blocks are grouped by using block group module. For the collapsible part I am using collapsiblock.
By default the block group is rendered in a simple div, which I change by applying a template to add the title. But the title is not available as a variable, because block group module uses the title field only for administration and thus the $title variables are all empty.

Does anybody know how to access the variable in a template file?


texts: How do I actually get a field value using field_view_value()?

texts:
I simply want to get the value of a field and have been told I should use field_view_value.

To this affect I have created:

$field_text_items = field_get_items('node', $node_context->data, 'field_text');

$field_text_items_value = field_view_value('node', $node_context->data, 'field_text', $field_text_items[0]['value']);

But running dpm($field_text_items_value); just returns an array with:

#markup (String, 1 characters ) h
#access (Boolean) TRUE

I'm assuming, because my field's value begins with a 'h', the #markup is only returning the first character for some reason.

Running dpm($field_fcc_text_items[0]['value']); returns the correct result so I know thing field is fine.

I've looked at the documentation linked above, but to be honest a lot of it doesnt make sense.

Would anyone be able to point me in the right direction here?

Thanks

As a side question, why is field_view_value() preferable to just using something like $field_text_items[0]['value'] anyway?


texts: Applying a particular sort case for a content type only

texts:
I'm using ApacheSolr (Solr 4.0) with Drupal 7. I'm implementing search on 8 content types, and I need to alter Solr functionality for a specific content type, Articles. In articles, there are 2 fields: Category (textfield) and Weight (integer). The Weight field exists in all content types, while the Category field exists only for articles. I have altered ApacheSolr query to change the sort order so the result is first sorted ascending by Weight field and then by relevancy.

This was done using hook_apachesolr_query_alter() and the following code.

$query->addParam('sort', 'weight');
$query->addParam('sort', 'score');

Now I want either one of two solutions, when user searches a string.

Only Articles content type should be sorted in the following order.

SOLUTION 1

First according to if string exists in category field and a term reference field
Then according to weight field
Then according to relevancy

SOLUTION 2

First according to if string exists in category field and a term reference field
Then according to weight field
All other fields shouldn't be taken in consideration(means they should be omitted) except the above 3 fields

I want to implement either of the above solutions. But can't figure out any method for implementation.


texts: Auto-populate tagging without adding terms

texts:
We wish to allow users to tag content using an auto-populate widget for taxonomy terms but not be able to add new terms. We are currently using the autocomplete term widget. Permissions available for this field are:

I see that if I disallow a role from being able to create new terms, they also aren't able to see the widget. I read somewhere that I can use Entity Reference to accomplish this but am not sure how.


texts: Create Multiple Custom Modules - Not Working

texts:
I have written this schema for creating 2 tables in my custom module.install

    <?php
function my_registration_form_schema() {
    $schema = array();

 $schema['myuser'] = array
(
      'description' => t('The table containing users who have signed up for the chance to register.'),
      'fields' => array
        (
        'id' => array
        (
        'description' => t('Primary Key ID'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        ),
      'first_name' => array
        (
        'description' => t('User\'s First Name'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        ),
      'last_name' => array
        (
        'description' => t('User\'s Last Name'),
        'type' => 'varchar',
        'length' => 255,
        ),
        'email_address' => array
        (
        'description' => t('User\'s Email Address'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        ),
        'user_country' => array
        (
        'description' => t('Country name of user'),
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        ),
        'user_city' => array
        (
        'description' => t('City name of user'),
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        ),
      'address' => array
      (
        'description' => t('User address'),
        'type' => 'varchar',
        'length'=>600,
        'not null' => TRUE,
      ),
      'gender' => array
      (
        'description' => t('User gender'),
        'type' => 'varchar',
        'length'=>10,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array( 'id' ),
);

    $schema['userdata'] = array
    (
      'description' => t('The table containing additional data about user.'),
      'fields' => array
      (
        'id' => array
        (
        'description' => t('Primary Key ID'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        ),
      'subscribe' => array
      (
        'description' => t('User Subscription'),
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'dob' => array
      (
        'description' => t('User date of birth'),
        'type' => 'varchar',
        'length'=>15,
        'not null'=>TRUE,
      ),
      ),
        'primary key' => array( 'id' ),

    );

  // Return the Table Schema
  return $schema;
}

When I had only one table, myuser, it was working good.
Now Its not.. What is wrong with code.
Please Help


texts: How to show text fields from a User object to anonymous users without "View User Profile" permission?

texts:
I have a few basic fields on the user object to display "Author Bio" cards at the bottom of articles. It seems that anonymous users cannot see any of this information.

All I want to do is show first name, last name, phone number and email address. Is this hidden away because it requires "View User Profile" permission? How can I get around enabling that? I don't want to enable that if I don't have to. Conversely, how I can prevent anyone from getting to user/* pages?

Is there something I can change in the render array to change the access check?


texts: How to add a report an error button in a Drupal 7 website and collect user's browser details?

texts:
We just did a website upgrade. On some sites I have seen a 'Report an error' icon (in the right hind corner). After clicking on it, a user can report an error which will send along other information about their system like OS, the user's browser and what link they were on when the error occurred.

Question: Any suggestions on which module to use for it and/or how to add such 'Report an error' to the website?

Update: I am looking for something like whatismybrowser.com, which can be added like a button or tool.


texts: Webform with conditional pages that contain required elements

texts:
Drupal 8 - Module: Webform ( https://www.drupal.org/project/webform )

I have a web form design that starts with three buttons at the top. Depending on which one is clicked, the form changes. One page is common to all three and all three have an extra page which is specific to itself only.

The pages which are specific to a button has elements which are "required".

I initially built the web form as three separate web forms and the buttons at the top simply redirected to the correct web form. The problem here is that the common page ("About you") had to be recreated 3 times and also resulted in the submissions been split across three separate sections.

In the current Drupal 8 version of Webform, hardly any of the libraries that extend it are not available for Drupal 8.

What would be the best way to integrate this web form into a single form. Hiding/showing sections can be done easily enough using simple CSS and/or jQuery but the issue is that if a section of the form which is hidden has a required form element, on submission the form validates falsely.

Is there are a way to conditionally turn off the required status of an element based upon the buttons selected at the top?


texts: Translating of menu item creates new menu item

texts:
I have installed these modules concerning menu translation:

Entity Translation Menu - entity_translation_i18n_menu

Menu Translation - i18n_menu

For now, when I translate a menu item, a new  - translated menu item is created and I need to set weight and parent to this new item again.

How to achieve, that when I translate menu item, no new menu item is created? So I will just translate one string - the visible title?


texts: drupal 7 file upload not updating latest file

texts:
When I upload a file for the first time, it would use the same name as the one on my hard disk. If later I modify the file contents but keep the same name and upload it again, drupal adds a suffix like "_0", _1" and so on.

Later when trying to get the real file name saved I only get the file name with suffix "_0" even though the latest uploaded file was named "_3".

what could be wrong?

Regards


texts: Alternative to Views PHP - Best way to use View Handlers for a field in a view?

texts:
I have been using Views PHP in my views to compute fields but things have been a bit unstable as my site grew and PHP code logic extended.

Hence, Views PHP is not an option anymore. Even at the site, this is what's written

  …it is highly advisable to use regular handlers and plugins when
  available (or even to create one yourself). Take note that filtering
  and sorting a view using PHP always has a considerable performance
  impact.

I am therefore looking to implement PHP code for a field in a view. What I am hoping to do is that for any specific field of a view, I could implement PHP in it through hooks/handlers (just like Views PHP) to change the output of the field.

I'd be grateful if you could direct me to some tutorial or any assistance here.


texts: turn off wysiwyg for full html filter format?

texts:
How do i set it so that the wysiwyg doesn't turn on during full html mode.

I would prefer to hand edit the html during full html filter mode without the wysiwyg editor stripping my html.

I'm using CKEditor.


texts:
What's the best way to get access to the current path in Views?

My use case is I want to use the current page path in a text area (i.e. I want to have a text field like More).

At the moment I'm handling it by using hook_views_re_view to rewrite a "Global: Custom Text" field value with drupal_get_path_alias().

Ideally I'd like something more portable, i.e. the ability to add a "Global: Current Path" field to my view.

What combination of hooks/handlers/plugins do I need to use?


texts: How can I change view data after the query is executed but before it's output?

texts:
I tried hook_views_pre_render but it's not acting as I would have expected.  What I'm doing is taking the view data after it has been executed, looking at the result, and then changing the result.

function field_collection_views_views_pre_render(&$view) {
  if ($view->name == 'my_fc_slideshow') {
    $current_page = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
    $parsed_url = parse_url($current_page);
    $path_components = explode('/', $parsed_url['path']);
    // Is this the drafted or published revision?
    if ($path_components[3] != 'draft') {
      dpm($view);
      $results = &$view->result;
      $node = menu_get_object();
      foreach ($results as $delta => $result) {
        $correct_fc_vid = $node->field_carousel_slides['und'][$delta]['revision_id'];
        $published_fc = entity_revision_load('field_collection_item', $correct_fc_vid);
        $view->result[$delta]->_field_data['item_id']['entity'] = $published_fc;
        dpm($view);
      }
    }
  }
}

When I dpm the view before and after the changes it does show the correct information in result, however what is on the page does not reflect the change.

The reason I am doing this is because field collection views will not show the published revision, only the latest one, be it a draft or not.  When making a normal node view, it will only show the published version.  On both views, any filter for revision does not take unless it's either the published or latest revision depending on which view you're in.

I have tried solving this with patches on field collection, workbench moderation, and field collection views, and even a sandbox module, but none of these solutions has worked.

So how can I get hook_views_pre_render to work as I need, or, is there a better views hook to do this with?


texts:
I have installed Message Subscribe module. But I am not sure how to configure this. I also have installed all the required modules. I can see the Message Subscribe UI but there is nothing I can configure.

Does anyone have any experience with this?


texts:
I am using drupal 7, I want to show the two columns of image with previous and next button on the top. The previous and next button will be used to show the grid format images. I can tried with views grid format, but how can i show the previous and next link of the view? Thanks in advance.

Regards,
Sathish


texts: How to find out the combinations of Views arguments that have the most Views result

texts:
I have a node view with 2 arguments in URL my-view/%1/%2.

Both arguments %1 and %2 are Taxonomy Term ID.

I would like to make a page that lists the number of the View result per argument combination and order them by the number of the result.

For example, Something looking like this:

  %1 |  %2  | Resulst
  10 |  20  | 13
  10 |  21  | 7
  13 |  21  | 5

Is there anyway to make this kind of page?

My goal is to find out what the top 20 combinations of the 2 arguments that have the most nodes attached to.


texts: Drupal 7 and CSS - How to have a default style for links without affecting other css styles?

texts:
I'm theming a Drupal 7 website using Bootstrap and a sub theme that I have put together. I have used CSS to design some of the menus. For this I have included code in the overrides file so as not to hack the original Bootstrap file.

Here's an excerpt from the CSS file to customize the look of a menu.

#block-menu-office li {
  display: inline;
  list-style-type: none;
  padding-right: 20px;
  font-size: 1.1em;
  font-style: bold;
  text-decoration: none;
  text-transform: uppercase;
  padding-right: 0.1em;
  padding-top: 0.1em;
}

This works well.

Now I want to customize how links on the website look like. For some reason they seem to be black with no underline. I want them blue with an underline.

When I add this code, the links do turn blue and show up with an underline. However the menu items also get underlined.

a:link {
    color: red;
}

How do I alter the default appearance of the links without affecting how the menu items look? I added a class to the CSS and used this class in the CKEditor when adding the link to the node. However this seems tedious. I would prefer to have a default appearance or alternatively a default class assigned to each link within the node when it is being created. Thanks!


texts: How to create a unit test for a class which uses a trait?

texts:
Simple as this:
class A {
  use StringTranslationTrait;

  public function something() {
    $b = 1+2;
    $this->t($b);
    return $b;
  }
}

I would like to unit test the something() method, but I can't since the StringTranslation trait uses a static container call:
Drupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$containe is not initialized yet. \Drupal::setContainer() must be called with a real container.

What do you suggest?


texts: Warning: Invalid argument supplied for foreach() in omega_layout_load_theme_assets() (line 454 of omega.inc)

texts:
I am using Omega 4. Have created a subTheme with two layouts, home and subsite. In Panels (3), I am creating new default site template variants (which all use the subsite layout), each variant has its own name and variant-specific content.

I get the following error: Warning: Invalid argument supplied for foreach() in omega_layout_load_theme_assets() (line 454 of ../sites/all/themes/omega/omega/includes/omega.inc).

Any help would be greatly appreciated.

amy.


texts: Help me to understand what element_child() does

texts:
Can anybody help me understand what element_child is doing?

It is called as element_children($form) where form contains keys like "cancel", "submit" and "#redirect".

This snippet from common.inc

/**
 * Check if the key is a child.
 */
function element_child($key) {
  return !isset($key[0]) || $key[0] != '#';
}

/**
 * Get keys of a structured array tree element that are not properties (i.e., do not begin with '#').
 */
function element_children($element) {
  return array_filter(array_keys((array) $element), 'element_child');
}


texts:
Currently when I search for something it displays the title of the node and if there is a match a small excerpt from either the content short summary or a small excerpt from the paragraph bundle. If there is no match it displays nothing.

How can i change this so it displays content even if only the title match. How can i change this so it displays the date it was published as well.

The modules involved are paragraphs, solr, searchAPI, Display Suite.


texts:
My aim is to make a view of 20 sentences. The problem is all of them sit in the same Input-field and I really have no plans to open 20 different text-fields, i.e one for each sentence...

Is there Any way I could make a grid view of these 20 sentences easily from 1 input field? Thx.


texts: Choose multiple products with Commerce product bundle module

texts:
I'm testing Commerce product bundle module to achieve my requirements. Is it possible to choose multiple products for the product reference of the product bundle ?

I created a product type with a product reference field, but in the node view I can only choose one product from a select box. I want to choose multiple products with chekboxes. Is that possible ? Where it can be configured ?


texts:
When viewing a node, I'd like the Title to display below one of the other fields in the Content Type, but it's not available to arrange in the Manage Display tab.

With all of the flexibility and power that Drupal gives me, do I really need to create a custom template for each of my content types? :(

Any help is appreciated!


texts: How to do you modify the URL created by a module?

texts:
I have a module that creates a list of taxonomy terms. This is the module.

    function theme_jl_custom_category_list($vars) {
      $items = array();
      foreach (taxonomy_get_tree($vars['vid']) as $term) {
        $attributes = array();

       $query = new EntityFieldQuery;
       $query->entityCondition('entity_type', 'node')
         ->fieldCondition('taxonomy_catalog', 'tid', $term->tid);

       if ($result = $query->execute()) {
         $nids = array_keys($result['node']);
       }
       if (isset($_GET['category']) && $_GET['category'] == $term->tid && $_GET['q'] == 'list-product') {
         $attributes['class'] = array('active-category');
       }

       /** How can I append &product=[$nid][0] to this? **/
       $items[] = l($term->name, 'list-product', array('query' => array('category' => $term->tid), 'attributes' => $attributes));
      }

      return theme('item_list', array('items' => $items, 'attributes' => array('class' => array('jl-custom-category-list'))));
    }

In my template.php file, I have the following code.

function [THEME]_preprocess_page(&$vars) {
  $vars['category_list'] = theme('jl_custom_category_list', array('vid' => 3));
  // …
}

In my page.tpl.php file I display the list with the following code.

<?php print ($category_list);  ?>

Combined, they create a list of links like the following ones:

http://example.com/list-product?category=12
http://example.com/list-product?category=14
http://example.com/list-product?category=17

I'm trying to modify these two pieces of code so that in the URL of each category I can append something like '&product=(ID OF FIRST NODE IN EACH CATEGORY)' in the URL to change the links to the following ones:

http://example.com/list-product?category=12&product=5
http://example.com/list-product?category=14&product=10
http://example.com/list-product?category=17&product=8

How can I modify the URL created by that module?


texts: How to silently prevent Webform spam (specific names, email addresses)?

texts:
I am using Webform on Drupal 8; I have a few spambots that fill out the exact same form in the same way every day.

I want to do some kind of validation that automatically blocks these postings.  For example, if the name given is "Spambot 1", I want to discard the webform submission automatically.

Drupal 7 has the Webform Validation module but this has not yet been ported to Drupal 8.

I found a code snippet on adding custom validation to a webform element, but this seems to be for providing helpful errors to allow the user to re-submit the webform, whereas I want to make it seem like the form was submitted but silently discard the submission.


texts:
I've build a website using Drupal 7 (7.34 now) and used quite a lot of modules (CiviCrm, Views, Panels, Webform, etc). I recently put this site live at my hosting provider and now I'm experiencing huge variations in page load times (Time to first byte).

When I enable caching for anonymous users, the page load times are pretty stable (200ms). But when I turn of caching the load times are varying from 1.5 sec to 30 seconds. These huge variations seems to come in periods over time,with a couple of minutes interval.

I've already tried several things to find the problem:

My first suspicion was the performance of my hosting provider, but I'm pretty sure this is not the problem. I've created a PHP benchmark script and executed this while the responses for my website were slow. But the benchmark did still return the same results.
I've used the Profiling module to see if I could find a bottle neck, but it looks like all things are taking more time and not only 1 part.
I've used the Devel module to check the SQL queries, but there wasn't any taking a longer time then normal, when I experienced the slow response.
I've disabled the Update manager, as this could stall page loads, but without success.
I've checked for not properly (un)installed modules, but they are all OK.

It is also not related to any specific page, but all page requests are slowed down when it happens. I never saw any (PHP )error and finally the page will always load properly, but only with a huge delay.

When the slow down period occures, it looks like there is something holding up every page request. Maybe some locks on something??

As the site also has to perform for users logged in, caching for anonymous users is not a good solution. Of course there are several other caching solutions possible for logged in users, but I want to solve the cause of this problem. And not using work-arounds....

Can anyone advise me or has suggestions to find and solve this problem?

Thanx!


texts: Group entitiy queries for a specific content type using Taxonomy Term

texts:
Using Drupal 8 entity query I'm trying to figure how I can fetch values from a specific content type and group them that are associated via a specific taxonomy term.

As seen in the screenshot below I have an entity field called Group Schedule that is currently binded to a Taxonomy Term. Is there way I could group those entities that are assigned to a specific taxonomy?

Group Schedule Name (field_group_sched)
First Schedule (field_created_date)
Second Schedule (field_created_date)

Group Schedule Name 2 (field_group_sched)
First Schedule (field_created_date)
Second Schedule (field_created_date)

So far I've managed to fetch the values from the Schedule Content type

// Entity Query for Schedule Node Type
$scheduleType = $query->get('node')
    ->condition('status', 1, '=')
    ->condition('type', 'schedule')
    ->condition('field_associated_programs', $nid_degree, '=')
    ->sort('created')
    ->execute();

foreach ($scheduleType as $key => $program) {

    $programNode = _nodeLoad($program);

    $variables['schedule_content'][$key]['schedule_group'] = $programNode->get('field_group_sched')->value;
    $variables['schedule_content'][$key]['schedule_name'] = $programNode->get('field_schedule_name')->value;
    $variables['schedule_content'][$key]['schedule_date'] = $programNode->get('field_created_date')->value;

}

{% for program in schedule_content %}

{{ program['schedule_group'] }}

    {{ program['schedule_date'] }}

{% endfor %}


texts:
We are trying to apply a patch to a core module using Applying patches after updating Drupal core to 8.5.6. When running patch -p1 < patchname-issuenum-version.patch command, we get the following.

We tried entering /core/modules/some/path/file.php but that did not work. I ran the command from the /core/modules/some/ directory, which is the module's root folder.

How do we resolve the File to Patch issue?

$ patch -p1 < patchname-issuenum-version.patch
(Stripping trailing CRs from patch; use --binary to disable.)
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/core/modules/some/path/file.php b/core/modules/some/path/file.php
|index cb2e5754a..12354789 11111
|--- a/core/modules/some/path/file.php
|+++ b/core/modules/some/path/file.php
--------------------------
File to patch:


texts: Drupal Forum - Users unable to post correctly

texts: I am using drupal 6.  The forum (core-optional module) I am using contains 3 containers.  Where I run into an issue, is that the authenticated users are unable to post their forum topic into one of the containers.  The drop down box listing the 3 containers does not appear.  If they select the container from the main page of the forum and choose "New Topic", they can submit a topic, but their topic will not appear on the forum, till the admin goes in and edits their post and assign it to the correct container.  The admin is able to post correctly with out issues.  I attached a picture of the admin screen and user screen.  How do I get the users to post correctly?  Thank you in advance.


texts: How to get higher weight range for vocabulary

texts:
I found the line in the taxonomy.admin.inc, but i didn`t want to change it in the core. So, How can I get it in my module to override the #delta of the vocabularies?

With the function I didn`t get a solution:

function <MYMODULE>_form_alter($form, $form_state, $form_id) {
  if ($form_id == "taxonomy_overview_vocabularies") {
    foreach ($form as $vocabulary) {
        if(isset($vocabulary['weight']['#delta'])) {
            $vocabulary['weight']['#delta'] = 20;
        };
    };
};


texts: hook_views_pre_render() doesn't get all the values in pager view

texts:
I am using views_pre_render hook to edit the result of the view.

My view has a pager system and so the $view->result doesn't give the full list of results. If the pager is set to 10 items, only 10 is obtained in the pre_render.
Is there any way I can get the whole set of results?

Any help is much appreciated.

hook_views_post_execute() Also gives only the per page set of values.

thanks.


texts: LIghtbox2 hide header and footer regions

texts:
I had created a lightbox which contains the node title and body content. But it shows the Admin bar of drupal , Header and Footer regions. I want to remove these from the lightbox and showing only the content of node on lightbox.

I am using Lightbox2 module for  this.


texts: Drupal 7 : Limit number of records in a view and then render programmatically

texts:
The question is similar to this one :

Views programmatically limit results

But i still cannot limit number of items in my view. The ways i already tried :

$args = array();
$view = views_get_view('news_details');
$view->set_display('default');
$view->display_handler->set_option('items_per_page', 3);
$view->execute();
print $view->preview('default', $args);

$view = views_get_view('news_details');
$view->set_display('default');
$view->set_items_per_page(3);
$view->execute();

$view = views_get_view('news_details');
$view->set_display('default');
$view->set_arguments(array('all'));
$view->is_cacheable = FALSE;
$view->display['default']->handler->options['items_per_page'] = 3;
$view->display['default']->handler->options['title'] = $title;
$view->display['default']->handler->options['display_options']['use_pager'] = FALSE;
$view->execute();

Whatever i am doing :

$view->result always returns 1 item
$view->preview() always returns all items

According to the answer above it seems like i need to apply this method to pager, not view, in this case how do i get access to this pager, could somebody provide working example of how to correctly limit items in view?

Got it :

I had "Display Items" set to "Display All" in pager settings of my View. It, according to Views, does not allow to filter view rows.


texts: I have upgraded to PHP 7.1 on my local dev environment and my Drupal 7.59 site with CiviCRM 5.1.2 seems to be working just fine. I can't find any issues. I am wondering if there is a way in the CLI to check the compatibility of all enabled contrib modules or if I need to look each one up and/or just test extensively to see if anything isn't working.


texts:
I am very new to drupal, so, sorry for my basic question. I have tried to instal new modules and themes. The installation process went OK, I got a"successfully installed" message. But when I want to activate the new module, it does not show up on the HOME / ADMINISTRATION / MODULES list.
The Update Manager module is activated, I am logged on as an administrator, I have all the rights set, but I still cannot see the newly installed modules or themes.
Any ideas would be appreciated. Thanks. Greg


texts: Embed media in Ckeditor field for drupal 7

texts:
I'm looking for a plugin for the latest version of CKeditor (3.6.3) so that I can add youtube videos (and other embedded media) to a text area that uses ckeditor.

I found several proposed plugins but most of them are not on the drupal.org site or are simply very old and do not seem to work with drupal 7.

There are a lot of questions on this subject but none that are recent or deal with drupal 7.

I know I can just turn off the rich editor and then embed the code in full html mode but I'd like something simpler for my client. Does such a module exist?

I've also found the media module (that is listed on drupal.org - http://drupal.org/project/media_youtube) but I don't think it integrates with CKeditor.

To clarify I'm looking for something like this: http://www.fluidbyte.net/embed-youtube-vimeo-etc-into-ckeditor but that works with drupal 7. (This one doesn't seem to work?).

EDIT: I am using the standalone CKEditor module


texts: What does exacly mean by Entity CRUD API?

texts:
Here in the documentation comment for entity_export() says:

  Note: Currently, this only works for entity types provided with the entity CRUD API.

So, what does it actually mean?

Background info:
We are going to create two modules. One for defining an entity type using hook_entity_info() and other providing UI for adding, editing, managing etc. There will be two drupal 7 installations. One will be installed with both of above modules and other only with first module defining entity type.

On first drupal installation, we will be creating/editing entities of type what we defined. And exported to second installation. So, we are checking for the capabilities of entity_export() and entity_import() functions for integration of entity export/import functionality.


texts: How do I make the administrative UI feel like Joomla?

texts:
I am working on a way to make a node/add/article page like joomla but but by now I haven't got any remarkable result.
I've written this code to hide a part and print it in another part:

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  $form['revision_information']['#type'] = 'hidden';
}

but I need to di it in preprosess time in order to have more performance.
so I use this one:

in .module file:

function template_preprocess_article_node_form(&$variables) {
  if (!module_exists('nodeformcols')) {
      hide($variables['form']['additional_settings']);
   }
}

in article-node-form.tpl.php

    <?php if($sidebar): ?>
      <?php print render($sidebar); print_r($variables['form']['comment_settings']);//['additional_settings'])?>
    <?php endif; ?>

but I don't have access to all field in this way.
any alternative or simpler approach will be appreciated.


texts: Spambots causing server crashes. How do I block them?

texts:
I have a Drupal 7 website on a shared hosting account that uses an Apache server. It is getting continuously battered by spam bots who try to post junk comments and create fake accounts. What methods can I use to block them from accessing the site and/or doing any operations there.

Currently, I have the following modules installed to block and combat spam:

Spambot - https://drupal.org/project/spambot

Spamicide - https://drupal.org/project/spamicide

Hashcash - https://drupal.org/project/hashcash

AntiSpam - https://drupal.org/project/antispam

Cloudflare - https://drupal.org/project/cloudflare

I tried installing Bad Behavior (https://drupal.org/project/badbehavior), but there appears to be some error in its installation procedure.

I do not want to use captcha to block spambots.


texts: Create relationship in views with custom entity

texts:
I have a custom entity (emtr) with a property called unit_tid (that relates to a taxonomy term).

When I create a view of my custom entity I want access to the fields associated with the related taxonomy term.

This question, Using Drupal7 custom entities in views, is on the same topic, and started me off on the right path.

So my hook_views_data_alter looks like:

function my_module_views_data_alter(&$data) {

    $data['emtr']['unit_tid']['relationship'] = array(
        'base' => 'taxonomy_term_data', // the name of the table I'm linking to
        'base field' => 'tid', // the field I'm linking to in taxonomy_term_data
        'relationship field' => 'unit_tid', // the name of the field in the emtr table
        'handler' => 'views_handler_relationship',
        'label' => t('Unit'),
    );
    //dpm($data);

}

However when I edit my view in the field list it says: Broken/missing handler (Unit_tid) and if I click on it the popup says:

The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.

What am I doing wrong in creating the relationship?

(Other related questions / resources include: How to add relationship in view for custom entity, Enable Relationships in Views with Entities?, Integrating entities with Views)


texts: importing blogs from another database with different content type fields

texts: I need to import blogs from a drupal database to another drupal database. Both the old and new drupal content types have different fields. I would like to get some hints about the sql queries or drupal api functions to be used and the process to be used to get data from old database.I have access only to the mysql database and not ftp/admin side.


texts:
I am looking for an option to redirect user referred from a specific url (say abc.com) to domain.com/abc in Drupal 7
if http_referrer='abc.com' redirect to xyz.com/abc
I looked at Redirect, http response headers modules but need something for http_referrer.

Preferably without code modification.


texts: How do I check if a user has view access to a node, in a template file?

texts:
I'm currently working on a simple LMS in D8 and have already defined the fundamental content types. Among them is a content type called Course, which can be considered "Premium" content, i.e. all users may access those fields that contain more general information, but the users will have to buy a subscription for accessing the full content.

To make that possible without any Premium module (which, at the moment, have not been ported to Drupal 8), I created a simple grid-view and deactivated "SQL rewriting", which works perfectly, so far. For displaying the nodes in this view, I have created a new view mode, called gallery, so that the nodes that are displayed can be styled in a template.
I would like to apply different CSS styles to those nodes in the view that the user may access. I'm not sure if this can be done in the view itself.

Anyway, I'm currently thinking of checking the view permission inside node--course--gallery.html and I would like to add a class to the article tag, if access is permitted.

Unfortunately, I can't seem to find the right function for this. I set it up like this:

{%
  set classes = [
    node.bundle|clean_class,
    node.isPromoted() ? 'is-promoted',
    node.isSticky() ? 'is-sticky',
    not node.isPublished() ? 'is-unpublished',
    view_mode ? view_mode|clean_class,
    user.hasPermission('view nodes') ? 'is-permitted',
    node.access('view') ? 'is-permitted',
    'clearfix',
  ]
%}

Neither user.hasPermission('view nodes') ? 'is-permitted' nor node.access('view') ? 'is-permitted' seem to have any effect.

Do you have any idea?


texts:
I've googled and nothing found about redirect module integration into views to add new filter criteria for a content type or taxonomy.

I need all redirects (FROM and To fields that showing in the image) path against specific nid (contextual filter) or content type (blog, event, article).

For more clarifications, see attached image


texts: Creating a View of nodes with field for workbench moderation state without showing every revision?

texts:
I am trying to create a table view of nodes with fields for node title and moderation state. (There are other fields but I'm omitting them for simplicity).

Currently, it's displaying a new table row for every single revision of the node. I only want to see one row per node, whatever the current state is. Grouping is not sufficient, since there are fields that are not the same across revisions.


texts: Creating filter seems to work but doesn't "stick"

texts:
So I want to create a view filter programatically using hook_update in the .install file. I feel like I have it going, but the changes will not show up in the UI. Here is what I am doing, and the results:

This view already contains 2 filters. I used this code to view those filters:

$filters = $view->display_handler->get_option('filters');
var_dump($filters);

and it was clear that they were there. Then I went into the UI and created the new filter using the GUI tools there. Then I ran the above code again, and it showed me all 3 filters (the 2 previous ones, plus my new one). So far so good.

So now I backtracked the database to the initial state, so I only had 2 filters again. Then inside my install file I ran this code:

$name = "soccer_scores";
$view_display = 'default';
$view = views_get_view($name);
$view->init_display($view_display);
$view->preview = TRUE;
$view->is_cacheable = FALSE;

$filters = $view->display_handler->get_option('filters');

$filters['field_is_livescore_value'] = array(
'id' => 'field_is_livescore_value',
'table' => 'field_data_field_is_livescore',
... a bunch of other array data

$view->pre_execute();
$output = $view->display_handler->preview();
$view->execute();
$view->post_execute();
var_dump($filters);

So after the install file runs, when that last var_dump runs, it prints out the $filters array and it looks exactly like when I created the new filter using the GUI. However, when I reload the admin area for that view, no new filter appears, it just shows the existing 2 filters, but not the new one.

So I feel there is some step I am missing to make the change "stick". I can find so few docs on this, can anyone help?


texts:
My interface has buttons for next/previous month. Clicking on them, I rebuild the request path (I can see in Firebug that the href attribute is correctly assigned), but I can't trigger the click event.

The jQuery code is in a Drupal behavior:

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

I call the following function:

function simulate_click() {
  var newPath = <the-right-path>;
  var anchor = $('a.domaine:first', context);
  anchor.attr("href", newPath);

but none of the following statements triggers the click:

  anchor.mousedown();
  anchor.trigger('mousedown');
  anchor.click();
  anchor.trigger('click');

Is there something special with jQuery in Drupal that I miss ?


texts: create list of  content titles at end of each articles

texts:
I want create block, view first articles as full node and others just view titles at the end of first articles.

for instace:  when create content type like 'opinion' and show 10 articles on every page, how view first articles (newest) as full node and 9 articles just view titles.

I used drupal 6

Best Regards


texts: Does my Drupal 7 site have transaction support enabled by default?

texts:
I happen to read through the commented lines in settings.php under the "Database settings" (around line no. 45) the following text:

  Some database engines support transactions. In order to enable transaction support for a given database, set the 'transactions' key to TRUE. To disable it, set it to FALSE.
  Note that the default value varies by driver.  For MySQL, the default is FALSE since MyISAM tables do not support transactions.

My databases array, auto-generated by Drupal Installer, is the following one:

$databases = array(
  'default' => array(
    'default' => array(
      'database' => 'test_db',
      'username' => 'root',
      'password' => '',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

Is it true that my site is not transaction aware until I add a key/value, 'transaction' => TRUE (preferably after 'prefix' => '') to $databases?


texts:
I'm working on a module which works as an adapter between Drupal and a framework which sends e-mails.

The framework supports inline image attachments, meaning that those images can be carried in the actual message and displayed in the recipients e-mail client without having to download those images from an external location.

I'm thinking that users of this module would be interested in having their e-mails themed so that they reflect the look and feel of the sending website. This is right now done through an 'email.tpl.php' file which the module requests the theming system to theme e-mails with.

Consider a themer/designer that works on theming e-mails. That person then figures out that it would be a good idea to have an inline image attached in  e-mails - say a logo. However, how does the designer (via theme functions) tell the module to include one or more pictures which are required by the theme?

I had hoped that my module could make a hook available which other modules and themes could implement, but it appears that only modules can implent hooks. This, at least, applies when using module_invoke_all().

My question is thus; is there a way to let any theme provide feedback to a module similar to how other modules can interact with each other via hooks?


texts: Redirect urls for non-translated pages (with entity translation)

texts:
Drupal 7 + entity translation + path-prefix language URLs.

The vast majority of the site is default language only. Certain pages are translated into multiple languages. When the user reaches one of these pages, and switches to a non-default language, url paths all now point to path-prefixed pages.

I'm using language fallback, so they'll see the default language content, but at a url with the language code as a path prefix.

Preferably, I'll get Drupal to check first to see if there is actually an entity-translated page on the other end of the request, and, if there is, pass it on through, and if not, re-write the URL back to the default-language (no path prefix) version. So as to avoid SEO/duplicate content issues and be a mildly better user experience.

My question: how do I achieve this?


texts: How to control metatag module's tags from a page callback?

texts:
I have some pages which are created by page callback functions. I'm using the metatag module. I'm on D7

I need to control the metatags output (specifically the description/og:description).

This documentation looks like it would have been useful, but is empty:
https://www.drupal.org/docs/7/modules/metatag/howto-assign-meta-tags-to-specific-non-entity-pages-d7

Thanks.


texts: Exporting my custom content tables for a module

texts:
I've been working on a Drupal 7 module. As I've been going along, I have been adding content types in the database through the Drupal 7 admin.

I now want these content types to be created when my custom module is installed.

Rather than coding this manually in the module, is there any module available that can look at the content types on my site and create the code I need to put in the module install script?


texts: How to Display a Block on a Page with a Variable URL

texts: I want to show a block only on these user pages: .../user/USER_ID/recurring-fees. What will be the code to be placed in the PHP box to make this work?


texts:
I have some troubles with D7 migrate module and sending emails.

I made a migrate class to import users via CSV files. The import works well, all my users are created.
But I need to send emails when the new user is created.

So I have implemented the migrate complete() function in my class like this:

public function complete($entity, stdClass $row) {

    // some stuff here

    // Operation.
    $op = 'register_admin_created';

    // Send an email.
    _user_mail_notify($op, $user);
  }

It's here were troubles comes, I use the _user_mail_notify() function to shoot the mail to the new created user.

The process looks good, the mail logger module shows me the mail result, but in fact the user don't receive the mail.

I already try to create a user via the administration people menu and when a check the "Notify user of new account", I do receive the mail notification.

In Fact, the process that I have implemented in my migrate class looks like the process when you create a user manually via the admin interface and when you check "Notify user of new account".

I have to tell you that I also implement a mail interface, to be able to shoot emails with HTML / CSS. In this case, I just add a header and footer to the mail.
All emails sending via my custom mail interface are sent and render properly. Only the emails sending during migration process are not send.

If you have some ideas about that problem, or if you need more information don't hesitate :)

Thank's,

Vali.


texts: How can I design a relationship between two types of users?

texts:
I have two types of users in drupal-7: children users and parents users. How can I design a relationship between these types of users?

Also How can I maintain this relationship in the code? i.e. getting the parent of the child or vice versa.


texts: Sort the entity obtained from the Query class with values from the Statistics module

texts:
I am using the following code to sort the published nodes basing on the value stored from the Statistics module.

$query = \Drupal::entityQuery('node')
      ->condition('status', 1)
      ->range(0, 5)
      ->sort('totalcount', 'DESC' );

$result = $query->execute();

The code is causing the following exception.

  Drupal\Core\Entity\Query\QueryException: 'totalcount' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 316 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).

How do I sort nodes basing on the totalcount value stored from the Statistics module?


texts: In multisite environment can you have a default site?

texts: I am wondering if multisite Drupal allows you to have a default site too. Something like sites/default/settings.php and sites/mysite/settings.php along with the proper sites.php. If yes then what should sites.php look like?


texts: Invoke a camera to start in Drupal 7 Forms API

texts: I am currently developing a module which must be capable of taking a picture. I dont know how will I make it? How will I invoke a camera to open just by clicking a button? Any idea?


texts: How do you combine exposed filter string text searches into one input field for Drupal 7 Views?

texts: Currently I have a bunch of exposed filters in my view but I want to combine them where I can search them using only one input field. How can this be done?


texts: How do I share views on multisite in drupal 8

texts: Is it possible to have a multisite set up in drupal 8 and create view on Site A and have that appear on Site B?  I cant find anything in drupal documentation for sharing views.  I can share users, content, and taxonomy, but nothing else.


texts: page template overrides are not being called :S

texts:
For example, on one of my pages, I see the following template suggestions when I enable Theme Developer module.

I have already included page template files as per the suggestion names, but they are still not being picked up. No idea why!! I have cleared all cache several times.

Any hints on how i can debug this will be helpful....

I always see only page.tpl.php only being called. (this is D6)


texts: How to reset a Field Collection to its basic, unpopulated state via hook_form_alter()

texts:
I am doing a form alter on a node edit form with a Field Collection which may have been previously populated.  I want to discard any previous data entered into the fields within the collection so it is in the same state as if the node were being newly created.

Thanks


texts: Is it possible to display a static version of a Drupal 6 website while it's in maintenance mode? Could something similar to Boost help?


texts:
I want to create separate user types. By "type", I don't mean just roles. Let me explain by an example.

User comes to my website and he wants to register either as "User" or "Editor". Both these profiles will have very different fields and different permissions.

Now, I can use profile2 module to create different profiles and restrict them to different roles. Furthermore, I can use Autoassignrole module to assign the desired role to the user during registration. This is all fine.

Now, what I want is separate links for registration for both roles. When user clicks on any one of them, only the relevant "profile2" profile should be shown in the form. The problem is that on the default registration form, both profiles are shown.

One could say that I could just uncheck the option in the "profile2" profiles and not show them during registration, and user can enter his profile after registration. But here is the thing: I want some of the profile fields to be entered during registration itself. This is required for my case.

So, now you get what I mean by "type"? It is surprising there is no straightforward solution to this basic functionality. How are you achieving this?


texts:
I have a view with an exposed filter using the hierarchical select module for taxonomy.

/browse?category=12345

On the same view, I have an argument which does the same thing.

/browse/12345

I want my users to navigate using only the select filter, but this doesn't support breadcrumbs and page titles like the argument does. I wrote a bit of code to inject the filter value into the argument, and that works fine, but the next time I change a filter and refresh the view, the URL changes to that previous value while showing the new value.

/browse/(term id of last selection)?category=(term id of new selection)
aka
/browse/111?category=333

How can I discard this url change and keep things how they work the first time?

function MODULE_views_pre_view(&$view, &$display_id, &$args) {
  switch ($view->name) {
    case 'resources':
      if ($display_id == 'page_1') {
        if ($_GET['category']) {
          $args = array($_GET['category']);
        }
      }
    break;
  }
}


texts: Sometimes the v= parameter is added to the product URL

texts:
I have a new Drupal 8 site running commerce. When I view a product, most of the time the clean URL is perfect. Other times, it has a version parameter attached to it. I can access the page and no parameter, then refresh and I get a ?v=2 or something like that. I'm baffled. Has anyone experienced this issue? We're afraid that if users copy this link (with parameter) to other sites, it will cause us duplicate issues with SEO.

I'm not sure what I need to post here for help, so if anyone can help, let me know and I'll provide anything I can.


texts: Have a multisite instance use a single user session table

texts:
I have a multisite drupal instance each with their own database but I want users to be logged in on all of them once they log into any one of them.

I found another question asking for something similar but it is for drupal 7 and it seems like it assumes each site is using the same database (I think)

How to share user and user profile in a multisite environment?

I do see a 'sessions' table but I'm not sure how to make each site use the same one.


texts: My images are not showing up after importing to Pantheon

texts:
I finished creating my drupal site with WAMP and then imported the database. None of my images are showing up. I am assuming this is a file-path problem, but i'm not quite sure how to fix it?

For example, I have a image field in a content type, but it does not tell me where / how I can edit or change the pathing file.


texts: How to create Tabs in form Module using FORM API in Drupal 7 and enable and disable them


texts:
I'm trying to leverage the browser cache for my Drupal 8 site. I saw many posts regarding it, but whenever I edit the .htaccess file, there is still no difference in testing. This is my code right now.

 # Requires mod_expires to be enabled.
 <IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On

 # Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600

<FilesMatch \.php$>
# Do not allow PHP scripts to be cached unless they explicitly send cache
# headers themselves. Otherwise all scripts would have to overwrite the
# headers set by mod_expires if they want another caching behavior. This may
# fail if an error occurs early in the bootstrap process, and it may cause
# problems if a non-Drupal PHP file is installed in a subdirectory.
ExpiresActive Off
  </FilesMatch>
    </IfModule>

I read Leverage browser caching issue, but I still don't get it to work.

I am using Apache 2.4.

httpd -M | grep expire
[Thu Jan 11 15:27:29.472962 2018] [core:warn] [pid 11677] AH00114: Useless
use of AllowOverride in line 173 of /etc/httpd/conf/httpd.conf.
 expires_module (shared)

Response Headers

Cache-Control:max-age=0, no-cache, no-store
Connection:keep-alive
Content-Encoding:gzip
Content-Language:en
Content-Length:11829
Content-Type:text/html; charset=UTF-8
Date:Thu, 11 Jan 2018 22:50:43 GMT
Expires:Thu, 11 Jan 2018 22:50:43 GMT


texts: user-profile.tpl.php and render($user_profile) not working

texts:
Pulling my hair out after googling all day to solve this.

I am using a corolla subtheme on drupal 7. I am trying to override the user account edit page in a template file.

For that I am using the default user-profile.tpl.php that comes with core's user module.

But without preprocessing the file won't be recognized by my theme. So I googled here and there and came up with the following:

function mytheme_theme(&$existing, $type, $theme, $path){

  $hooks = array();
    // Make user-profile.tpl.php available
    $hooks['user_profile_form'] = array (
       'render element' => 'form',
       'path' => drupal_get_path('theme','mytheme'),
       'template' => 'templates/user-profile',
       'preprocess functions' => array('mytheme_preprocess_user_profile_form'),
    );
  return $hooks;
}

function mytheme_preprocess_user_profile_form(&$vars) {
  $args = func_get_args();
  array_shift($args);
  $form_state['build_info']['args'] = $args;
  $vars['form'] = drupal_build_form('user_profile_form', $form_state['build_info']['args']);
}

My php is at a level copy/paste + minor adjustments with a lot frustration.

This preprocessing makes my site read the user-profile.tpl.php, but I can't access the array $user_profile. Instead fields are in the array $form, which misses some fields I need, and all fields miss their default values which should come from the user whose account is shown.

This way I can't rebuild the default password-inputboxes and the 2 new password-inputboxes, and I need a lot of extra php to supply the values for all fields.

I am missing something here, but my knowledge won't go that far that I know what to change, and my google-fu is depleted. I think I need to change some things in the preprocessing-code, so that the array $user_profile is loaded and all the fields have the correct values allready.

How to accomplish this?

How can I make this to work?


texts:
im trying to do a if else statement for the main menu, i have something like this but i dont know where to begin.

<?php if ( !$is_front ) : ?>
function bartik_links__system_main_menu($variables) {
  $output = '';
  foreach ($variables['links'] as $link) {
    $output .= l('<h2>'. check_plain($link['title']) .'</h2>', $link['href'], $link);
  }
  return $output;
}

<?php else: ?>

function bartik_links__system_main_menu($variables) {
  $output = '';
  foreach ($variables['links'] as $link) {
    $output .= l(''. check_plain($link['title']) .'', $link['href'], $link);
  }
  return $output;
}
<?php endif ?>

as you can see i want the tags on the front page and if it isnt then i want the tags to disappear.


texts: Drupal 7 multisite domain without www. not working

texts:
I have moved a site (www.example.com) to a multisite installation.  The path is 'sites/www.example.com'.  I am reading that adding the 'www' to the sites folder is a no-no.

www.example.com - Works but..

example.com - Doesn't.

I tried creating a symlink 'example.com -> /home1/username/public_html/sites/www.example.com/

also, tried adding "$sites['example.com'] = 'www.example.com';" to my sites.php, but..nothing.

If I rename the folder to 'example.com' all of the paths in the database will be broken.  Any ideas?


texts:
I created a simple view to show the node fields of a certain content type.
Now I'd like to change the path of the view tab to the view's path.

I read this question:

Change name of a tab for a specific content type

and I think to implement something similar, but I don't know exactly what element change.

I know I could create a .tpl but it's easier theme with the view in this case.

Thanks


texts: How to display a new taxonomy term on a select box using Webform?

texts: I am using Drupal 7. I have Webform and Webform Term Options installed. I have a taxonomy list of terms called "Training Events". Under "Load a Pre-Built Options List" I select the Training Events list, and save. I view the webform and the list of taxonomy terms is there on the select list. However, if I go to Structure -> Taxonomy -> List terms -> Add term and add a new term, that new term does not appear on the webform. Why won't it appear and do I make it appear?


texts: My ajax is altering form action/URL thus makes me impossible to read the $tid from it

texts:
I am using WEBFORMS which have as the topic taxonomy terms saved as hidden fields.

Unfortunate, after attaching files using Upload button this terms are lost ('No category'), as ajax is altering the form #action URL from

/tid e.g. /19

/file/ajax/submitted/file4/form-gTwVpNbQRszArGEUS1OfuwA8WgSLJOlcWGOuS6r9D5A

I have multiple file forms

From where to read $tid?

Therefore my $tid fail to load from URL

      function MYMODULE_form_alter(&$form, &$form_state, $form_id) {

    if (strpos($form_id, 'webform_client_form_') === 0) {
        $tid = arg(1);
                  $term = taxonomy_term_load($tid);
                    if (!empty($term)) {
                        $category = i18n_taxonomy_term_name($term, $language->language);
                    } else {
                        $category = 'No category';
                    }
                    $form['submitted'][$category_fieldkey] = array(
                        '#type' => 'hidden',
                        '#value' => $category,
                    );

           // UP TO 10 FORM FIELDS
            for ($i = 0; $i <= 9; $i++) {
                $form['submitted']['file' . $i] = array(
                    '#title' => t('File'),
                    '#type' => 'managed_file',
                    '#description' => t('Please upload a document or image.'),
                    '#default_value' => variable_get('file' . $i, ''),
                    '#weight' => 100,

// ADD FORM SUBJECT
            $form['submitted']['subject'] = array(
                '#type' => 'item',
                '#title' => t('Subject'),
                '#markup' => '
' . $subject . '
',
                '#weight' => -100,
            );

                );
            }

    }
     return $form;
    }


texts: Converting db_query from Drupal 6 to Drupal 7: Invalid parameter number: number of bound variables does not match number of tokens

texts:
I have a custom localisation function in a Drupal 6 module that I would like to convert to Drupal 7 but I have hit a wall with the db_query function. I have the following code (in d6 and d7):

// Drupal 6
db_query("REPLACE INTO {locales_target} (lid, translation, language) VALUES ((SELECT lid FROM {locales_source} WHERE source = '%s' LIMIT 1), '%s', 'sv')", $name['eng'], $name['swe']);

// Drupal 7 (not working)
db_query("REPLACE INTO {locales_target} (lid, translation, language) VALUES ((SELECT lid FROM {locales_source} WHERE source = :source_eng LIMIT 1), ':source_swe', 'sv')", array(':source_eng' => $name['eng'], ':source_swe' => $name['swe']));

I get the following error message when I try to use the d7 version:

  PDOException: SQLSTATE[HY093]: Invalid parameter number: number of
  bound variables does not match number of tokens

D7 API for db_query

Could somebody help me out figuring why the db_query isn't working?


texts: view 3: filter for datetime field is not working

texts:
I have created a customised module that export the content of a remote database tables to the view interface, every thing works fine except of the filter of the datetime field. In my file: mytable.views.inc

function mytable_views_data() {
  $data = array();
  $data['table1'] = array (
  'table' =>
   array (
    'group' => 'table1',
    'base' =>
     array (
      'field' => 'id',
      'title' => 'table1',
      'help' => 'table 1',
      'weight' => 10,
      'database' =>'database-name',
    ),
  ),
  'id' =>
   array (
    'title' => 'Id',
    'help' => 'Id',
    'field' =>
     array (
      'handler' => 'views_handler_field_numeric',
      'help' => 'Id',
      'click sortable' => true,
    ),
    'filter' =>
    array (
      'handler' => 'views_handler_filter_numeric',
      'allow empty' => true,
      'help' => 'Filter on Id',
    ),
    'argument' =>
    array (
      'handler' => 'views_handler_argument_numeric',
      'help' => 'Id',
    ),
    'sort' =>
    array (
      'handler' => 'views_handler_sort',
      'help' => 'Sort by Id',
    ),
  ),

     'date' =>
      array (
      'title' => 'Date',
      'help' => 'Datetime field',
      'field' =>
       array (
      'handler' => 'views_handler_field', // I tried also 'views_handler_field_date' and 'views_handler_field_datetime' but view displays the message field handler is broken
      'help' => 'Date',
      'click sortable' => true,
    ),
    'filter' =>
     array (
      'handler' => 'views_handler_filter_date',
      'allow empty' => true,
      'help' => 'Filter on Date',
    ),
    'argument' =>
    array (
      'handler' => 'views_handler_argument_date',
      'help' => 'Date',
    ),
    'sort' =>
    array (
      'handler' => 'views_handler_sort_date',
      'help' => 'Sort by Date',
    ),
  ),

);

return $data;
}

all the data fields are displayed properly in the view interface :

and the filter of the field datetime is displayed also:

The problem is the filter have no effect on the datetime field, I tried to filter the field but the filter has no effect and the data was not filtered, I think that there is a non compatibility issue between the field handler and the filter handler but once I tried to use the field handler: 'views_handler_field_date' or 'views_handler_field_datetime', the views didnt displayed the data of the datetime field and it has indicated that the field handler is broken, and with the handler 'views_handler_field' every things is displayed well but the filter is not working!


texts:
im using feeds commerce on eshop. Im trying to import large feed with this code:

 $myFeed = feeds_source('my_feed'); while (FEEDS_BATCH_COMPLETE != $myFeed->import());

But after run im getting this message:

  FeedsLockException: Cannot acquire lock for source my_feed / 0. in
  FeedsSource->acquireLock() (line 791 of
  sites/all/modules/feeds/includes/FeedsSource.inc).

Im calling script via url every 10 minutes with server cron and still getting error.

Can someone help me and explain what im doing wrong?


texts:
I know that there are a couple of modules to import taxonomy from CSV but my taxonomy has many term references inside it.

Attached is a screenshot of my taxonomy, how can I import the excel sheet into it? Please help

excel sheet.


texts: How to get URL on Computed Twig field (with tokens)

texts:
I have a Computed Twig field created on my webform. (Using webform module).
In the "Computed value/markup" I have entered the value "{{ uri }}" token, and the url is correctly returning me. But, I have several problems with this token.
1º It doesn't bring me the value in raw, and therefore it comes encoded with special characters for urls like "% C3% B1a"
2º It returns the complete URL (without adding the host) but if it adds the search parameters to me if there were such as.. "?field_hello=yes"
What token should I really use to solve these 2 problems?


texts: How to alter my query in hook_views_query_alter to use the right where expression?

texts:
I am displaying a fee schedule using views and need to skip paid fee schedules. For that, I need to add following JOIN in views query using hook_views_query_alter().

LEFT JOIN ic_fee_schedule_payments AS FSP ON fee_schedule.fid = FSP.fid AND fee_schedule_students.uid = FSP.uid AND fee_schedule_instalments.iid = FSP.iid

with added where clause as:

AND FSP.pid IS NULL

I have tried the following code in hook_views_query_alter(), but it does not work.

# In order to add a new table to join, you'll need to create a new views_join object.
    $join = new views_join;
    $join->construct('fee_schedule', 'fee_schedule_payments', 'fid', 'fid');
    $join1 = new views_join;
    $join1->construct('fee_schedule_students', 'fee_schedule_payments', 'uid', 'uid');
    $join2 = new views_join;
    $join2->construct('fee_schedule_instalments', 'fee_schedule_payments', 'iid', 'iid');
    #$join->extra = array(array('table' => 'fee_schedule_payments', 'field' => 'pid', 'operator' => 'IS', 'value' => 'NULL'));
    // $join is the views_join object created above
    $query->add_relationship('fee_schedule', $join, 'fee_schedule_payments');
    $query->add_relationship('fee_schedule_students', $join1, 'fee_schedule_payments');
    $query->add_relationship('fee_schedule_instalments', $join2, 'fee_schedule_payments');
    $query->add_where('fee_schedule_payments', 'fee_schedule_payments.pid', 'NULL', 'IS');

EDIT: Tried the other way but still does not work.

$join = new views_join;
    $join->construct('fee_schedule', 'fee_schedule_payments', 'fid', 'fid');
    $join->extra = array(array('table' => 'fee_schedule_payments', 'field' => 'uid', 'operator' => '=', 'value' => 'fee_schedule_students.uid'), array('table' => 'fee_schedule_payments', 'field' => 'iid', 'operator' => '=', 'value' => 'fee_schedule_instalments.iid'));
    $query->add_relationship('fee_schedule', $join, 'fee_schedule_payments');
    $query->add_where('fee_schedule_payments', 'fee_schedule_payments.pid', 'NULL', 'IS');

Am I missing something or need to alter query in some other way?


texts: How to programmatically insert and update Field Collection values?

texts:
I would like to insert and update Field Collection values. I'm using Drupal 8 with field_collection 8.x-1.0-alpha1.

Setup

I have created a new content type test_content_type with the following fields:

Title
Body
…
Test Field Collection

Machine name: field_test_field_collection
Type: field collection

The field collection field_test_field_collection has only one field:

Example Text

Machine name: field_text
Type: text

The Problem

I also created a node with values, for instance Lorem Ipsum as field_text.value, but I don't know how to read and define the value programmatically. I tried the following, which updates body but doesn't update field_text:

<?php

namespace Drupal\my_module\Controller;

use Drupal;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Entity\EntityStorageInterface;

class FieldCollectionTestController extends ControllerBase {
    /**
     * @return array
     */
    public function content() {
        $nodeId = 1402;

        /** @var EntityStorageInterface $entityStorage */
        $entityStorage = Drupal::entityTypeManager()->getStorage('node');
        $node = $entityStorage->load($nodeId);

        // Dump.
        {
            ob_start();
            var_dump($node->field_test_field_collection->field_text);
            $dump = ob_get_clean();
        }

        // Update node and field collection.
        {
            $exampleText = "Updated at " . time();

            $node->body = $exampleText;
            $node->field_test_field_collection->field_text = $exampleText;

            $node->save();
        }

        $response = [
            '#theme' => 'item_list',
            '#title' => 'Dumps',
            '#items' => [
                [
                    '#type' => 'markup',
                    '#markup' => $dump,
                ],
            ],
        ];

        return $response;
    }
}

The value of $dump is null.

Question

How do you insert, update and delete Field Collections in Drupal 8?


texts:
I want to show some node fields in buttonpane when I open node in modal.
As far as I know, it will automatically show there inputs with type submit and links with class button, but I added class button on email field link, anchor rendered is like:
Send email

but it's not showing in buttonpane.
Any idea why and how to fix it?


texts: Database Abstraction Layer and 'LOAD DATA INFILE' Statements

texts:
I realize that using the database abstraction layer comes with a few caveats such as not being able to run queries that are not available in one way or another across all versions of the databases supported by Drupal7. However, I need to load data from a CSV file into the database from a user uploaded CSV file via a form built with the form API. So in the hook_submit function, I am going to do just that. Obviously I can write my own MySQL dependent implementation, however, I was hoping there was an abstracted "Drupal way" to accomplish the same task. I have not been able to find any such method.

Typically here is how I would do this after sanitizing the data, as an example:

LOAD DATA INFILE 'components.csv'
INTO TABLE components
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(componentId,componentName,componentDescription,componentAverageCost);

However, obviously this is a MySQL dependent query and even further it is dependent upon MySQL version 5 and later if my memory serves me correctly.


texts: How do I send email to a large number of Drupal users, based on rules?

texts:
I have a scheduled rule (schedule, rules module) to send a HTML email (mime module), using a View to list the email addresses (View Rules).

I tested this based on a couple of users (all users within my site's database) and everything worked as expected. When I increased the number of emails (to around 1400), I found that around half the users received the email, over and over again.

I also noticed that when I manually run CRON, the page times out.

I can't see any errors logged, but these may have been cleared.

Could anyone explain why this is occurring? I'm confident that everything was working before the increase in user numbers.

If a CRON task times out / errors, does it repeat on every page hit until it is successful ?


texts: How do I include a required context in a ctools content type plugin?

texts: I need to include a subject type as a required context for a ctools content type plugin? How and where is context set for the ctools plugin?


texts: Sorting a view on a taxonomy term with entityqueue

texts:
I'm trying to use an entity queue on a taxonomy to create a new sort order for an existing view. But I'm having trouble configuring it.

I've created a dummy website with a fantasy role-playing game theme. I have a content type "Monster" with a taxonomy term "difficulty".

Monsters can have several difficulty tags, but I've created an entityqueue for the subset of tags that I want to sort on:

Finally, I've created the view for monsters, with what I believe are the properly relationships to join in the entityqueue for sorting. Starting with the Monster content type, I've added a relationship to the Difficulty taxonomy term, then another relationship for the Monster Difficulty entityqueue.

Finally, I added the entityqueue as the first sort criteria:

However, the results of the view are still sorting on the title field, "Name", meaning that the sort order of the entityqueue is either not making it in or being respected:

How do I sort a view based on a taxonomy entityqueue?

Edit I removed the sort for the title, as per hotwebmatter's suggestion, but that didn't cause it to sort by the entityqueue.

The order should go Big boss, boss, mini-boss, etc., but it doesn't.

Here are the configuration export ymls of those files different from a vanilla install: https://pastebin.com/r4A94QJ5


texts: Call a Javascript Function and Update my Form Element at the same time

texts:
This is my ajax callback function

function myid_search_idnumber($form, $form_state)
{
    return $form['id'];
}

It updates the values in $form['id']. But Because I wanted to call a javascript function as well as update the form, I added a few codes:

function myid_search_idnumber($form, $form_state)
{
    $commands[] = ajax_command_invoke(NULL, 'myid_update_id_number');
    $page = array( '#type' => 'ajax', '#commands' => $commands, );
    ajax_deliver($page);

    return $form['id'];
}

The three lines of code added above, calls a javascript function.

$.fn.myid_update_id_number = function(){
    alert('Wew');
}

Performing those only calls the javascript function but does not update anymore my form. How will I call my javascript and at the same time update my form?


texts: Relate Content to a Group feature when creating a node outside a group

texts:
In my drupal site, I'm using the Group module.

My problem:

  I created a regular Drupal node type, let's call it userpost
  I created a group type called "usergroup"
  The content type "userpost" is also installed as a group node of group type "usergroup"

Is there a way to put a reference field or something similar into my "regular" node form for my content type called userpost? So that it's possible to (optional) relate a node during creation, to one (or more) group(s) at the same time?

In the admin interface of a group it's possible to relate existing content to a group. This kind of reference field I would like to place into my node creation form :)

Thanks for any hint in advance.

Best regards
Phil

P.S. I opened for this problem an issue at Drupal.org too.


texts: How do I increase the number of characters accepted by MySQL?

texts:
This is how I've defined the content_body in my FieldWidget:

$widget['content_body'] = array(
  '#title' => $this->t('Body text'),
  '#type' => 'textarea',
  '#default_value' => isset($items[$delta]) ? $items[$delta]->content_body : '',
);

which allows me to enter more than 255 characters when editing/creating the content. However, I get an error when more than 255 characters are entered and the content is created/updated.

This is the schema in my FieldType class:

$schema['columns']['content_body'] = array(
  'type' => 'text',
  'size' => 'tiny',
  'not null' => FALSE,
);


texts: how to display database record in gird line

texts:
I have created custom module to display some records from database ,i need to print the records as grid line how i can achieve this ,

    <?php

namespace Drupal\uniview8_defaulters\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Database;
class uniview8DefaultersController extends ControllerBase {

static function getAll() {
    $userCurrent = \Drupal::currentUser();
    $user = \Drupal\user\Entity\User::load($userCurrent->id());
    $uid = $user->getUsername();
if($uid == "admin")
{

$result = db_query('select name from {users_field_data} as u left join {uv_payu_response} as uv on u.name=uv.payu_udf2 where uv.payu_udf2   IS NULL');

    return $result;
}
  }

  public function userview() {

    $content = array();

  $rows = array();
   // $headers = array(t('MEMBER ID'));

    foreach ($entries = $this->getAll() as $entry) {

      $rows[] = array_map('Drupal\Component\Utility\SafeMarkup::checkPlain', (array) $entry);
    }

$len=sizeof($rows);
drupal_set_message(t("$len"));
drupal_set_message(t("$rows"));
foreach($rows as $res)
{
$content['list'] = array(
      '#type' => 'markup',
       '#markup' =>'<strong>'.$res .'  </strong>'
 );
 }
    return $content;
  }

}

  EXPECTED OUTPUT

DEFAULTERS MEMBER ID:

EMP1
EMP2
EMP3
EMP4
EMP5
EMP6
EMP7
EMP8
EMP9
EMP10
......
......


texts:
I have a Drupal 7 theme which is a Bootstrap child theme.

In my version of page.vars.php, I have a THEME_page_alter() call which runs only once until I do a clear cache. Other hooks such as THEME_process_page or THEME_preprocess_page are called each time I reload the page.

A second theme, with the same page_alter hook works just fine and is called each page-reload without the need for a clear-cache first.

What could be causing this?