texts: Changing date format in monthly archive in Views

texts:
I created a view which summarise the nodes and displays them in a year + month block. The result looks like this:

március 2015 (26)
február 2015 (12)
január 2015 (18)

I'd like to change the date format according to Hungarian standards:

2015 március (26)
2015 február (12)
2015 január (18)

I tried to find the appropriate settings in date/time settings (admin/config/regional/date-time) without any success.


texts:
I know how to rename "edit" or "track" tab on user page and node page. Here's the code, it might help someone.

<?php

function MYMODULE_menu_alter(&$items) {
//    drupal_set_message('Menu Items: <pre>'.print_r($items, TRUE).'</pre>');
    $items['user/%user/view']['title'] = "Profile";
    $items['user/%user/edit']['title'] = "Profile edit";
    $items['node/%node/edit']['title'] = "Node edit";

}

...but I don't know how to remove or hide the "View" tab on created node.
my url page of the node is content/(node title).

What snippet should I use to remove the "View" tab on node page?


texts: Create a View that Displays a group of Taxonomy Terms

texts:
I have a proposed data structure like this:

Asset:

Title
Image
Description
Taxonomy term: Campaign

Campaign (taxonomy dictionary):

term
image
description

I am trying to make a view block that displays only the Campaign group, represented by the Campaign image.  The farthest I can get is defining a relationship to tax. terms on node, and displaying all Assets with that tag.  I can even Group them, which is really close to what I need.  How do I solve the problem of displaying "Campaigns" as groups of assets (not the list of assets tagged with this taxonomy).

I thought I could show a list of (non-duplicate) fields where that tax. image exists (which should be once per group/aka "Campaign"). But not so far..

How do I achieve this?   Have I overlooked something?  I am open to different approaches or ideas..


texts: Is it possible to have multiple customer types within Drupal commerce eg consumer and trade? These would then have different pricing stuctures


texts: How can I map multiple fields to one 'parent' field?

texts:
What I want to do is best illustrated with an example.

Apartments have different price ranges for different units according to how many bedrooms/bathrooms those units have.

How could I set up a content type that will allow me to do something like this:

$500 -- 5br/4ba

$400 -- 4br/3ba

$350 -- 4br/2ba

In the above example each price range has a corresponding 'bedroom' and 'bathroom' value.
In order for this to work I need to map these price ranges to these values. Each apartment entity can have up to 10 of these mapping pairs.

I hope this makes sense. I can't figure out how to set up the content type.

Thanks for your patience and help.


texts: Can a disabled module pose a security risk?

texts:
Is it possible for a module that is installed but not enabled to pose a security risk?

Corollary question: Is it a recommended practice to update disabled modules when security updates become available?


texts: Help me understand themes with sidebars and how to populate the sidebar from drupal

texts:
BACKGROUND

I'm converting a static html site to drupal.   We have some pages that have content and a sidebar and some pages that just have content without a sidebar.

I plan on simply adding a new field called 'sidebar' to the article and base page content types.  I can then modify the theme to render this field.

QUESTION

Is their any reason why adding this new sidebar field to the content type is considered bad practice?

If I want to place a block in the sidebar region it could simply be after or before the data entered into the sidebar field correct?

I'm a total newbie to drupal,  I understand these are basic question but I couldn't find a definitive answer on the web regarding this.

Thanks


texts:
$databases['default']['default'] = array (
  'database' => 'baba',
  'username' => 'abab',
  'password' => 'abcbc@',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

$databases['abcb']['default'] = array (
  'database' => 'ababc',
  'username' => 'abcb',
  'password' => 'Sabbs',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'driver' => 'mysqli',
);

We have mysql, pgsql and sqlite driver but I wanted to integrate a mysqli driver in drupal ?
How can I achieve it or fetch table from mysqli database in mysql database ?


texts: One of my client requirement states they need to sort some field based on taxonomy id. I am very much fine with sorting it based on Id or name in asc or desc order. But client states that they need to have taxonomy name drop down menu. Based on selection of taxonomy name it should get sorted(Seems quite illogical) but still is there some way to achieve same.


texts: How to get all the content types that don't have nodes?

texts:
In Drupal 7 if you want a list with the content types that don't have nodes  you can do it with the following query:

SELECT type, name, COUNT(nid) as total
              FROM node_type LEFT JOIN node USING(type)
              GROUP BY type
              HAVING total = 0
              ORDER BY name

But in Drupal 8 we don't have the {node_type} table and you can't have access to all the available content types unless you use the 'entity.manager' service or you go to look inside the {config} table that have a column named name, but in the name column you will find this:

node.type.CONTENT_TYPE_MACHINE_NAME1
node.type.CONTENT_TYPE_MACHINE_NAME2

There is not an easy way to get the information from this table.

I found an example in the Entity Query support for aggregated queries page:

  Let's assume you want the amount of nodes per node type.

$query = Drupal::entityQueryAggregate('node');

$result = $query
  ->groupBy('type')
  ->aggregate('nid', 'COUNT')
  ->execute();

But only works for content types with more than 1 node, why? Again there is not way to find content types in the database that don't have nodes.

I really don't know the reason for this missing important part (and I can't find it) but I think that this is very important because the only way now to obtain the content type label is through the 'entity.manager' service.

In short, how to get all the content types that don't have nodes?


texts: Translation does not work for promoted to front page nodes

texts:
I've been trying to figure out how to have a translated node promoted on the front page to be displayed according to the visitor chosen language. So basically I have one article promoted on the front page. It has a french translation (which I also set as promoted on the front page).

I want my visitor to only see the english version of my article (node/1) when on mysite.com/en
I want my visitor to only see the french version of my article (node/3) when on mysite.com/fr

The problem:

The source node (en, node/1) has a translated version (fr, node/3). Both are set to be promoted on front page. But they are both showing up on the homepage whereas I would like to have the nodes being only displayed once on the related language (mysite.com/fr or mysite.com/en).

Everything has been set up using Internationalization.

UPDATE

You will think I was posting without googling first but I can ensure you I've been struggling with this for hours. Finally found the solution here: https://stackoverflow.com/questions/5168289/multiple-frontpages-in-mutiple-languages/6803625#6803625


texts: Uploading my Drupal Comerce Files to My Web Host

texts: I have installed Drupal Commerce using Kickstart.  It is now running on my local server.  How to I properly upload and configure it on my Web Host?  Any help would be greatly appreciated.


texts: Drupal 7 context module fails to load on front page

texts:
I have the context module installed on Drupal 7. It worked perfectly fine for a long time. But, recently when I try to add or remove a reaction(block) for a context the related page fails to load. I get an error: "The website encountered an unexpected error".

Has anyone had a problem like this?


texts:
Ive made sure my CSS files are being aggregated but respond.js isnt working.

Here is my site:
http://smartpeopletalkfast.co.uk/cc/

Ive tried both the module (currently enabled) and also using the Zen themes built in option to use respond.js.

Ive added this for debugging, so when media queries are working the page is blank for desktop sized displays.

@media all and (min-width: 720px) {
  body {
    display: none;
  }


texts: For views, how do I display only one of a series with the same title?

texts:
We have a view that displays upcoming events. We use civiCRM for events. Some of our events are ongoing: they have the same title, but different dates. What logic could I use to display the next upcoming event, without displaying all upcoming events?

For instance, at the moment the events displayed are based on date. Any event that is not yet passed will display in the view. But for a class which meets 10 times, I do not want 10 of the same title, just the next class and its date/time.


texts: How to add different field values in views?

texts:
I have two contents A and B. I have created a view for A, I need a one of field value from B in my A view.

I have referred some tutorials, they are suggesting relationship by using entity reference field.

Actually in my content B there is no any entity reference fields. In content B I have only two fields one is title and other one is plain text. How can I overcome this? Thanks in advance.


texts: Can I create two views with the same paths?

texts:
I have a path pattern that looks the same for two content types. For example, pattern http://my-site.com/x/y/z, for content type 'Article' and content type 'Property'. They follow the same pattern because they only differ in the actual content. The paths are composed of taxonomy items which are the same for the two content types.

So where x/y are the taxonomies called 'categories' and 'types' while z is the title of the content. And both content types follow the same taxonomy group. So only differs in the actual content. One uses generic 'Article' fields while other one uses many custom fields.

My view mostly is defined by the system path node/% but I need to separate them for 'Article' only types and 'Property' only contents. This works for 'Property'. 'Article' based contents are no longer shown by Drupal now.

I have looked into this and this but they somehow use panels and other one is based on blocks and permissions, which is not what I needed.

I can't seem to use panels because I cannot, for some reason, see my view in the contents that can be added. (Most probably because my Views path is node/%). I can only pull those views that does not follow this format.

Is there any other simple way to pull the two types of contents without having to resort to Panels and separating contents by different blocks? Because it is more readable using Views  and much lighter and easier to just configure the parameters I think. U reduce a lot of overheads.

Any thoughts?


texts: Problems to integrate a form into a block

texts:
So far, the form is rendered in the block, but the following errors are displayed:

  Notice: Undefined index: ios_lang_checkbox_nameform_function in
  drupal_retrieve_form()

  Warning: call_user_func_array() expects parameter 1 to be a valid
  callback, function 'ios_lang_checkbox_nameform_function' not found or
  invalid function name in drupal_retrieve_form()

<?php

function ios_lang_checkbox_block_info() {
  return array(
    'ios_lang_checkbox' => array(
      'info' => t('Ios Like language switcher'),
      'description' => t('Ios Like language switcher')
    )
  );
}
function ios_lang_checkbox_block_view($delta='')
{
    $block['content'] = drupal_get_form('ios_lang_checkbox_nameform');

  switch($delta) {
    case 'ios_lang_checkbox':
      $block['subject'] = null; // Most forms don't have a subject
      $block['content'] = drupal_get_form('ios_lang_checkbox_nameform_function');
      break;
   }
   return $block;
 }

function ios_lang_checkbox_menu() {
    $items['ios_lang_checkbox'] = array(
        'title' => 'View the sample form',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('ios_lang_checkbox_nameform'),
        'access callback' => TRUE,
        'type' => MENU_NORMAL_ITEM
    );
    return $items;
}

/**
 * Define a form.
 */
function ios_lang_checkbox_nameform($form, &$form_state) {

    $options = array(
        'de' => t('de'),
        );
    $form['ios'] = array(
        '#title' => t('Your Name'),
        '#type' => 'checkboxes',
        '#description' => t('Choose language'),
        '#options' => $options,
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit')
    );
    return $form;
}

?>

Thanks a lot!


texts: Drupal Feature Recreate Module - what next

texts:
I am newer to drupal features. I have a site that was built heavily with them.

There is a drupal-feature where I added some fields. After I added and reorganized them I recreated the module.

Do I need to uninstall the current drupal feature module then install the new one?
Or can I just add the new module turn it on and go from there?

Thanks for the help!


texts:
I am searching for comments ip address in D8 and I can't find where they are located in database. In D7 it was easy to find.

Is there a chance that D8 is not storing the commenters ip address? If it is not, how can I store it?


texts:
Is it possible to take a field from my node and create a url alias from the content of that field?

Say I have a node type article. This gets its normal url via pathauto, but I also wish to be able to create a short url so I can go to example.com/LS and I will be redirected to the node.

How can this custom short url be created automatically?


texts: Contextual filters exclude option missing

texts:
I've downloaded the drupalcommerce kickstart but when adding a contextual filter to my view, the "exclude" option is missing.

when I expand the "more" at the bottom the only options are: Allow multiple values and administrative title

do I have to enable the option somewhere before I can access it?

I'm trying to make a list of nodes of the same type, excluding the current node...


texts: field_view_value returns null for boolean field

texts:
I have a custom field field_sold which contains a single boolean value. I'm trying to use the following function to retrieve the content of the field, but it always seems to return null:

function <theme>_render_field($node, $field_name, $delta = 0, $display = array()) {
   $field = field_get_items('node', $node, $field_name);
   $field = field_view_value('node', $node, $field_name, $field[$delta], $display);
   return render($field);
}

When trying to dumping the $field variable between the calls to field_get_items() and field_view_value() I recieve the following output:

// after field_get_items()
Array ( [0] =>
   Array ( [value] => 1 ) )
// after field_view_value()
Array ( [#markup] => [#access] => 1 )

When I'm using the above function for other fields it works as expected, for instance when rendering a image field like this:

print <theme>_render_field($node, 'field_image', 0,
                     array('type' => 'image',
                           'settings' => array(
                           'image_style' => 'object_200x300',
                           'image_link' => 'content')
                           ));


texts: Add "Sale" or "Discount" text to a product display using drupal commerce?

texts:
I have been searching for an answer a long time with no success at all.

I am buildind a drupal commerce website and i would like to show on a specific products the word "Sale" or "Discount" as showing in the picture below (like the green Sale Tag).

I can do it using photoshop but is really a pain to go over hundred of product just to photoshop a "Sale" text on every product picture in question.

Can someone point me to a specific module that can do such job ?!
Note that i know basic CSS so if this could be done using some CSS code, a starting push from any body will be appreciated !

Thank you,


texts:
I use the Image URL Formatter module for my custom Views. The Views settings look like so:
Setting field:

Setting custom text:

This is the result I get:

Inspect html

http://example.com/sites/default/files/color-placeholder/team-1.jpg
)"&gt;

  Kate Benke
  Back-End Developer

How should I correct my config to use mage URL?
Note: I don't want override template.


texts: Filter a view by the Group ID of the current logged in user

texts:
I have been looking for an answer for 3 days with no success.

Looks like this is a common requirement among plenty of Drupal 8 projects with not a single answer accross the internet about how is possible to achieve it.

I, as user id 1, created 2 groups titled: "Basketball" and "Football" of the group type (sports) and then I added some users as members to those two groups...

So I have something similar to:

Group Title: Basketball

Group Members:

User A (whatever role)
User B (whatever role)
User C (whatever role)
User D (whatever role)

Group Title: Football

Group Members:

User 1 (whatever role)
User 2 (whatever role)
User 3 (whatever role)
User 4 (whatever role)

Now, what I really want to accomplish using views is to show a table with the names of all available members registered at the same group of the current logged user.

So if for example if User D is the current logged in user, I want to show him a table displaying:

User A
User B
User C
User D

without showing up the other members from other groups like user 1, user 2...

and for example if User 2 is the current logged in user, I want to show him a table displaying:

User 1
User 2
User 3
User 4

without showing up the other members from other groups like user A, user B...

Is that possible, and how?

I have followed this issue:
https://www.drupal.org/node/2793631#comment-11613765
but with no success!

And this question How do I show the members in a block, contextually filtered by the currently logged in user?
with no direct solution by using only the views UI.

My aim is to create an entity reference views to be called from a entity reference field element inside a webform.

UPDATE:
This issue (https://www.drupal.org/project/group/issues/2793631#comment-12808833) has a solution
On how to a list of all groups in which the current logged in user is a member.

However, for my requirement I need to show a list of all members that belong to the same group of the logged in user... so I did:

Create a page view and set the content of the view to be Group content with a url: /my-friends
Add a relationship to Group (The group containing the entity.)
Add a relationship to Group content for User (Relates to the group content entities that represent the User.)
Add a contextual filter to Group ID and when the filter value is not available set the default value to User ID from logged in user and the relationship is set to the Group content for User.

For the preview of the view, everything looks good and I, the admin, can see my name inside the display table along with all the other member with me inside the group.

However, if i log in as any other member inside this group such as: User 2 and go to the view page and receive a table with the message: no members available.


texts: I am using the Minify HTML module to compress the HTML output. Once, I enable this module and view my node page, the HTML is not compressed. Is there any additional setting for this?


texts: Drupal 7 custom block.tpl.php for specific region

texts:
I am new to drupal 7 and really struggling with this one:

http://drupal.org/node/104319

I have a region called navigation

in my .info
regions[navigation]     = Navigation bar

for this region I want to use a custom tpl.php file. I have tried

  block-navigation.tpl.php

like in the example, and put it at the theme root and in the templates folder with no luck. I've cleared the cache and insured that a standard working block.tpl.php is in place. To no avail.

ANSWER:

I needed BOTH a region--navigation.tpl.php AND a block--navigation.tpl.php with a double -- both times.

1000 views on this question earned me the popular question badge. But you guys can't find it in your heart to upvote it more than 1 time. Laaaammmmmeeee....


texts: Why my custom vocabulary by default is in Site feature?

texts:
I've created custom vocabulary and I want to export it as feature to my existing module.

When I run:

drush fc 25:

  taxonomy_vocabulary:my_vocab  Provided by: site

It's blocking me from exporting this vocab cause:

  No unexported sources match "taxonomy_vocabulary"

any chance to export it to existing module also?

I'm wonder why by default this custom vocabulary goes to Site feature. I think there should be 'Tags' vocab only.


texts: Add/edit node auto share to social networks

texts:
Is there any way to add an option to share to social networks selecting with checkboxes and with predefined messages using token that a new node has been added or than an old one has been edited?

I had an idea about rules, and the Social Share module but I don't know how to implement it.


texts: Is there a html5 video player for Drupal 6 that run well on ios device?

texts:
I need to play videos on my drupal 6 site that would run well on IOS device (HTML5?).
Is such solution available?

My site currently serving flv files using jwplayer 6.x-1.1.


texts: Need to create a RedHen Contact for each Drupal User

texts:
I'm wanting to upgrade a current site to use the RedHen CRM module to track contact engagement (etc.) but first need to create RedHen contacts (redhen_contact module) for each of the users.  I'm familiar with Drush scripts so would be fine writing up a script but I'm unfamiliar with the internals of how RedHen works in Drupal.  Is there anybody who knows it already who might be able to help point the way?

Note: This is not a third-party api. It's a CRM built within Drupal as a Drupal module. What I'm asking is the proper form to utilize the Entity API to create contacts within the RedHen CRM module programmatically.


texts: Is it possible to import the LoginToboggan settings to a feature ? Logintoboggan doesn't seem to have an api either


texts: How do you get the current directory in a command method?

texts:
In a standard Drupal 8 environment, the current working directory is override and becomes the document root of the site. This is a bit troublesome for Drupal Console command implementations that wants to know where the command is running (e.g. import command need that to resolve the given relative path of the target file).
For example:
namespace Drupal\foobar\Command;

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Console\Core\Command\ContainerAwareCommand;

/**
 * Class ImportCommand.
 *
 * Drupal\Console\Annotations\DrupalCommand (
 *     extension="foobar",
 *     extensionType="module"
 * )
 */
class ImportCommand extends ContainerAwareCommand {

  /**
   * {@inheritdoc}
   */
  protected function configure() {
    $this
      ->setName('foobar:import')
      ->setDescription($this->trans('Import something'))
      ->addArgument('file', InputArgument::REQUIRED, 'The file to import');
  }

  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output) {
    $this->getIo()->info('execute');

    // **** here ****
    $file = $input->getArgument('file');

    // ...
    // ...
  }

}

Now, consider a user running this command:
drupal --root=/var/www/html foobar:import ./foobar.json

You can virtually run this command anywhere in your system.
The relative path provided to argument $file (i.e. ./foobar.json) is expected to be resolved relative to the runner's current working directory. Normal PHP script can get the information from getcwd(). But in a Drupal Console environment, the function getcwd() returns the document root of the site.
The normal function getcwd() obviously don't work. Is there a way?


texts: Textarea not populating with previous value

texts:
So I have been buildign a simple form used to populate a block on the sidebar of my drupal 7 site. However I have run into a problem, the textarea on this form does not seem to populate with the sidebars previous value.

What has me stumped is that a textfield with the same defaultvalue code populates correctly.

//a debug textfield that works
$form['debug'] = array(
    '#type'        => 'textfield'
       ,'#title'       => 'Debug'
       ,'#default_value' => $sidebar_content[$key] ? $sidebar_content[$key] : ''
       ,'#description' => t('Please enter a suitable heading for the left sidebar.')
     );

//the broken textarea
 $form['body'] = array(
        '#type' => 'textarea'
        ,'#title' => t('Body')
        ,'#rows' => 15
        ,'#description'   => t('Body text for sidebar')
        ,'#value' => $sidebar_content[$key] ? $sidebar_content[$key] : ''
    );

Edit: After disabling WYSIWYG the text area started populating again. More digging revealed the reason it wasn't populating as a rich text box was because when an editor is used it submits the value as an array with two items; value and format. Consequently, this meant that the text editor was being given an array to display rather than a string.

Altering the #default_value to $sidebar_content[$key]['value'] resolved this issue.


texts:
How can I save an article or story on Drupal 7?

Is there any modules to install, or do I need to do it programmatically?

Note : This is not offline bookmarks kind of stuff, nor is it related to browsers.


texts: How to output Get Locations coordinates as a separate field?

texts:
I have Get Locations module enabled, and I would like to output the coordinates of a given location as a separate field (longitude, latitude) when displaying a given node.

Somehow like this:
GPS: 45° 59' 45.24" N, 18° 40' 47.28" E

What's the best solution to do this?
Should I use Display Suite + "Add a code field" or is there a better solution?


texts: Jquery ticker in a drupal block isn't working

texts:
I'm trying to add this ticker type to my site: http://cektkp.com/twittermarquee/.

I've created a new module to do so, and this is my module dir structure:

 module stocksTicker:
       1. stocksTicker.info
       2. js/
       3. images/
       4. stocksTicker.module

    js/:
       1. marqueeTicker.js

    images/:
       1.fade-trends2.png
       2.trendtip-pointer.gif

I enabled this module and added css to the block configuration from here: http://cektkp.com/twittermarquee/front.css.
I copied the .js file from here: http://cektkp.com/twittermarquee/twitmarquee.js to path/to/module/js/ directory.
Images are in path/to/module/images dir too.

This is my stocksTicker.module file:

/**
 * Declare what blocks are provided
 * by this module.
 */
function stocksTicker_block_info() {
  $blocks['bseTicker'] = array(
    'info' => t('BSE'),
    'cache' => DRUPAL_NO_CACHE,
  );
  return $blocks;
}

/**
 * Return a rendered view of the block.
 */
function stocksTicker_block_view($delta) {
  $block = array();
  switch ($delta) {
    case 'bseTicker':
      $block = getBSETicker();
      break;
  }
  return $block;
}

/**
 * This function does the real work of getting
 * the stocks info and marking it up & produces
 * it in a renderable format.
 */
function getBSETicker() {
  $path = drupal_get_path('module', 'stocksTicker').'/js/marqueeTicker.js';
  $content = "

Trending topics
";
  $stockEntry = array("Stock1","Stock2","Stock3", "Stock4", "Stock5", "Stock6", "Stock7", "Stock8", "Stock9", "Stock10");
  foreach ($stockEntry as &$stock) {
       $content = $content . "
" . $stock. "This
is description.
";
  }

$content = $content . "

&nbsp;&nbsp;

Trending right now:

Why?Source: What the Trend?

&nbsp;

";
  $block['content'] = array('#markup' => $content,
                            '#attached' => array('js'  => array($path),),);'
  return $block;
}

When I try to view the changes, I do get the list and I do see the css working just fine but none of the jquery feature works (scrolling/ tooltip anything..) which is the main aim of this exercise. Please tell me how can I fix this.

I'm new to drupal so please excuse any silly mistake that I might have done.


texts: Get data form into hook_node_insert / hook_node_update

texts: How to recover data from my form 'node' from the hook 'node_insert' or 'node_update'. Because I created a textfield and I can't see from the "$node" variable


texts: How to update payment status inside an order?

texts:
I am trying to update order status and payment status depending upon the value we get in a variable called $payment_status.  I am able to update order status but I am unable to update payment status inside that order. I am getting an error "The website encountered an unexpected error. Please try again later.
Error: Class 'Drupal\commerce_order\Payment\Payment' not found" The code I used is as follows:-

//update order status based on payment status
  $order = \Drupal\commerce_order\Entity\Order::load($order_id);
  // dpm($order);
  if($payment_status === 'payment.captured' ){
    $order->set('state', 'completed' );
    $order->save();
    $payments = \Drupal\commerce_order\Payment\Payment::loadByProperties(['order_id' => $order_id]);
      foreach ($payments as $payment)
      {
        $payment->setState('completed')->save();
      }
  }
  else{
    $order->set('state', 'pending' );
    $order->save();
  }

How to solve this?


texts:
I am a bit of a Drupal beginner (D7).

I used to get this error on some pages:

  Fatal error: Call to a member function set_display() on a non-object
  in
  /hsphere/local/home/ulufenci/test_directory/sites/all/modules/calendar/theme/theme.inc
  on line 656

I went to check the incriminated file and identified that this has to do with the following function:

function theme_calendar_stripe_legend($vars) {
  if (empty($vars) || !$view = $vars['view']) {
    return '';
  }

  list($view_name, $display_id) = explode(':', $view);

  $view = views_get_view($view_name);
  $view->set_display($display_id);
  $row_options = $view->display_handler->get_option('row_options');

  // MORE COMMANDS
  }

where line 656 is the one using the set_display() function.

Yesterday, I uncheck an option to use overlay for the admin pages, and now I get it on EVERY admin page. (Which incidentally means that I cannot access any admin page, so can't do much at the moment.)

I don't really know what is going on, and would appreciate any help on how to debug this.

Thank you!!!


texts: Media Gallery not using lightbox and required libraries are in place. What is wrong?

texts:
I'm trying to make a Gallery utilizing lightbox on my Drupal 7.26 site.
I've picked Media Gallery (7.x-1.0-beta8) and as it says it requires the following compulsory components to work:

Media (1.4)
Multiform (1.0)
ColorBox jQuery plugin

I've extracted a colorbox-master.zip under sites/all/libraries and renamed colorbox-master folder to colorbox. Now the sites/all looks like this.

I also have the colorbox module installed.

The images in the gallery doesn't seem to use any lightbox at all when clicked upon. I've checked a couple of other solutions elsewhere and I think I've gotten all of them covered as you can see on the screenshot above. Nothing else seems to help.

What am I doing wrong?


texts:
I have a created a content type with some fields like title,date,description etc. My issue is node block template file is working.

Content type(machine name) is - event

I have also created a special template file for this page

-- event.tpl.php

<?php print $left; ?>

 <?php print $messages; ?>
  <?php if($node->title != 'Welcome' && !$is_front): ?>
  <?php print $breadcrumb; ?> <?php print $tabs; ?>
  <?php  print $content; ?>
  <?php endif; ?>

I have created main template in the following file. So $content variable should be replaced with the following code.

Node block file name is -- node-event.tpl.php

Event Date:
  <?php
$event_date=$node->field_event_date[0]['value'];

 print $node->field_event_date[0]['view'] ?>

<?php if($node->field_event_end_date[0]['view'] != "") { ?>

Event Last Date: <?php print $node->field_event_end_date[0]['view'] ?>

<?php } ?>
<?php if($node->field_event_time[0]['view'] != "") { ?>

Event Time: <?php print $node->field_event_time[0]['view'] ?>

<?php } ?>
<?php if($node->field_event_location[0]['view'] != "") { ?>

Location: <?php print $node->field_event_location[0]['view'] ?>

<?php } ?>
<?php if($node->field_event_price[0]['view'] != "") { ?>

Pricing: <?php print $node->field_event_price[0]['view'] ?>

<?php } ?>
<?php if($node->field_event_discount[0]['view'] != "") { ?>

Early Bird Discount: <?php print $node->field_event_discount[0]['view'] ?>

<?php } ?>
<?php if($node->field_event_group_discount[0]['view'] != "") { ?>

Group Discount: <?php print $node->field_event_group_discount[0]['view'] ?>

<?php } ?>
<?php if($node->field_event_group_discount[0]['view'] != "") { ?>

Pre Requisite: <?php print $node->field_event_prerequisites[0]['view'] ?>

<?php } ?>
<?php print $node->content['body']['#value']; ?>

But this is not working. Instead, its giving generalized unaligned output.

Please help me in getting solve this issue.

-
Thanks

Syam


texts: How can a text field be re-sized by touch and drag with finger in Smartphone devices

texts:
Hello Drupal Masters,

I have used Bootstrap template for my Drupal 7 website.
When in Smartphone devices such as iPhone or Samsung phones, i tried to touch the screen using my finger to drag to resize the text field vertically (see screenshot) larger, so the text field could display all text simultaneously.

Whatever i do, I can't re-size the text field when using my finger. It works only with a mouse.

Does anyone know to make the field realizable in touch mode using fingers?

Thank you very much in advance for you tips & Tricks.

Regards
Kim


texts:
I have a view that receives two variables like my-view-url/%/%. In a menu I have created a url something like my-view-url/animals/dogs. How do I get the contextual filter to see the second variable dogs and ignore animals.

The contextual filter is set to "Content: Has taxonomy term ID (with depth)" and I convert the taxonomy term to an id.

It think it must have something to depth but I am not sure.


texts: Drupal 8 Webform URL alias with parameters

texts:
On the URL PATH SETTINGS,  I want to define the Webform URL alias to include a variable parameter e.g. /my-web-form-url/{id}
Is this possible? I want to pass this 'id' as a hidden value in the form.


texts: Migrate: how to get uid from MigrateUser

texts:
I'm using migrate module, but I don't understand how to get "uid" from my "MigrateMhtAuthor" class (it is sourceMigration setting). I have this code in my main class:

class MigrateMhtAdsMigration extends DynamicMigration {
  public function __construct() {
    parent::__construct();
    [...]
    $uid_mapping = $this->addFieldMapping("uid","utente")->sourceMigration('MigrateMhtAuthor');
    [...]
  }
}

I know that MigrateMhtAuthor works because I have imported my user with this migrate class.

I have create some "debug" point in the MigrateMhtAuthor class and this is the output when I import/migrate a node:

MigrateMhtAuthorMigration __construct
MhtAuthorDestination __construct
MigrateMhtAuthorMigration fine

[MhtAuthorDestination is a class that make the real insert. It search if the user exist (based on email check) to prevent the double email error]

So, I can see that the  MigrateMhtAuthor is call, but when I go to see the uid of the node that I have just imported/migrate I see "1" (uid = 1).

Where is my error ? If you want to see my classes can I insert a link to pastebin?

EDIT:

I have found a way, but I don't understand why in this way works.

The new code is:

class MigrateMhtAdsMigration extends DynamicMigration {
  public function __construct() {
    parent::__construct();
    [...]
    $uid_mapping = $this->addFieldMapping("uid","uid2");
    [...]
  }

  public function prepareRow($content_row) {
    [....]
     $current_row->uid2 = $this->handleSourceMigration('MigrateMhtAuthor',$current_row->id);
    [....]
  }
}

So, I don't understand what "sourceMigration()" mean if I need to use "handleSourceMigration" in prepareRow() function.


texts: Change the label of the referenced node in teaser view mode

texts:
I'm using Drupal 7 and Entity Reference

I have a node, which references another node.

In the teaser view mode, I need to change the label (link) to the referenced entity (to replace the title of this entity by a generic expression of the type "see the referenced node").

Do you have a solution?

Thanks in advance


texts: Redirecting user after login when using the ip_login module

texts:
I'm trying to show a different frontpage to users of a specific role, using the Front Page module (version 6.x-2.0-rc1) in alias mode. This works fine for users that are already logged in, but the problematic point now is that I'm also using the IP Login module (version 6.x-1.2) to log in certain users based on their IP address. This login seems to work differently from the usual login via the /user page.

Those users that are logged in via IP, they first get the normal frontpage that anonymous users get, they are not redirected automatically to the special frontpage I defined using the Frontpage module. If they reload the frontpage they are already logged in now and they see the special frontpage as intended.

The usual ways of using the Rules module or the Login Redirect module to redirect the users after they login just don't work, the users are not getting redirected when they are logged in via IP address.

Any ideas on how I could work around this problem, so that users logged in via IP see the special, redirected frontpage directly after openening the page?


texts:
The following successfully calls a REST Services Module endpoint when contained in a module but I cannot get it to work within the script tags of a basic page.

(function ($) {

  var myapi = {
    'apiPath': '/api/award'
  };

  // REST functions.
  myapi.create = function (award) {
    $.ajax({
      type: 'POST',
      url: 'http://localhost/testsite/api/award',
      data: JSON.stringify(award),
      dataType: 'json',
      contentType: 'application/json'
    });
  };

  myapi.create({ award : 'The Award' });

}(jQuery));

I am wondering if it is even possible to embed AJAX calls in a Basic Page.

Thanks for any help,

Orville


texts: Copy blocks from one drupal installation to another

texts:
With a lot of help from the users of this forum yesterday I managed to get my local installation running.

I have copied across the theme from the site I wish to base mine on (with the permission of the theme owner, so nothing dodgy is going on).

But when I go to Blocks, there are none present. If I look in the admin on the old site, there are a number of blocks that appear in the header (menu, search bar and so on). If I click on create new block on my install I get a blank form. Is there any way to copy existing blocks from the install I am mimicking to mine?


texts: How to create a squeeze page for attached files under Drupal 7?

texts:
I have a content type set up in my Drupal 7 site which has an attached file. As it currently stands, this file can be freely downloaded without requiring a user account.

I do not want to require users to create an account on this site, but I would like to set up a 'squeeze page' for the newsletter/mailing list. That is, when someone decides to download the file, I'd like to present a dialog or screen a bit like this:

  Enter your email here to sign up for our email newsletter:

  [_____] [Sign up and Download]

  OR

  [No thanks, I'd just like the file]

I found two modules which would have worked if I were using Drupal 6 - Webform Protected Downloads and Squeeze Page, but no equivalents for Drupal 7. I was considering using the Custom Formatters module and a light box/dialog of some sort to jury rig it, but then I'd still need to code something to save the emails out again.

Is there a more elegant solution out there for this requirement? I am capable of coding new modules myself if that's the only option, but the less new code I need to write for this the better. Perhaps there might a module or combination of modules which comes close, which I could then tweak or modify?

Thanks in advance!


texts: How can I change the date format in the webform submission section?

texts:
I know this is a simple question. The rest of the date fields on the site match the right format dd/mm/year.
However, the dates in the submission info section of webforms are in a different format. This is the only part of the website that appears in a different format.
I have read on another thread that this time is stored first as unix timestamps and then displayed in this location. Should I be changes this in the database?


texts:
On Drupal 7 I have tested many modules, because I simply want in the user view some fields which are public and others can only see friends (user relationship or flag friend, ...).
would be nice if I had a fieldgroup 'open' and 'friends' with the correct permission.

Because it is not running yet, I want by register a new user creating and assign a role named role_userID. These I want do with a rule but I can't do it... After this I can give every friend of this person his role, that they can see the fields.

Or is not a good idea?
How can I do that?
Thanks
Thomy


texts: How to open a image when the site loads like in this site. Can this be done wtih lightbox or colorbox


texts: user.routing.yml -- What is the significance of "_entity_form: user_role.default"?

texts:
In user.routing.yml, I'm not able to understand the line 83.

user.role_add:
  path: '/admin/people/roles/add'
  defaults:
    _entity_form: user_role.default
    _title: 'Add role'
  requirements:
    _permission: 'administer permissions'

What does _entity_form: user_role.default mean?


texts:
I have a view in Drupal 8 as below.
[The date column in below list, is not an event. its order item. so date showing is order complete date only]

When I filter with start and end date, the data shown excludes the end date. It just shows the in-between records, but it does not include the end date.
I am unable to figure it out from the code.

Any help?


texts: Cron stopped running; logs say: "Attempting to re-run cron while it is already running."

texts:
What are the steps to troubleshoot and resolve this issue as per title?

When I try to run manually, I get a  page immediately, and the error message "Attempting to re-run cron while it is already running."


texts: How to create an article -> issue -> magazine hierarchical structure with Entity Reference?

texts:
I'm using the Entity Reference module to create a magazine archive website.

The structure is like that: article <- issue <- magazine.

All of these are different content types.

What I want to do is to create a hierarchy while adding articles.

Each issue is referenced to a magazine.

Each article is referenced to an issue (and dependently to a magazine).

While creating an article I want to select the magazine (referenced field) and then select the issue (referenced field) based on the magazine.

How can I do this?

(I tried both the Hierarchical Select and Conditional Fields modules but they do not do what I want.)


texts: taxonomy term path using two different vocabulary

texts:
I have a "destination" vocabulary and a "category" vocabulary.
Is there a way to change the taxonomy term path of the "category" terms to include the "destination" terms in front?

i.e. destination_term/category_term/term_title

I tried using tokens but I can't figure out how to add a different vocabulary in front.

UPDATE

Here's the situation:

I have a travel site with a main portal going to 4 different destination pages (all view pages), each set with a term reference from "destination" vocabulary. Then I have a content type for  Categories, set with a term reference from "category" vocabulary (restaurant, activities, etc).

I actually have two problems:

I can't seem to have a "destination" path preceeding the "category", which I need to make blocks appear in the right place. (the only way that I found to do this is by cheating and adding a hidden destination term in my category voc. but that means I would have to copy/repeat the "category" voc. 4 times with a different hidden "destination" term in each. That doesn't make much sense now does it? I'm sure there's a better way. Anyone?
The other problem is that except for the above part, I am able to make the paths and breadcrumbs appear the way it should (with the help of Pathauto, Taxonomy Menu & Taxonomy Menu Trails modules), but when I get to the actual content, there's nothing in the breadcrumbs anymore (the url path shows up ok though)! Any suggestions?

Any help is greatly appreciated.


texts: How to setup Drupal Performance Monitoring to Bypass Varnish?

texts:
I have lots of uptime problems with my Drupal hosting company this month.
Most of the time my Pingdom monitor doesn't even alert of the problem because Varnish is still able to serve a cached homepage.

How can I bypass Varnish to check true health of the Drupal instance? They have a username/password option but I'm sure that's for the http username/password and not for a form based login.
If I specify a fake session cookie I could bypass Varnish but then Drupal would just redirect me to the home page?


texts:
I am looking for a way to add some logic to a view's (styled as Jump Menu) selection options. The View's UI allows me to "output this field as a link" but I need to do something like this:

if (current_url == 'something') {
  link_here();
}
else {
  link_there();
}

Basically all I want to do is to figure out where to theme (a template or other files) the following part:

<option value="6ee3dbb066bb38cb7fb90872a6f0144e::/Cakes/AllCakes/[tid]">Chocolate</option>


texts:
I am running into the below issue :

  The website encountered an unexpected error. Please try again
  later.InvalidArgumentException:
  Class "\Drupal\cognito\Form\Email\UserLoginForm" does not
  exist. in Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition()
  (line 24 of core/lib/Drupal/Core/DependencyInjection/ClassResolver.php).

I installed the Cognito module.
Its not properly built yet hence on installing it throws an error did not allow me to login into back end.
I tried to manually uninstall the module by deleting the folder and
then i cleared the cache through drush.
Tried re-installing and un-installing the cognito module with Drush
commands as well but still throws the same error.

But this is the error that i get even on clearing the cache.


texts:
I am using drush on ubuntu 14.04. I have more than 20 site on my localhost /var/www with virtualHost setting. I have a question that whenever i go to /var/www/site1 and run drush dl module_name. It download the module in sites/all/modules directory in site1 folder. Now i cd to /var/www/site2 and run drush dl module_name. It will again download the module in site2 module directory.

In every site i have to do drush dl for same module. Is there any method so that i don't need to do drush dl every time. I just do drush dl module, it will check from all other sites for particular module, if not found then will download from internet. I already doing cp and scp for same module. But i want to do with drush.
I am very greedy to save my internet bandwidth.

Thanks in Advance.


texts: How do I programmatically add a field to a Transaction in Drupal Commerce?

texts:
I am attempting to add a field to the entity commerce_payment_transaction.  However, when I check the database after installation which should create the field, there is no field_data_ created, nor is there any field on the entity commerce_payment_transaction.  I have successfully used code similar to the following to create field on the Commerce Order.  Do I have the bundle wrong for the instance?

Here is my code.

During the install, I create the field and its instance.

function commerce_stripe_connect_c_install_install() {

$field_info = field_info_field('tr_vendor_user_reference');

$field = array(
        'field_name' => 'tr_vendor_user_reference',
        'type' => 'user_reference',
        'cardinality' => 1,
        'entity_types' => array('commerce_payment_transaction'),
        'translatable' => FALSE,
        'settings' => array(
                //must have the referenceable_status defined or the user reference won't work
                'referenceable_status' => array(
                        0 => 0,
                        1 => '1',
                ),
        ),

);

if (empty($field_info)) {
    field_create_field($field);
}

$instance = field_info_instance('commerce_payment_transaction', 'tr_vendor_user_reference', 'payment_method');

//I check if the vendor_user_reference has already been created on the commerce_product
if (empty($instance)) {
    $new_instance = array(
            'field_name' => 'tr_vendor_user_reference',
            'entity_type' => 'commerce_payment_transaction',
            'bundle' => 'payment_method',

            'label' => t('Transaction Vendor User Reference'),
            'required' => TRUE,
            'settings' => array(
                    //This is required so that vendors will be available for programmatically selecting
                    //for a product
                    'referenceable_status' => array(
                            0 => 0,
                            1 => '1',
                    ),

                    'view' => array(
                            'args' => array(),
                            'display_name' => '',
                            'view_name' => '',
                    ),

            ),
            //The widget will not show up because it is hidden later on, but this is needed so that
            //a default value can be chosen
            'widget' => array(
                    'active' => 1,
                    'module' => 'options',
                    'settings' => array(
                            'apply_chosen' => '',
                    ),
                    'type' => 'options_select',
                    'weight' => '40',
            ),

            'display' => array(),
    );
    field_create_instance($new_instance);
}


texts: Do PHP static variables persist across Batch API batch items processing?

texts:
Do PHP static variables, which do persist during a normal page request, persist between progressive Batch API runs? What about during non-progressive (command-line) batch execution?  Does &drupal_static come into play in any way?

In my application, I want to take advantage of in-memory caching across batch processes.


texts: How to get each field value in views-views-unformatted--view-machine-name.html.twig?

texts:
I have an twig file: views-view-unformatted--view-machine-name.html.twig

{#
/**
 * @file
 * Default theme implementation to display a view of unformatted rows.
 *
 * Available variables:
 * - title: The title of this group of rows. May be empty.
 * - rows: A list of the view's row items.
 *   - attributes: The row's HTML attributes.
 *   - content: The row's content.
 * - view: The view object.
 * - default_row_class: A flag indicating whether default classes should be
 *   used on rows.
 *
 * @see template_preprocess_views_view_unformatted()
 *
 * @ingroup themeable
 */
#}
{% if title %}
  <h3>{{ title }}</h3>
{% endif %}
{% for row in rows %}
  {%
    set row_classes = [
      default_row_class ? 'views-row',
    ]
  %}
  <div{{ row.attributes.addClass(row_classes) }}>
    {{ row.content }}
  </div>
{% endfor %}

I want to have Title and body field to be in 1 line separated by comma like:

title, body

How can I get value of 'title' or 'body' or any other field in this view while debugging?

I used kint(title) and kint(body) but it's not working. I also made debug = TRUE; in services file.

But can't figure out the way of having fields value in unformatted html twig.


texts: How to get taxonomy term name/label from a field?

texts:
Ok, so I'm trying to populate a field based on the selection of a taxonomy term. I've mainly got it working thanks to this stack exchange article
use Drupal\taxonomy\Entity;

function module_entity_presave(EntityInterface $entity) {

  if($entity->bundle() == "node_type"){
    $bread_slice = $entity->get("field_taxonomy_term")->getString();
    $bread_butter = "- Additional Text for Reasons";
    $bread_title = $bread_slice." ".$bread_butter;
    $entity->field_title->value = $bread_title;
    //save is done automatically
  }

}

The issue is that, the resulting code doesn't print the name/label of the term, but instead the tid. So, it ends up showing as "757 - Additional Text for Reasons" I barely know any php, but I know enough to get around. I suppose my issue is the fact I'm not getting the correct value from the taxonomy array, yet I'm unsure how. I've tried finding the correct value using some twig debugging, {{dd(data.taxonomy_term)}} but all the values for it show null. Please point me in the direction of how to solve this?


texts: how to know if the page i am on is a node or not

texts:
with a custom module, in drupal 8, how can I test whether I am on a node entity or not, when i browse to that page?

If I do this  $node = \Drupal::routeMatch()->getParameter('node');  I get an error if i'm not on a node.


texts: Make email validation message in drupal 7 webform come out in spanish

texts:
I have a webform in spanish and I have manually put in all of the validation error messages in spanish, however I cannot find where I can make the "Please enter an email address" message which comes out if you put an invalid email into an email type field come out in spanish instead.

Thank you


texts: Add a term under a vocabulary when a content of particulr type is added

texts: I have a vocab like 'category'. I want to add terms under this dynamically i.e when a content of type 'category_list' is added a term with this content title should be added under the 'category' vocab. Can this be done?


texts: How to merge more than one profile type within registration page?

texts:
So I am using profile2 module to create different types of user profiles

for example

personal information profile
contact information profile
team profile - team role
member profile  - member role

contact information profile is a common profile (fields) between team user and member user

I created a registration page for each role using profile2 registration path module, in this module I can only create one registration path for each profile which will combine Drupal account fields with profile2 profile fields.

Current registration pages as follow:

team profile registration page
member profile registration page

Now I want to include/merge contact information profile fields with team and member profiles in the registration page without creating redundant fields for each profile.

Any helpful ideas


texts:
By default the command:

drush dl <drupal-version>

will download the specified version of drupal from the internet. Is it possible to reconfigure drush so that dl looks to a local repo for the require drupal version?


texts: Media module, file usage, and simpletest

texts:
I'm trying to write a test that will do the following:

Create a user
Create an 'article' node
Upload a file via Media module
Insert that file into the body via pre-determined markup
Save the node
Load file usage info to ascertain usage was incremented on node save.

I know all this stuff works right when I test manually.

I know creating a user, letting that user create an article, and saving the node with custom body text works in the automated test.

I'm stuck on how to upload a file via the Media module's media library, the same way it would do if you pressed the 'media browser' button in a WYSIWYG editor that's set up to work with Media.

Ultimately I'd like to be able to test all the features of the latest patch in this issue: https://drupal.org/node/1268116 .

How do I include this type of file upload in my simpletest? I can't use the built-in file upload field because that would mess up testing of Media's handling of file usage tracking.


texts: View date filter using years as an offset

texts: Is there a way to use years as a date filter offset?  What I want is to set it so that it it loads all content from the start of the previous year. So >= 01-01-2017 this year, >= 01-01-2018 next year, etc.  Is there a way to do that in the View configuration so that it's dynamic?  I'm sure I could do it with custom code by altering the query, but I'd rather avoid that.


texts:
Conceptually and for performance purposes it is advisable to reuse existing fields in Drupal. This is very easy to do manually, but my question is, how can I do this programmatically?
I have the following code:
$all_bundle_fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('taxonomy_term', $vid);

if (!isset($all_bundle_fields['field_image'])) {
  FieldStorageConfig::create(array(
    'field_name' => 'field_image',
    'entity_type' => 'taxonomy_term',
    'type' => 'entity_reference',
    'settings' => [
      'target_type' => 'media',
    ],
    'cardinality' => 1
  ))->save();

  FieldConfig::create(array(
    'field_name' => 'field_image',
    'entity_type' => 'taxonomy_term',
    'bundle' => $vid,
    'label' => 'Logo',
    'description' => 'Logo to represent the term.',
    'required' => FALSE,
  ))->save();
}

In this example, I extract all the fields from the vocabulary and only create the field if and only if it does not exist previously in this vocabulary. The above code works.
What does not work here is if that field has already been created for another entity or vocabulary. This is what I would like to find out in order to make a complete reuse of the fields.
Thanks in advance.


texts: How can I make URL Alias required when creating new content

texts: When a user creates a new article they often forget to put in the URL path alias for the article. How can I make that field required before they can save the content?


texts:
In Drupal 8, I'm getting an exception 'InvalidArgumentException' with message 'The form argument system_theme_settings is not a valid form.'

The story is: I can't add custom colors to my installation profile because of the color module not setting the configuration until a form submit on the theme's settings is called, so I got the form_id with hook_form_alter(), added a custom form_submit handler and serialized the form_state variable into a file (because form_state was gigantic and I had no idea how to find the useful values in there) and loaded it with unserialize() in my installation profile.
(Kind of reminiscent of this issue:
https://www.drupal.org/node/1963922)

Then, I ran:
\Drupal::formBuilder()->submitForm('system_theme_settings', $form_state_variable);

And was told by Drupal that 'system_theme_settings' isn't a valid form.  But, how can this be true, if I already added a custom form submit handler to this form using this very form_id?

If I'm not supposed to use a form_id, but rather a specific function or something like that, where should I look to find this function?


texts: How can I reduce the initial load of page?

texts:
I've been monitoring the speed of my site load on Drupal 7 and I would like to increase its initial loading speed. Currently it takes 6 seconds just to get data from the server. What is the first page called? In total it takes about 10 seconds for my site to load.

What methods are there to reducing this initial startup load time? I've tried boost, but I can't use it as it renders all my webforms useless. I've already used the lazyloader module for images and enabled gzip aswell.


texts: Custom Views Relationship with Custom Entity

texts:
I have custom entity with just a base table and it is referenced with the node with its field field_a. Now I want to create the relationship between these two entities (node and my custom entity). I can get the result working but I am not getting the node fields listed in the views field section.

// Base table for custom entity is "clinical_trial_research_sites"

function clinical_trial_views_data_alter(&$data) {
 $data['clinical_trial_research_sites']['node'] = array(
    'title' => t('Clinical Trial'),
    'help' => t('Field Reference Appear in Location Content type.'),
    // Information of the referenced table!!
    'relationship' => array(
      'handler' => 'views_handler_relationship',
      'label' => t('Location'),
      'base' => 'field_data_field_site_comp_code', // node field table name
      'base field' => 'field_site_comp_code_value', // field column name of node field
      'relationship field' => 'site_comp_code', // This is referencing field in my custom entity
    ),
  );
}

I can get the sql working , inner join working but views is not listing all the fields of the node as I want to display the some of the fields from the nodes too!!. I think I am missing some information to tell the views that realtionship is not only field table but with the node as a whole!!


texts: entity:file:undefined" plugin does not exist upload using curl to jsonapi

texts:
I'm using php_curl to POST a binary image to my local D8.8 app but it keeps returning a 500 error:

  The "entity:file:undefined" plugin does not exist. Valid plugin IDs
  for Drupal\Core\TypedData\TypedDataManager are: helpful list of D8 entities.

Using the example "Flow 1" from this doc page, I started out with this:

     $binary = file_get_contents('Wilson.jpeg');
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL,'http://localhost/jsonapi/node/doctor/field_photo');
      curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
      curl_setopt($ch, CURLOPT_USERPWD, "admin:mypwd");
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_VERBOSE, 1);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $binary);
      curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/octet-stream',
        'Accept: application/vnd.api+json',
        'Content-Disposition: file; filename="Wilson.jpeg"',
        ));
      curl_setopt($ch, CURLOPT_POSTFIELDS, $binary);
      $result = curl_exec($ch);

Searching I read that D8 is more strict about entity bundles, I can report that my field_photo for the doctor content type is instantiated as an image. Examining my app's /admin/structure/file-types/manage/image/edit
I can see in the Known Mime Types section that application/octet-stream and image/jpeg exists and standing by. Rereading the error Drupal seems to perceive that this is a file but isn't clear what kind it is. I thought I was being clever and changed the Content Disposition from 'file' to 'image' but no such luck. Exact same error returned. Swapping it out to one of the suggested to 'entity:file:image' did not change the error message.
It suggests to me that I need to do something in this curl header to prompt Drupal to understand that this is a file that has a plugin established for it.

Digging into the stacktrace I see that it's generating "entity:file:undefined" because the Bundle property for this entity is "undefined". Working backwards, in context of the doctor node definition, the field passes through the MimeTypeGuesser class has figured out that it is a jpeg and its attributes. But this gets lost when passed to the TemporaryJsonapiFileFieldUploader where it attempts to validate the File.

I've attempted adding "application/octet-stream" as a second entry underneath the "image/*" on the /admin/structure/file-types/manage/image/edit page but nothing changes. How should I associate its bundle to "image" so that I end up with "entity:file:image" and I can move on?

One thing that bothers me is that file uploading was added to the 8x-2.x branch and I'm reading that it is part of core. I'm on 8.8.5 and am assuming I have the latest after running composer update.  I've checked some of the file diffs on jttps://git.drupalcode.org/project/jsonapi/ and it appears the files I'm working on are current, but it bothers me that I haven't resolved this. The json output from this module returns "jsonapi":{"version":"1.0" which is an indicator of the external jsonapi specification, not the drupal module.


texts: Drupal site does not show well when SSL is enabled

texts:
We have our site hosted on our Virtual Ubuntu 12.0 LTS. I am converting it to HTTPS. We are using Secure Login so that anonymous sessions are via HTTP or HTTPS and authenticated sessions only via HTTPS.

When I enable /var/etc/apache2/sites-available/site-ssl ->

On IE, I get this message "Only secure content is displayed" Click here to show all content for every page we navigate to. When I accept to show all content, the website renders on IE 11.

The CSS is not being picked up at all on a chrome browser ( Version 34.0.1847.116)

I have attached the screen of the site. You will see the menus are not in place. The flex slider images are one below the other.

Any ideas or help to fix this is appreciated !


texts:
I had following code in template.php this is in function bartik_process_page(&$variables)

 $main_menu_tree = menu_tree_all_data('main-menu');
 $variables['main_menu_expanded'] = menu_tree_output($main_menu_tree);

and in page.tpl.php

<?php if ($main_menu): ?>

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

        <?php endif; ?>
                          <?php if ($main_menu): ?>

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

        <?php endif; ?>
                            <?php if ($main_menu): ?>

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

        <?php endif; ?>

and output it is like this in bartik

1

Home

2. Now u can see i m getting
 extra

Home

Any idea how can i stop it


texts:
Is there any module that will help me create a drop-down menu and list as shown in the following picture ?

I want to connect this with registration page.


texts: Can I track embedded pdf's in statistics module

texts: Client has pdf's embedded in pages. They want to track pdf clicks. Statistics tracks nodes and there are add-on modules that track file field clicks, but I haven't seen anything within Drupal to track the embedded files. Any suggestions?


texts: How can check if current user is node author in node template

texts:
I am using Drupal 8. I would like to check if user (anonymous or logged user) is node author in node.html.twig, like below:

{# node.html.twig #}
  {% if is_author %}
    You are node author
  {% else %}
    You are not node author
  {% endif %}

Below codes not work:

/**
 * Implements hook_preprocess_HOOK().
 */
function MYTHENE_preprocess_node(&$variables) {
  $global $user;
  if ($variables['node']->uid == $user->uid) {
    $variables['is_author'] = TRUE;
  }
  else {
    $variables['is_author'] = FALSE;
  }
}

How could I create variable 'is_author' in node.html.twig?


texts: Trying to configure parent link and child links in menu

texts:
I'm trying to create a submenu in the same way shown in the screenshot
module.links.menu.yml:
custom_forms_entity_export_csv.export:
  title: 'Export'
  description: 'Export Menu'
  route_name: custom_forms_entity_export_csv.export
  parent: commerce.admin_commerce

custom_forms_entity_export_csv.export_sales_form:
  title: 'Export Sales'
  description: 'Export Sales to a CSV file.'
  route_name: custom_forms_entity_export_csv.export_sales_form
  parent: commerce.admin_commerce

custom_forms_entity_export_csv.export_menu_form:
  title: 'Export Menu'
  description: 'Export Menu to a CSV file.'
  route_name: custom_forms_entity_export_csv.export_menu_form
  parent: custom_forms_entity_export_csv.export

module.routing.yml
custom_forms_entity_export_csv.export:
  path: '/admin/commerce/export'
  defaults:
    _controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage'
    _title: 'Commerce'
  requirements:
    _permission: 'access commerce administration pages'

custom_forms_entity_export_csv.export_sales_form:
  path: '/admin/commerce/export/sales'
  defaults:
    _title: 'Sales'
    _form: \Drupal\custom_forms_entity_export_csv\Form\SalesExportCsvForm
  requirements:
    _permission: 'use custom export csv'

custom_forms_entity_export_csv.export_menu_form:
  path: '/admin/commerce/export/menu'
  defaults:
    _title: 'Menu'
    _form: \Drupal\custom_forms_entity_export_csv\Form\MenuExportCsvForm
  requirements:
    _permission: 'use custom export csv'

module.links.task.yml
custom_forms_entity_export_csv.export_sales_form:
  title: 'Download Sales'
  base_route: custom_forms_entity_export_csv.export
  route_name: custom_forms_entity_export_csv.export_sales_form
  weight: 100

custom_forms_entity_export_csv.export_menu_form:
  title: 'Download Menu'
  base_route: custom_forms_entity_export_csv.export
  route_name: custom_forms_entity_export_csv.export_menu_form
  weight: 100

But all I end up with is all three links, Export, Export Sales, and Export Menu as children under the same Commerce menu, like shown here:

What I want is for Export to have an arrow on the right to expand a submenu containing Export Sales and Export Menu.


texts: Add interval to current date and dispay result in views

texts:
I have a field in one of my content-types that contains a interval (using the interval module). I have configure the field so that the user can select how many years a curtain certificate should be valid.

How can I add this interval to the current year and count how many results I got using views?


texts: How to allow a role to block other users?

texts:
Looks like there still isn't a great anti-spam solution for D7 ;-(

I already have flags for nodes and comments with automatic unpublish once enough users flag it.

I want to be able to give users of a certain role the permission to block other users and possibly unpublish any content of that user.

I don't see a permission for "block user". How can this be done?


texts: Font Awesome not working in my sub theme of the Open Framework theme

texts:
I have created a sub theme of Open Framework and everything seems fine, except for the Font Awesome feature. I add the following HTML in a block, but no icon shows up.

<i class="fa fa-facebook-square"></i>

Is there something I need to do in order to enable Font Awesome?

Edit:
I can see the following in the source of my page, and I have verified that the path to font-awesome.css is valid.

<style type="text/css" media="all">@import url("http://www.example.com/sites/all/themes/open_framework/bootstrap/css/bootstrap.min.css?n2r8cn");
@import url("http://www.example.com/sites/all/themes/open_framework/bootstrap/css/bootstrap-responsive.min.css?n2r8cn");
@import url("http://www.example.com/sites/all/themes/open_framework/fontawesome/css/font-awesome.min.css?n2r8cn");
@import url("http://www.example.com/sites/all/themes/open_framework/css/open_framework.css?n2r8cn");
@import url("http://www.example.com/sites/all/themes/open_framework/css/ie.css?n2r8cn");
@import url("http://www.example.com/sites/all/themes/open_framework_triangle/css/frontpage.css?n2r8cn");
@import url("http://www.example.com/sites/all/themes/open_framework_triangle/css/views.css?n2r8cn");</style>


texts: Prevent redirect to admin/structure/types after adding content type

texts:
Whenever I submit a form at e.g. admin/structure/types/add, or admin/structure/types/manage/article, or admin/structure/types/manage/page/fields, I am redirected to the admin/structure/types overview page. This is quite annoying.

Is there any existing solution to prevent this redirect?

I know I can use hook_form_alter(), but I was wondering if others feel the same way, and if maybe someone has created a module for it.

If enough people share my pain, I might even do it myself :)


texts: Twig: How to show static text in the template to the Anonymous User?

texts:
On a Drupal 8.9.13 website, I've removed the permission "View published content" from the Anonymous user.
By default, when someone visits the front page, Drupal will then display:

Access deniedYou are not authorized to access this page.

I want to replace this with some other text, e.g.

Please create an account to see our content.

To do this I try to create something like this in page--front.html.twig.
{% if not logged_in %}

Please create an account to see our content.

{% endif %}

However, I am stuck .

I am not able to get rid of the "Access denied" text for the anonymous user.
I can't get the the text "Please create an account to see our content." to show for the Anonymous user.  (If I remove "not" from the if-test it shows up as expected on the front page for the Authenticated user).

The site's theme is an otherwise unmodified subtheme of Bootstrap Barrio 5.1.4, but I don't think the problem is theme-dependent. Rather, the problem is that I don't understand the interplay between Twig and permissions (IMHO, there should be none).


texts:
While I was studying hook_menu, I came across menu item types and I found that there are 6 types of menu item types as follows :

1] MENU_CALLBACK

2] MENU_DEFAULT_LOCAL_TASK

3] MENU_LOCAL_TASK

4] MENU_NORMAL_ITEM

5] MENU_LOCAL_ACTION

6] MENU_SUGGESTED_ITEM

I have read the documentation on Drupal.og and doc says that we have different application of each menu item type.

But I am not able to differentiate when to use which menu item type?
can I anyone help me to understand that which menu item type should be used ?

If any one explains use of each menu item type with example then it will be appreciated.


texts:
running Drupal 7.65.

Our previous website manager moved us from Drupal 6 to Drupal 7 and cleaned up the file structure on our server.

While all the files that are now on our website have clean and organised URLs, and all general URLs on our website are now clean, Google still has indexed our old URLs.

e.g.:

  old: domain.com/program-name

  new: domain.com/programname

and

  old: domain.com/sites/default/files/documents/owl-final-final3.pdf

  new:
  domain.com/sites/default/files/folder1/folder2/owlguide.pdf

So if someone googles 'program name' or googles for our 'owl guide', the Google result takes them to the old URLs (broken links) rather than the new URLs.

Is there a way I can redirect these broken links to e.g. a search page on our website, rather than the "404 page not found" page?

For some of the old URLs to our pages (e.g. /program-name rather than /programname) I've been able to set up URL aliases to redirect people but don't know how I can do so for the files when there are so many that I wouldn't be able to work out.

Sorry if I haven't used the right words, I'm not a web developer! I looked into Pathologic but don't think it addresses the problem we're having...


texts:
When I try to edit a page that already added am getting an extra text area movable widget as shown in below screenshot.

Is it a bug or an issue with the settings in for the content type page?


texts: Confirmation popup before delete file/image

texts:
I'm working on a D8 project and in many cases I use file and image upload fields.

The files and the images are visible above the field and the user can delete them by using the default 'Remove' button.

What I want to do, is to add a confirmation popup asking if they really want to delete that files/images.

Is there any hook that I could use to make that check?
If I use javascript, how can I say to drupal that now can proceed to deletion?

Thank you in advance.

EDIT:

I tried to do what @Ivan suggested but I can't make it work.
My form has submit and ajax callback. Should I alter both?

Is there any working example? I am so desperate!!


texts: What causes DatabaseSchemaObjectExistsException error on existing table while reverting feature?

texts: When trying to revert my updated exported changes on features from development site to production site via Drush, it returns DatabaseSchemaObjectExistsException error stating that there is an existing table already on the schema. Revert could not be completed, so the feature field_base component status is always Rebuilding. Shouldn't features detect if the table is already existing and ignore field creation if it already is? What could have caused this issue? Any possible workaround for this issue?


texts: How do I create a "quick post" bookmarklet for use with Drupal 7?

texts:
I'm trying to create a bookmarklet. This is not working:

javascript:window.location="http://domain.com/node/add/content_type?title="+encodeURIComponent(document.title)

The Prepopulate module is not ported for D7. Any recommendations?


texts:
I'm learning twig and using it to format and style my fields. The problem I am running into is that I need to create a new twig template for each individual field.

In the example picture, I have field--parent-task.html.twigwhich allows me to edit 1 field (or the first field), but I will need to create 6 more templates with identical code structure, just to style and move the fields around.

Is there a more efficient way to do this? In the end, I will have 7 templates just to target different fields, but yet they are all on the same page. I know I can target classes, say field__label, but that is not what I need, since I will be moving these fields around, giving them unique positions on the page.

If it cannot be done and this is how it is in D8, that is fine, I will deal with it. But if not, is there a better approach? So I don't end up having a endless list of field templates just to add/tweak a few css styles?


texts: A little calendar icon to show when something was posted?

texts:
I seem to recall trying a theme - I forget which; maybe Marinelli? - where each post on the from page had a nice little calnedar icon with the day and month of the pst.

Is that a module which I can use on other themes?


texts:
I have a custom content type which allows one file to be attached to it. In the teaser of the node I want to fine-print the date of the file's (rather than node's) last modification and its size. How can I access those properties in a suggestion template file or in the field-based View that generates the list of teasers?

I am using Drupal 7, and version 7.x-3 of the Views module.


texts: Date filter using $row data doesn't return any result

texts:
I am trying to filter my view by using a date range so that it shows all the activities for an event for which Activity Start >= Event End & Activity End <= Event Start.
To do this I have set up a view to show all the activities with a contextual filter to allow the event dates to be accessed.
I added the 4 fields to my table: Activity Start, Activity End, Event Start, and Event End.
My $Row data when adding a Global:PHP filter criteria now has the four variables accessible to carry out the comparison above.

Activity Start: $Row->field_start_date_and_time
Activity End: $Row->field_start_date_and_time_1
Event Start: $Row->field_start_date_and_time_2
Event End: $Row->field_start_date_and_time_3

I am using views_php 7.x-2.x-dev, which fixed the issue of $row not populating.
I am trying to write the above comparison in PHP and I am not getting what I expected. (I thought this would be the easy bit; I have spent a long time getting this far.)
However, it appears that the date format is not being read correctly as it is not returning any result. I have done some research which would indicate it might need to be in Unix timecode to do the comparison accurately.
Is this correct? What does the code look like to do it?


texts:
I'm new to Drupal, and I'm using Organic Groups to make groups. The site is supposed to be a multi-blog platform where groups can have their own group and the group admin(only) should be able to get a list of all group members (linked to their blogs) in the side menu. How am I able to achieve this? Any help would be appreciated!

I found the following code from here:

<?php
    $query = db_select('node', 'n');
    $query->join('users', 'u', 'n.uid = u.uid');
    $query->join('file_managed', 'f', 'f.fid = u.picture');
    $query->fields('u',array('name'));
    $query->fields('n',array('type'));
    $query->fields('f',array('filename'));
    $query->fields('u',array('uid'));
    $query->condition('u.status', 1);
    $query->condition('n.status', 1);
    $query->condition('n.type', 'blog', '=');
    $query->addExpression('COUNT(n.uid)');
    $query->groupBy('u.uid');
    $query->groupBy('n.type');
    $query->orderBy('COUNT(n.uid)', 'DESC');
    $result = $query->execute();
    $output = array();
    while($record = $result->fetchAssoc()) {
    // print $record ;
     $output = '
';
     $output .= '

';
     $output .= '
'.$record['name']. 's Blog
Posts: ('.$record['expression'].')
';
     $output .= '
';
     $output .= '';
   //  $output .= '
'.l($record['name']. ' ('.$record['expression'].')', 'blog/'.$record['uid']);
    }
    echo $output;
?>

Unfortunately this gives me the following error:
Notice: Array to string conversion in include() on the last line (echo $output).

Any ideas on how I can achieve this with using Views?


texts: Drupal 7 date_popup : Howto align label to date field on the same line with label on the left

texts:
I'm using FORM API with Drupal 7.
I try to align label with a date_popup field on the same line on the form, with the label on the left of the date field.
I can only align the label on the right of the date_popup field . See
Actual layout
My code looks actualy like that :

function test_form_dateselect($form, &$form_state) {

$from = strtotime('-48 hour');
$to   = time();

$form['period'] = array(
        '#type' => 'container',
        '#attributes' => array('class' => array('container-inline')),
        '#prefix' => '
',
        '#suffix' => '
',
);
$form['period']['datebloc'] = array(
        '#type' => 'fieldset',
        '#title' => t('Choisissez la période à afficher'),
);
$form['period']['datebloc']['start'] = array(
        '#title' => 'Début de la période&nbsp;&nbsp;&nbsp;&nbsp;',
        '#type' => 'date_popup',
        '#default_value' => date('Y-m-d H:i:s', $from),
        '#date_format' => 'd.m.Y H:i:s',
        '#date_label_position' => 'within',
        '#required' => TRUE,
);
$form['period']['datebloc']['end'] = array(
        '#type' => 'date_popup',
        '#default_value' => date('Y-m-d H:i:s', $to),
        '#date_format' => 'd.m.Y H:i:s',
        '#date_label_position' => 'within',
        '#title' => 'Fin de la période&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
        '#required' => TRUE, //make this field required
            );
$form['period']['submit_button'] = array(
        '#type' => 'submit',
        '#value' => t('Afficher'),
);
return  $form;

Any idea or help would be appreciated !

The problem seems to be related with the "date_popup" type. If I try to replace "date_popup" with the "date" type, the label is correctly aligned on the left of the field ...


texts: Show a field to logged-in user in Drupal 8 views

texts:
I have some fields in my views called products but only logged in users will be able to see the product price field.

I am using twig.

I tried using.

{{ uc_product_image }}

{{ title }}

  {% if logged_in %} {{ price }} {% endif %}

  Item # :  {{ model }}

In custom text

but still not working.


texts: Views HTML List displays empty random regions

texts:
I created a View with a HTML list format showing Rendered entities.
The first row displays 3 items properly, the 2nd row displays only 1 item, rows 3&4 are good, row #5 displays only 1 item...

You may see it at: http://dtodonline.com.au/30nYj/product-index

Would you know how to not have those "empty slots"?
Thanks


texts:
I have a big site with a lot of images and I want to use Date tokens for the File path.
So I edit the image file and set Filepath: [current-date:short]

I have the following issue:
1)Uploaded images are broken
What could be the reason for this?
thanks


texts: Create relation between two select list for Hierarchical select option

texts:
In a content type, I want to have two select fields eg:

Select list 1 contains the Mobile phone brands names

Nokia
Samsung
HTC
Apple

Select list 2 contains the phone type like:

Lumia 520
Lumia 620
Galaxy S3
Galaxy S4
Hero
One
iPhone 4
iPhone 5

While adding new content, I want to make a Hierarchical select in this case, When a user selects Nokia from Select 1, then only Nokia phones are available for selection in Select 2 like:

Lumia 520
Lumia 620

But if nothing is selected in Select 1, then Select 2 doesn't show any options but still visible.

So far I tried Hierarchical select Module, but works only when I put the taxonomy term in hierarchical form instead of lists like:

Nokia
    Lumia 520
    Lumia 620

Samsung
    Galaxy S3
    Galaxy S4

HTC
    Hero
    One

Apple
    iPhone 4
    iPhone 5

and it only stores one value in the database (the phone Name). I want to be able to store both Brand and Phone name in Database as fields, so, I could display both fields using Views and also have exposed filter to filter through this.

Any suggestions how should I approach ?


texts: "Illegal choice full_html in Text format element" when submitting form programatically

texts:
Im trying to create a block programatically. I have created a function, which does the work for me.

function _create_footer_contact() {

  form_load_include($form_state, 'inc', 'block', 'block.admin');

  $form_state = array();
  $form_state['values'] = array(
    'machine_name' => 'footer_contact',
    'title' => 'TITLE',
    'info' => 'INFO',
    'body' => array(
      'value' => 'BODY TEXT',
      'format' => 'full_html',
    ),
    'regions' => array(
      'mytheme' => 'footer',
      'myadmintheme' => '-1',
    ),
    'visibility' => '0',
    'pages' => NULL,
    'custom' => '0'
  );

  drupal_form_submit('block_add_block_form', $form_state);
}

The problem is the 'format' value, which throws an error if it is set to anything but 'plain_text' (if format is set to 'plain_text' the form submits nicely and a block is created).

WD form: Illegal choice full_html in Text format element.
An illegal choice has been detected. Please contact the site administrator.

To debug I have tried to examine the $form_state of 'block_add_block_form' using hook_form_alter and dpm(). When I manually submit a block the 'format' is set to 'full_html'.

So... how do I submit a form programatically with full_html set as format?


texts: Get context of overlay (get parent page information)

texts:
Is it possible to get the context, like the full URL, or the containing page path, title, etc., while inside an overlay page?

For example, I have a form pop up inside an overlay, and I want to, inside that form, be able to get the context of the page that triggered the overlay popup. I can't pass any information via the URL... I'd just like to be able to do something like arg(0) for the containing page (what's faded out in the background of the overlay.

Right now, if I do arg(0), request_uri(), $_GET['q'], etc., it always returns the overlay path, like http://www.example.com/path/i/want#overlay=overlay/path

(I want the 'path/i/want' portion of the URL, somehow).


texts: How do I delete nodes older than X days?

texts: Does anyone have a snippet for deleting nodes that are older than 1 day? I would like to run this on cron tasks.


texts: How to make an nid replacement in a Text area inside Footer?

texts:
I want to generate an nid of the current page in the Text area inside the footer of a view. I cannot add the ID (node id) in the Footer. What is the proper way for doing this? Any hint?

Thank you.


texts: How to proceed towards MySQL performance testing for Drupal?

texts:
We have lots of Drupal sites installed on our server. Some of the sites do have lots of views and blocks configured on it.   Occasionally, one of such Drupal site (with lots of views and contents) suddenly becomes unresponsive or very slow. But rest of the Drupal sites with less contents appear to work fine during that time. We have to restart MySQL database in order to bring unresponsive Drupal site back to normal. We were thinking of setting up a periodic MySQL restart using cron.

This periodic restart option do not appeal to me very much. I want to find the cause of this problem. I suspect that it is mostly because of MySQL, but still it is a guess.

I am not experienced in the server performance issues. What is the best way I should tackle this problem? How can I confirm that it is a MySQL problem and not because of other? If it is a MySQL problem, what basic steps I should take to solve it?


texts:
I want to overwrite the default taxonomy view. I am cloning the original one, but the view I get does not provide any item.

How can I achieve this?
Also could I have two views, default and cloned enabled and visible through a panel?

It seems to be [a critical issue on an upgrade of the Views module1.


texts: Can Coupon and Payment panes be on the same page?

texts:
I have a checkout process where the payment pane and coupon are on the same page. The issue is when the coupon gives 100% discount, I would like to change the available payment method to a free order that does not require a credit card. But what the coupon is applied with ajax, the cart gets updated, but the payment methods do not.

The only idea I've had is to listen to the .ajaxComplete() event, and when the price is 0, refresh the page. Obviously, I would like to have something smoother that works with ajax.


texts: How do I pass a view an array of node ids?  I can create the view using the ui, but the query I want to run is outside the scope of views.  I want to run the db query independently, gather the node ids into an array, and then pass it to the view for display.  Howvian I make this happen, if at all?


texts: How do you create skins for the views slideshow?

texts:
Supposedly, in Drupal 8 you can create custom styles for your slideshow (Views Slideshow), which the README refer to as "skins".
Normally I'd use a css, but the module annoyingly includes a style section, which overwrites anything type in the css, so I have to use a skin.
The problem now is that there's no documentation about it whatsoever, I can't even get rid of the default style!


texts: What's wrong with this simple debugging code?

texts:
Spend whole day trying to make working simple debugging code for Tweme theme (using D8).

function tweme_preprocess_node(&$variables) {
   $node = $variables['elements']['#node'];
   kint($node);
   kim ($variables);
}

The only response is blank page no other info.

What's wrong with my debugging code?


texts:
Is it possible to somehow pull a report on an admins activity on a Drupal 7 site? I'd like to know for example any development changes, and settings changes, and database changes that an admin on a site has performed.

I've found some modules that help with that, but its too late to install them now.


texts: How do I build a form with embedded view results

texts:
I need to create a sign up form that also displays all of the submitted values above each value on the same page.  I have searched for hours and cannot find anything that describes how to achieve this.
So it would be formatted like:

Sign Up Form

Results of value 1:

value1, user 1

value1, user 2

value1, user 3

[enter value for value1] <= this is the form field to enter a new value1 for current user

Result of value 2:

value2, user 4

value2, user 2

value2, user 6

[enter value for value1] <= this is the form field to enter a new value1 for current user

[submit]

I have come close with webform and building a webform-form--nid.tpl.php file to override the default template, and use views to create tables for the results but the view tables are listing all of blank fields as well.  I have tried entitfyform but don't know how to split up the form to allow to have the views above each relevant section.


texts: D8 HTML tags from field converted to special characters when printing variables

texts:
I have WYSWYG editor enabled on my fields when there is html in these fields. When I print out the variables in my template, the html gets converted to special characters.

for example my print statement

{{ node.field_hours.value }}

My full HTML in the field becomes this.

Camping : &lt;p&gt;&lt;strong&gt;Equestrian, Group and Primitive Sites:&lt;/strong&gt;&lt;/p&gt;
46 miles of marked multiuse trails.

Florida law requires bicyclists under 16 to wear helmets.

Bird Watching :    Site 64 on western section of

&lt;ul&gt;


texts: Exclude nodes present in panel from view pane

texts:
I have a panel page where a user selects nodes (using IPE) to be displayed, the page also contains a view pane, which must not contain those same nodes.

How do I get the view to exclude the nodes present in the panel?


texts: NL and other languages visible, but English site not visible and showing error after translating news item

texts:
I get below error when try to reach my site (see screenshot):

The editor of the site made a news item and translated it to English. Now the English (default) site can't be reached. But the other languages are still working. For example the dutch version.

  Notice: Undefined offset: 5 in tb_megamenu_insert_tb_item() (line 347
  of
  /var/www/clients/client7/web17/web/sites/all/modules/tb_megamenu/tb_megamenu.functions.inc).
  Notice: Undefined index: href in include() (line 2 of
  /var/www/clients/client7/web17/web/sites/all/modules/tb_megamenu/templates/tb-megamenu-item.tpl.php).
  Notice: Undefined index: href in include() (line 2 of
  /var/www/clients/client7/web17/web/sites/all/modules/tb_megamenu/templates/tb-megamenu-item.tpl.php).
  Notice: Undefined index: options in include() (line 2 of
  /var/www/clients/client7/web17/web/sites/all/modules/tb_megamenu/templates/tb-megamenu-item.tpl.php).
  Recoverable fatal error: Argument 2 passed to url() must be of the
  type array, null given, called in
  /var/www/clients/client7/web17/web/sites/all/modules/tb_megamenu/templates/tb-megamenu-item.tpl.php
  on line 2 and defined in url() (line 2220 of
  /var/www/clients/client7/web17/web/includes/common.inc).


texts:
I am working on a custom Drupal 8 theme and I am trying to get the user avatar picture on a variable and output somewhere in the HTML.

I have created this function to get the name & email of the current user logged in like so:

#Function to get the user name value & output in the HTML DOM
function tropical_preprocess_page(&$variables){
  # gets current user name
  $user_logged_in_name = $variables['user']->getDisplayName();

  # creates value to ouput in the DOM & capitalize first letter
  $variables['user_logged_in_name'] = ucfirst($user_logged_in_name);

  # gets user email
  $user_email = $variables['user']->getEmail();
  $variables['user_email'] = $user_email;
}

That worked perfectly! Now I am trying to get the user profile picture, but I am not able to do it. Any help will be appreciate it.


texts: How to use mysql queries in Action in a Triggered Rule?

texts:
I created a triggered rule. The action will 'fill a field'. To get the value for this field I need to get a value saved in sql database. Then I check to set the value using php and create this code:

$result = mysql_query("SELECT field_codigo_value FROM content_type_inmuebles_en_venta SORT BY field_codigo_value LIMIT 1");
$value = mysql_fetch_array($result);

return array(
  0 => array('value' => $value )
);

But I get this error message:

  warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /Applications/MAMP/htdocs/drupal6multilingual/sites/all/modules/rules/rules/modules/php.rules.inc(107) : eval()'d code on line 2.


texts: Calendar View of Events shows 1st of month in header

texts: I would like my Calendar Page View of Events to show "August 2014" (or whatever the current month is) as the heading instead of showing "Friday, August 1, 2014" (see attached pic). Is there a configuration setting for this please? I have looked at various YouTube vids and it shows the date how I want, but I cant seem to figure out how they are doing it? .


texts: Anonymous checkout doesn't properly work

texts:
Anonymous users are supposed to have access to Commerce cart/checkout by default. In my current project cart remains empty for anonymous users, even if an order is created. When an anonymous user clicks on Add to cart, a new order is correctly created, with the Owned by anonymous status. This is fine, but:

While the current product page is reloaded as expected, the rule displaying the default message (Foo was added to your cart) is not fired

If I manually go to /cart, I get the Cart is empty message. /checkout returns a 404 error.

$_SESSION remains empty (I precise this because of commerce_checkout_access()).
if (empty($_SESSION['commerce_cart_orders']) || !in_array($order->order_id, $_SESSION['commerce_cart_orders'])) {
  return FALSE;
}

In fact, it seems that in anonymous context, the order cannot be seen.
How do I debug why the cart remains empty, and the order isn't visible  to anonymous users?
My config: clean step by step Commerce install, not Kickstart; some custom line items ;  Access checkout / View own orders of any type / View any product of any type permissions granted for anonymous.