texts: How to create a search page that searches in a custom csv or excel file and shows Exists/Doesn't Exist result?

texts:
My website is on a shared host and cannot use tika because Java is not executable. So the search file attachment module does not work properly.
Any help will be greatly appreciated.


texts:
I'm tracking pages in Drupal. I use a drupal_get_title to call the titles of the pages, however for some pages drupal_get_title return empty like titles of views.   What is missing?

The title is called from a custom module. I am using the hook_init where it's called a function where track the pages and they are saved in the database.  I'm trying to save in the database the title, timestamp, path, etc. but from the views the drupal_get_title return empty (the path and timestamp is saved).  The titles in the nodes are saved in the database.

How can I get the titles in the track that return empty?


texts: Date Range filtering using Google Search Appliance crashing

texts:
I'm working with the Google Search Appliance and corresponding drupal module. I've followed the user guide linked on the project page (also here) on creating filters. I was hoping to create a date range filter, however, I'm a bit stumped on how to filter on content types that have date ranges themselves.

For example, if I had a content type of person who had a year range of 1900 - 1970 (IE, years they lived). I figured I would create a metadata field that would have each date listed, so that google would know each year the content type covers. The filter part is the part where I'm having trouble.

In my custom module, i'm trying to set my $query['gsa_query_params']['requiredfields'] to be a range of dates in the form of "1900|1901|1902". That does work, but if the range is too big (around 30 years), the search fails. I'm lost.


texts: How can I increase the 128 character limit of a menu path?

texts:
I know there are patches to core, but they were never backported to Drupal 6 from what I can tell.

Increasing path length to 255 chars
Menu path length is limited by the UI to 128 characters

How can this be overridden in a theme?


texts: error 500 when D8 site placed in maintenance

texts:
Unless connected to admin , putting site in maintenance generate a 500 error.

I have followed Drupal 8 maintenance page theming instructions, modifying the settings.php and adding the template to the theme but it is still not working .

How can i debug this ?


texts: How add a css id selector to a views row

texts:
I need to add a css id selector to a views row. Of course this is straight forward with a class selector such as .my-class but how do I insert something like #my-class at the individual row level?

I realize that this probably invalid CSS; however, the ID appears to be needed to trigger some JavaScript.

Some background: I want to use a component from the Bourbon Refills CSS  framework for a 'fade in' effect and apply this to all the rows in a views. See http://refills.bourbon.io/components/#fade-in.

In order the make this work I need to add a CSS ID #js-fadeInElement to each row.

Note

After a bit more digging, it seems I may need a custom row.tpl file in my theme. Is this correct?


texts: How to take contents of a tab and insert them inside a node

texts:
I guess this is a pretty basic Drupal thing, but I'm not experienced with coding. I am using the Petition node module which displays a petition form and the results of that petition inside a tab on the same page. I found the code for this on line 174 of the petition.module:

$items['node/%petition_menu/signatures'] = array(
'title' => 'Signatures',
'page callback' => 'petition_signature_page',
'page arguments' => array(1),
'access callback' => 'petition_signature_access',
'access arguments' => array(1),
'weight' => 1,
'type' => MENU_LOCAL_TASK,

I want to render the signatures right next to the petition form, on the petition node page. How can I do this? My guess is that I could use this code and insert it inside the node template, but I need some instructions for that.


texts: How do I the add vocabulary name or the ID to the  CSS classes?

texts:
For theming purpose, I would like to add in body class the vocabulary name (or ID) of the current taxonomy.
I know how to add a class based on the taxonomy term ID.

For example, I have the following vocabulary (Color).

red (term id = 1)
green (term id = 2)
yellow (term id = 3)

I know how to get <body class="term-id-1">. I would like to get <body class="vocabulary-id-1"> or <body class="vocabulary-name-color">.

I've tried the following code.

function mytheme_preprocess_html(&$variables) {
  // Works
  if (\Drupal::routeMatch()->getRouteName() == 'entity.taxonomy_term.canonical') {
    $variables['term_id'] = \Drupal::routeMatch()->getRawParameter('taxonomy_term');
  }
  // doesn't work
  if (\Drupal::routeMatch()->getRouteName() == 'entity.taxonomy_vocabulary.canonical') {
    $variables['vocabulary_id'] = \Drupal::routeMatch()->getRawParameter('taxonomy_vocabulary');
  }
}

As said in the comments, it doesn't work, and I am not able to use the vocabulary name, or its ID as CSS class to add to the <body> tag.

How can I achieve this?


texts: Is there a way to send emails when someone logs in?

texts:
Logins on my sites are very infrequent and are normally done by myself. I would like a way of getting email notification when someone logs in. This way I might be able to spot someone hacking into the site early on.

I am using Drupal 7.


texts: Trying to pull phone number and combine it with carrier, cannot find phone number variable

texts:
I am running a website that has users input phone number and carrier when they register. Using the Phone module to collect the phone number and a select list field to collect the carrier. How can I retrieve these variables so that I can combine them to make a phone email address (eg. 123456789@vzwtxt.com)

I have a plan for combining them I just need to know how to get the phone number out of the array based on the uid so that I can combine it with the carrier.

Thank you!


texts: How to change the theme programmatically?

texts:
I've just applied a theme and got an error such that I cannot even change the theme back to a working one (like Bartik).

I've read other threads but I could use hook_custom theme but I don't know how to get it to work.

What I'm doing is to edit the system.api.php and change the original lines of hook_custom_theme to this:

function hook_custom_theme() {
  // Allow the user to request a particular theme via a query parameter.
  if (1)) {
    return 'bartik';
  }
}

I've tried several variations but I don't know what I'm missing. Can anyone help me with this please?

Edit: I've realised that I need to write my own module to run that line of code, is it true? Is there a simpler way to just change the default theme or the weight of the themes programmatically somewhere?


texts: Add an overlay to the Google maps for Geolocation Field module

texts:
I have installed the Geolocation Field module, and added a Geolocation field to my content type. I have chosen Geolocation Google Maps in the Manage form display, so you can have your map, click on a location, and when saving the node, the latitude and longitude will be automagically added to the node.

I would like to add an overlay to the Google map shown in the admin form, but not sure how can I achieve this. I have seen the module Leaflet, which allows to add an overlay, but it is in the frontend,not in the backend, and do not see the module having the widget mentioned above for adding locations directly by clicking instead of typing the coordinates.

Any idea on what my approach should be? Even if it was to write my customo module, I have no idea how to approach the problem.


texts: Install.php not found after installing with Drustack

texts:
I'm highly experienced with Joomla, cPanel, and reasonably experienced with SSL/command-line. I know PHP and MySql enough to figure out how not to break code and do minor changes, and find stuff I need to remove/comment-out.

I installed DruStack 8.3.1 with composer create-project, and then drush site-install with --db-url=mysql info correctly done.
Both were done via SSL with the correct user (no root) and both went fine (no errors, etc). The database was filled.

The site is located at the root of a subdomain (not at a /dupal subfolder).

After those two steps, there is no index.php or .htacces at the root (which I expect for an installed site). Those are located into the /web folder, and I'm at a loss on what to do next.

When I try to access /install.php I get a 404.
If I try to access /web/install.php I'm directed to /web/core/install.php with a 500 internal server error.

I did a good search on install.php + 404 error, without any result that would help me.

Any help is much appreciated.


texts: How to alter node url or toUrl function output?

texts:
How do we alter what's returned from $node->url()?  or $node->toUrl()?

There are many entity reference fields that don't allow referencing more than one entity type or a custom route, such as entity queue or entity reference fields.  For this purpose, so that we can create entity queues that reference other entities other than nodes, I am attempting to create a node with the bundle "redirect", and when the node referenced on the site, it would display the link to the referenced item on a field on that entity field_path (which is a link field).

The problem is that $node->url() or $node->toUrl() is tightly integrated into the node object.  In Drupal 7 we had hook_url_outbound_alter which made this kind of thing easy.  I would like a Drupal 8 equivalent.  So that whenever a url or link to my redirect node is displayed, it is replaced with the value of field_path.  Not just that node/ redirects, but that it displays the redirect.

So how do we alter $node->toUrl() if $node->bundle() == 'redirect'?

I have found I can fix this most places on the site using two hooks:

/**
 * Implements hook_entity_view().
 *
 * Gets the output for extra fields.
 */
function mymodule_preprocess_node(&$variables) {
  if ($variables['node']->bundle() == 'redirect') {
    if (!$variables['node']->field_path->isEmpty()) {
      $redirect = $variables['node']->field_path->getValue()[0]['value'];
      $variables['url'] = $redirect;
    }
  }
}

/**
 * Implements hook_link_alter().
 */
function mymodule_link_alter(&$variables) {
  if (empty($variables['options']['external']) && !empty($variables['options']['entity'])) {
    $entity = $variables['options']['entity'];
    if ($entity->getEntityTypeId() == 'node' && $entity->bundle() == 'redirect') {
      if ($variables['url']->getRouteName() == "entity.node.canonical" && !$entity->field_path->isEmpty()) {
        $redirect = $entity->field_path->getValue()[0]['value'];

        if ($new_url = URL::fromUri('internal:'.$redirect)) {
          $variables['url'] = $new_url;
        }
      }
    }
  }
}

But this doesn't help if someone calls the ->url() function without the link wrapping it.


texts: Difference between $form_state['values'] and $form_state['input']

texts:
Can someone please tell me the difference between these two variables?

$form_state['values']
$form_state['input']

Optionally some example of action they are used with. I'm wondering especially about using with ajax in drupal form. Which of these should I use in ajax callback to get input values from the form?


texts: How to put description on top of the input box, for a new field added to comment form?

texts:
I have added a new field to my comment form and this is how my comment form look liks:

So you can see it does not look nice, I want to have the description on top of the input box, where I say: Which paragraph do you want to put comment on?(Enter 0 if you ant to put comment on the whole article). So How can I do it?

This is the function that I have used to add the new field to comment form:

  function Annotations_form_comment_form_alter(&$form, &$form_state, $form_id) {
$form['paragraph_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Which paragraph you want to put comment on?(Enter 0 if you want to put comment on the whole article.)') . "<br>",
    '#required' => TRUE,
    '#size' => 10,
    '#maxlength' => 2,
    '#default_value' => !empty($form['#entity']->paragraph_id) ? $form['#entity']->paragraph_id : NULL, // set the default value to the current paragraph value
    '#weight' => $form['subject']['#weight'] + 1, // place after the subject field by setting the weight to +1 of subject weight
);

$form['#validate'][] = 'annotations_form_comment_form_validate';
$form['#submit'][] = 'annotations_form_comment_form_submit';

}


texts: Best way to create outbound link with node field content

texts:
I am looking for the best way to create a button that I attach to each node's page that directs to an outside site.  The url of the button will information that is in one of the node's fields.
I know this should be easy, but I am still new at drupal....

Thanks in advance

//btw, it's drupal 7.


texts:
I am trying to dynamically add content into a region.

In the preprocess function, I use the following code.

function firsttheme_preprocess_page(&$vars){
   drupal_add_region_content('dev', "I am reserved for development only");
}

In the template file, I print the region.

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

Although I am setting some sontents in the dev region, it's always shown as empty array every time.

How do I fix this?


texts: how to integrate libraries to load third party files in themes drupal?

texts: I just want to know how to integrate third party files with the drupal theme.


texts: Zen Theme Outputting Term Desc in Node - How To Add To Views

texts:
Hello i am using a zen based them Plain Grail. I nitice that on nodes it shows the term description on hover in nodes. I would like to achieve this effect in some of my views.

I have seen this question asked on here before but because my theme is already outputting this i thought it best to ask a new question.

I cannot see any reference to this in Plain Grail or Zens template.tpl

Does anyone know how i can show the term description in Views? thanks

Drupal 6 and Views 3


texts: entity_autocomplete field thats added by ajax is not working

texts:
I have a field im adding to a node-edit form by ajax. the field is a simple taxonomy auto-complete field.

when I add it directly in my form_alter it works, but when it's added by ajax, The autocomplete is not there - the field looks and behaves as a simple text field.

I have edited my question and added my code.

 use \Drupal\Component\Utility\NestedArray;

function MM_field_widget_MW_form_alter(&$element, \Drupal\Core\Form\FormStateInterface $form_state, $context){
        $element['display_id']['#ajax'] = [
          'callback' => 'getAjaxArgumentsFields',
          'wrapper' => $id . 'arguments',
          'method' => 'replace',
          'event' => 'change',
        ];
        $display_id = $element['display_id']['#default_value'];
        $element['options']['arguments'] = get_argument_fields($display_id); //Works, with entity_autocomplete working

}

function getAjaxArgumentsFields(&$form,  \Drupal\Core\Form\FormStateInterface $form_state){
      $display_id = $form_state->getTriggeringElement()['#value'];
      $fields = get_argument_fields($display_id);
      NestedArray::setValue($form, $array_parents, $fields);
      return  NestedArray::getValue($form, $array_parents); //Returns the exact same fields, but no autocomplete functionality- they appeare and behave like a regular text field
}

function get_argument_fields($display_id){
      $args_field = [];
      $argument_definition = get_argument_definitions($display_id);
      $args_field = [
              '#type' => 'entity_autocomplete',
              '#title' => $argument_definition['title'],//Taxonomy term
              '#target_type' => $argument_definition['type'],//taxonomy_term
              '#default_value' => '',
              '#selection_settings' = [
                     'target_bundles' => $argument_definition['bundles'],//voc_name
               ],
      ];
     $args_field['#prefix'] = '
';
     $args_field['#suffix'] = '
';
     return $args_field;
}

What do you guys think could be the reason?
Thank you!


texts:
I have a type node called flat, a field called latitude. I want to update the value of this field in a module each time the node is updated.

I try to use the hook_node_update() but nothing happens :

function flat_node_update($node){
    print_r($node);
    return $node;
}

Do you have the answer?


texts: Drupal Ubercart not populating Anonymous User cart with items

texts:
I have a site that the cart works fine for logged in users but won't populate with items for Anonymous users. When you click "Add to Cart" it shows an empty cart.

My problem can be seen at:
 usscmc.org then in the featured articles click on John Kretchmer
Click on "Click Here" to buy tickets then on "Add to cart"

I've watched the tutorials and checked all that I could find to check. My Anonymous Checkout is on.

Any help would be greatly appreciated


texts: how to get the submitted value of tableselect

texts:
function test($form, &$form_state){
   $form = array();

   $header = array(.............);

   $values = array(.............);

   $form['table'] = array(
      '#type' => 'tableselect',
      '#header' => $header,
      '#options' => $rows,
      '#multiple' => $IsCheckbox,
      '#empty' => t('No users found'),
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
    );
  return $form;
} // end of function test()

function test_submit($form, &$form_state){

$selected = $form_state['values']['table'];

drupal_set_message($selected)  // displays array index (0,1,2 etc)

return;
}

How to get the selected table row values in Drupal form. Need assistance on the issue. Any help would be appreciated.


texts: Creating my own Sub-Menu / Parent in the Admin/Config menu

texts:
Is it possible to create my own Parent / Sub-Menu in the Configuration tab in Administration?

Every resource I find seems to give an example of the yaml file placing a link under the Development menu, with system.admin_config_development, but I want one in (for example), system.admin_config_MYMENUNAME .

Example of current yaml file (hello_world.links.menu.yml) :

hell_world.admin:
  title: 'Hello module settings'
  description: 'example of how to make an admin settings page link'
  parent: system.admin_config_development # want this to be system.admin_config_MYCUSTOMMENU
  route_name: hello_world.content
  weight: 100


texts:
I have a custom block building a menu.
The cache works fine until a menu item is enabled/disabled in the menu edit, e.g.

admin/structure/menu/manage/main
toggle the enabled checkbox and save.

The block does not reflect changes until the cache is cleared.

I have:

            '#cache' => [
                'tags' => [
                    'node_list'
                ],
                'contexts' => [
                    'url.path',
                ],
            ],

which picks up the url / menu text changes and also makes sure the block is valid for each node it is on [i.e. not showing the same block content on every node, but this node's version].

What tag do I need to make sure the cache is invalidated when menu item:enabled is toggled?


texts: How can I run a jQuery script in the admin overlay?

texts:
I'd like to modify the interaction with one (or more) of my admin overlay pages, but it doesn't seem like the scripts that works on the site are directly functional in the back-end? How do I run a jQuery script within the Drupal admin overlay?

As you might tell, I'm quite new to Drupal.


texts:
How to copy content type in Drupal 7 ?

I can't find a button to duplicate content type.


texts:
Which links is Drupal referring to in 'print render($content['links']? 'Links' is kind of general to me so I am wondering which links this php snippet is referring to.

I've looked at Drupal's theming references and saw only a list of variables for theming.


texts: theme_hook_suggestions is ignoring my suggestions

texts:
I'm working in Drupal 7.

I'm trying to add a custom template file for a few pages I'm creating. I've done so in hook_preprocess_page in my template.php file.

This is the scenario:

I have four "Basic Page" pieces of content that will use the same template file. I've already coded page.tpl.php for other "Basic Page" content. The reason I want this template is because the look of these four basic pages is different from other pages. What I've done is added my suggestion to the theme_hook_suggestions array. It's ignoring what I'm adding. Just a note: after every step I'm clearing my caches. It isn't that.

I've tried this:

$variables['theme_hook_suggestions'][] = 'newbies';

This will add the 'newbies' suggestion to the array, but creating a 'newbies.tpl.php' file gets me nowhere. It's ignored. I've gone as far as doing this:

$variables['theme_hook_suggestions'] = array(0=>'newbies');

Which erases the suggestions array and adds only my suggestion, which I've verified with krumo. This also doesn't do anything and is ignored. My site doesn't even break when I do it.

From what I've read about theme_hook_suggestions, it would seem that Drupal only wants template suggestions for templates that it defines. For example, just creating an arbitrary template file (in this case 'newbies') instead of some system defined one like 'page--type--system--node......' etc.. will never work.
I've decided to rule that out as being truth for now because I refuse to believe that a design flaw of that magnitude could be introduced into any software.

What am I missing?


texts: I am going to download the Views module for a Drupal 7 website I am creating, but there are 2 different versions: There is the alpha3, the development snapshot, and another one that doesn't have a name I can see (it is highlighted in green). Which these three versions should I use?


texts: How does Drupal Commerce store Addresses for anonymous users

texts:
I'm trying to figure out how exactly does Drupal Commerce store Addresses for anonymous users?

Let's say an anonymous user creates a shopping cart and fills in the shipping information, but has not yet completed the checkout (payment for example, so shipping information is already stored with the order). At this point, has the system already created a shipping entity, if so, then to whom, as the anonymous user ID is 0.

Else if the Shipping information gets stored only upon checkout completion, still, to whom is it assigned? Who is the owner of the address.

Commerce also allows for an anonymous user to later create an account that has all their order history and shipping addresses, has there been assigned a new unused user ID for the user, just in case they decide to register, to associate all this information, or is the address originally only tied to the order it self, with owner ID 0, and the user profile is created upon registration based on the order details?

Why I'm asking for all this, is that I'm creating an order process where the address is assigned for each product separately, and on checkout each product with different shipping address is moved to a new order with the specific shipping address. And with this in mind I still wish to keep the possibility for making anonymous purchases, and am trying to figure out the dynamics of the shipping addresses :)

Best regards,

Alari


texts: Can I use the Migrate module to sync a site database with a Filemaker Pro database?

texts:
Is it possible to get data from a Filemaker Pro database and insert it into the database for a Drupal site?

Ideally, I'd like to set this up so that Drupal would periodically check the Filemaker database and import any new (or updated) data into its database.


texts:
I have several vocabularies; let's assume they are the following ones:

v1, with terms v11,v12,v13
v2, with terms v21,v22,v23
v3, with terms v31,v32,v33

I have a product category. When you hit the product category, I want that a page appears showing drop down menus of the above vocabularies, and the drop down containing their terms.

How can this page be called from the click on the product category?
Now the main problem I want to solve is when the page containing the drop down menu appears, and the user clicks on a particular term of a vocabulary, that action filters some terms in the other drop down menu. For example, if v11 is selected in vocabulary v1, then with v2 only terms v22 and v23 are allowed, and in v3 only v31 is allowed so when you select term v11 the other menus should only show the allowed term. Also when a term is selected, the below section of the page should show only those products (teaser or table) satisfying the attributes as selected in the terms. And we have two choices in vocabulary v2 we can select either v22 or v33 which will further filter the search criteria of products in that category.

An example can be seen on this site.

In the left side menu, go to detection and ranging, and hit on laser measurement technology. The page which appears has several drop down menus; I want to acheive the same functionality.


texts:
I am using the following to put js on my site...

drupal_add_js(drupal_get_path('theme', 'MYTHEME') . '/js/custom.js');

But I have noticed that this is also adding the js to pages like update.php and other admin pages. Is there a if variable I can use to only load the js on customer facing pages?

Ive used drupal_is_front_page() before, which is great, is there a drupal_not_admin_page() or something like that?

A google search for "drupal is not admin page" isnt getting me anywhere.


texts:
I want to fully customize the user profile page. I want to be able to show only the fields that I want, display views, blocks, etc...

Some users will be able to see others users pages so I really need to customize this my way.

Is this possible? Where should I code?

I found a user-profile.tpl.php and it only has this code:

Should I get rid of this code and write a new one?


texts: How to assign the user login block to header region

texts:
I created a user and I logged in as the user by visiting xxx.com/user. I just visited xxx.com/user. I see the user name but I do not see any log out button. I am not sure how I logout.

Thanks.

D


texts: Endless redirect on paths containing question marks

texts:
A similar question was posted here: EventSubscriber endless redirect

But I haven't quite been able to implement a workable solution.

On Drupal 8.73: Basically we have a custom module that is redirecting to clean urls (so that /node/42 doesn't get indexed by google). I didn't write the module and I'm a little fuzzy on what it's doing and why. The module works fine except that urls with ? in them endlessly redirect and get caught in a redirect loop. The browser eventually returns an error that the page is redirecting and will never load properly. Here is the module:

<?php

/**
 * @file
 * Contains \Drupal\mymodule\EventSubscriber\MyModuleSubscriber.
 */

namespace Drupal\sjwc_tweaks\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\RedirectResponse;

/**
 * Event subscriptions for events dispatched by SimpleFbConnect.
 */
class TweaksSubscriber implements EventSubscriberInterface {

  public function onRequest(GetResponseEvent $event) {
    $baseUrl = $event->getRequest()->getBaseUrl();
    $attr = $event->getRequest()->attributes;
    if (null !== $attr && null !== $attr->get('node') && $attr->get('_controller') == '\Drupal\node\Controller\NodeViewController::view') {
      $node = $attr->get('node');
      $nid = $node->id();
      $current_uri = \Drupal::request()->getRequestUri();
      if (\Drupal::service('path.matcher')->isFrontPage()) {
        $redirect_uri = '/';
      } else {
        $url = Url::fromRoute('entity.node.canonical', ['node' => $nid]);
        $redirect_uri = $url->toString();
      }
      if ($redirect_uri != $current_uri) {
        $event->setResponse(new RedirectResponse($redirect_uri));
      }
    }
  }

  static function getSubscribedEvents() {
    $events[KernelEvents::REQUEST][] = ['onRequest'];
    return $events;
  }

}

I believe this line is the issue:

$event->setResponse(new RedirectResponse($redirect_uri));

At the issue linked above, a kind user suggested a solution that I do not quite understand, they said:

  The problem is, you should never send a response inside of a StackPHP
  application. Drupal continues to build its own response (the real
  frontpage) and stores this in the cache. Set the response in the event
  instead: $event->setResponse($response);

I'm not sure exactly where he means by setting the response "in the event" instead.

Now, as this issue only is a problem on urls with ? in them, I did find I could correct the issue by wrapping the line above, line 37 thusly:

if (strpos($current_uri, '?') != TRUE) {
  $event->setResponse(new RedirectResponse($redirect_uri));
}

However I worry this might cause unpredictable behavior and I prefer to fix this the right way the first time. Can someone tell me what I'm doing wrong or overlooking or explain how I can "set the response in the event" instead?


texts:
I'm trying to create multiple websites with Drupal Multi-site feature, and I need to understand how the authmap table is used.

What's the purpose of the authmap table?


texts:
I am displaying a list of taxonomy terms for registered users on a Node and the user is asked to make multiple selections depending on what appeals to them. e.g what are their Top Ten song choices for 2016

I would like them to put that same list of taxonomy terms with their 2016 choices (Selected) within a View and I would like to email them that View list in 2017 and ask them to check if its still correct and or to make amendments to their choice to reflect their choice for 2017.

I can get the Views list to display the list of taxonomy terms, but how do I get check boxes to display with ticks with past choices for 2016 in Views and then store the changes for 2017?

Perhaps I'm overlooking something and this should be very simple.

Anyway, thanks in advance.


texts: How to split up the renderd page in a tpl file?

texts:
In my D7 template I have a tpl file called:

html--events.tpl.php

  <html class="no-js" lang="<?php print $language->language; ?>" dir="<?php print $language->dir; ?>"<?php print $rdf_namespaces; ?>>
<?php endif; ?>

  <?php print $head; ?>
  <title><?php print $head_title; ?></title>
  <?php print $styles; ?>
  <?php print $scripts; ?>

<body<?php print $attributes;?>>
  <?php print t('Skip to main content'); ?>

  <?php print $page_top; ?>
  <?php print $page; ?>
  <?php print $page_bottom; ?>

I would like to add a page header image to this page by changing the template.

So therefore I would like to split the rendered content of this page for e.g. like this:

  <?php print $page_top; ?>
  <?php print $pageheader; ?>
  <?php print "
/div>" ?>
  <?php print $pagetitle; ?>
  <?php print $pagemaincontnet; ?>
  <?php print $page_bottom; ?>

However the var $page contains already all the rendered header. How can I split the rendered page into smaller blocks? I tried to replace:

<?php print $page; ?>

into

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

but then got a message : Only variables can be passed by reference

Any suggestion is very welcome.


texts: How to configure squid for anonymous users?

texts:
My intention is to use squid to cache  pages for anonymous users. Ideally, the cache should be limited to some query-heavy pages.

I have looked around but could not find any up-to-date guide about Drupal 7+squid 2.7 on the same server.

I could set up squid but it misses the cache and I have difficulty defining squid.conf for my purpose.

So appreciate your help.


texts:
I'm trying to add content to my Drupal 8 from the PHPMYADMIN.

You may be wondering Why this way? The fact is that I have a web in Drupal 6 and I tried a lot to migrate using the tools Drupal has, without success.

I'm not so good at programming, and the time is passing, so I decided to try the manual approach.

I created an article and inspected the database and saw what tables where altered to discover which tables where affected when I create an article.

Then I proceeded to manually create them.

The involved tables where:

node
node_revision
node__body
node_revision__body
node__comment
node_revision__comment
node_field_data
node_field_revision
node__field_tags
node_revision__field_tags
taxonomy_term_field_data
taxonomy_index
taxonomy_term_data
taxonomy_term_hierarchy
comment_entity_stastics

I noticed that "menu_tree" and "cache_entity" are altered when creating an article, but I do not know how to manually insert data there because they have blob data.

After that, I re-built the cache, but the content I created wouldn't show.

I wonder if there are some tables I'm missing, or if with this method I won't be able to achieve what I'm trying to accomplish.

If I have to choose between spending time in trying to learn something hard for me (something I don't know if will be or not 100% a success) and manually creating the 1500 articles with the Drupal 8 UI, then I would stick with the second option, because manually creating content is 100% secure and won't consume my desire to live the way the alternatives I'm trying with no effort are doing.

But there may be something. to automatize the process at least a bit. Is there?

What should I do?

I wonder if investigating the import.php as some kind of method to which I can pass and array of info and achieve what I'm trying to do!

Ps: I have already tried with the Migrate, Migrate Plus, etc with no result.


texts: Replace menu's ul li.first a text link with image  link

texts:
Drupal 7.

For example no matter what menu block would be added to the header region, how can I make it replace first link (which has .first class) with image link?

So Drupal generates links as
Home
 and then apply some function from template.php which would replace it with something like

I found some code which kind of does that, but it needs to enter path to image via Add link under Title field and I don't really need that, the users of the theme won't understand how that works. And it also applies to any links. While I need to switch the very first text link with image link whose path would be given inside template.php

<?php
/**
* Allows for images as menu items.
* Just supply the an image path in the title. The image path will be replaced
* with an img tag. The description is used as alt text and title.
* Implements theme_menu_link().
* Reference: http://chrisshattuck.com/blog/how-use-images-menu-items-drupal-simple-preprocessing-function
*/
function YOUR_THEME_menu_link($variables) {
  $element = &$variables['element'];

  $pattern = '/\S+\.(png|gif|jpg)\b/i';
  if (preg_match($pattern, $element['#title'], $matches) > 0) {
    $element['#title'] = preg_replace($pattern,
      '',
      $element['#title']);
    $element['#localized_options']['html'] = TRUE;
  }

  return theme_menu_link($variables);
}
?>

I can do that with CSS, but I prefer not (client side reasons).


texts: How to change the hyper link to checkbox link?

texts:
I'm using Node Compare module to compare products, it showing the Add to Compare as link, You can see the DEMO here, but I want to show as checkbox link

  .

I have no idea on how to achieve this, any pointer would be helpful!


texts: How to create multi-value, multi-bundle entity reference fields in code?

texts: I'm looking for example code that demonstrates creating a new entity reference field with multiple values, referring to multiple different bundles.


texts: Writing image value to field_collection object

texts:
I'm creating a field collection item  and saving it via entity_create, and it all works great as long as I don't have an image tied to it. As soon as I do, I get an error, and it looks like this in the watchdog table:

    a:6:{s:5:"%type";s:12:"PDOException";s:8:"!message";s:516:"SQLSTATE[23000]: Integrity constraint violation: 1048 Column &#039;fid&#039; cannot be null: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array
(
    [:db_insert_placeholder_0] =&gt;
    [:db_insert_placeholder_1] =&gt; file
    [:db_insert_placeholder_2] =&gt; field_collection_item
    [:db_insert_placeholder_3] =&gt; 50
    [:db_insert_placeholder_4] =&gt; 1
)
";s:9:"%function";s:16:"file_usage_add()";s:5:"%file";s:43:"C:\xampp\htdocs\mysite\includes\file.inc";s:5:"%line";i:663;s:14:"severity_level";i:3;}

My code looks like this:

$values = array(
    'field_name' => 'field_bp_images',
    'field_bp_image_title' => array( LANGUAGE_NONE => array(array('value' => $title)), ),
    'field_bp_image_file' => array( LANGUAGE_NONE => array(array('value' => $fid)), ),
    'field_bp_image_photographer_name' => array( LANGUAGE_NONE => array(array('value' => $photographer)), ),
    'field_bp_image_photo_flag' => array( LANGUAGE_NONE => array(array('value' => $is_photo)), ),
  );
}

$field_collection_item  = entity_create('field_collection_item', $values);
#Attach to the node
$field_collection_item->setHostEntity('node', $node);

// # Save field-collection item.
$field_collection_item->save();

My $fid is definitely populated, but I am still getting that error telling me my fid cannot be null. I'm guessing I need to provide more elements to the array, but not sure what keys to give, or how many. Any thoughts?


texts: Automatically load the URL from link field into a script

texts:
I have a content type "Team" to add team members. In this content type I have a link field (called "LinkedIn") which holds the URL to the team member's LinkedIn page.
What I want is to use the URL from the link field and use it with a script (provided by LinkedIn). The script looks like this:

<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="IN/MemberProfile" data-id="linkedin-profile-link.com" data-format="hover"></script>

I have created a simple text field for the content type "Team" and in a team member node of that content type I copied above code into it and inserted the URL from the "LinkedIn" link field. This works but I would have to edit more 100 team member pages.

How could I automatically load the URL from the "LinkedIn" link field into this script (it needs to be added into data-id="link comes here") and display on every team member page? Can this be done with Display Suite? Or do I need to write a module?


texts:
function custom_block_view($delta = '') {
$brands = $brand->getChildrenCategories();
      foreach ($brands as $node) { #print_r($node);
        $items[] = array(
            'data' => t($url = Mage::getUrl($brand->getUrlPath()).'.html')
            #'data' => t($node['name'])
        );
      }

$block['content'] .= theme('item_list', array(
          'items' => $items
              ));

    }

I use this code to display items in a block. I want this to be a link but was not able to achieve it. The output is shown below:


texts:
I have several fields in my view:

Path (excluded from display)
Image
Body
Button (rewritten to use [path])

I need to output the image like so (this is a requirement):

TITLE

I cannot do this using rewrite rules because of  https://www.drupal.org/node/417956 which explains that views runs all rewrites through filter_xss_admin(). This function strips out the style attribute on the a tag.

I am attempting to implement this in a view template, specifically the Field Content: Image (ID: Image) template:

<?php

/**
 * @file
 * This template is used to print a single field in a view.
 *
 * It is not actually used in default Views, as this is registered as a theme
 * function which has better performance. For single overrides, the template is
 * perfectly okay.
 *
 * Variables available:
 * - $view: The view object
 * - $field: The field handler object that can process the input
 * - $row: The raw SQL result that can be used
 * - $output: The processed output that will normally be used.
 *
 * When fetching output from the $row, this construct should be used:
 * $data = $row->{$field->field_alias}
 *
 * The above will guarantee that you'll always get the correct data,
 * regardless of any changes in the aliasing that might happen if
 * the view is modified.
 */
?>
<a href='/' style='background-image: url(<?php print $output; ?>);'><?php print $row->node_title; ?>

I have tried this, [path] remains unchanged:

<a href='[path]' style='background-image: url(<?php print $output; ?>);'><?php print $row->node_title; ?>

and this, [path] remains unchanged:

<a href='<?php print token_replace("[path]", array('node' => $row->_field_data['nid']['entity'])); ?>' style='background-image: url(<?php print $output; ?>);'><?php print $row->node_title; ?>

I cannot find the value of the path anywhere in any of the variables. How can I output the value of [path] in my view template?


texts: jquery.ui libraries-override > Incomplete library definition

texts:
I tried to remove the core jquery.ui theme.css by writing into mytheme.libraries.yml the following lines.
libraries-override:
  core/jquery.ui:
    css:
      theme:
        assets/vendor/jquery.ui/themes/base/theme.css: false

 stylesheets-remove:
  - core/assets/vendor/jquery.ui/themes/base/theme.css

Both versions return an Incomplete library definition error. I cleared the cache but the errors remain. Does anybody know the solution?
After further reading, I put the code in mytheme.info.yml (instead of mytheme.libraries.yml). This avoids the error, but the "overriden" theme.css is still loading.


texts: How to get administration views to work?

texts:
As my content began to expand into a large repository I started to miss the feature of being able to filter content by a simple "title contains" criterion. I found out Administration Views that got installed by Admin Menu. However, the content view is contaminated by a known bug. It allegedly comes from incompatibility with VBO. This prevents the view from functioning or being edited.

Is anyone successfully running admin views, caring to list the module versions for Views, VBO, Admin Menu?


texts: How to share Drush code with the community?

texts:
I created a simple Drush command. How can I share it with the community?
Do I need to create a module and add it to drupal.org ?


texts: How to upload/insert images in content from module?

texts:
$article = entity_create('node', array(
    'type' => 'article',
    'title' => generate_demo_content('lorem_ipsum_title'),
    'body' => array(
      'value' => generate_an_article(),
      'format' => 'full_html',
    ),
    // how attach here, a file or an image?
  ));
  $article->save();

I create an article from a .module file, and I would like know if I can link an image/file object to my article?

By example if I have an image inside /modules/my_module_name/images/img.jpg, how I can insert this image inside my article object from my .module file please?

Thanks.


texts: What are the pros/cons/alternatives to creating a number of identical content types to allow for divergence?

texts:
I hope this counts as an answerable question.

A publications database I'm migrating from another content management system to drupal, has different types of publications.  In the current system those publications are kind of the equivalent of a taxonomy.  It is clear from talking to people familiar with the history, and from looking at the state of the database and code, that every couple of years they rearrange things, adding or removing content types and changing the fields available.  They used to try to dynamically change the fields available on the form depending on the content type.  (peer-reviewed journal articles would have volume/Issue, pages, publication name, etc, where books would have different requirements, and online publications would be still different.  This seems to have become very hard to maintain, so the current system now makes all fields available for all content types, and sometimes the same field is used for different types of data (total pages and page range for example).  There are thousands of publications and sorting it all out programmatically seems quite difficult, so the thought is to bring everything over using the same fields (cleaning up the data where it can be done programmatically).  Having differing fields per publication type is desirable, and in the future they would like to have an approvals process built into the system with differing approval paths per publication type.

Initially my approach was going to be much like theirs, to have one publications content type, and a publication type vocabulary to categorize them.  Thinking of the need for future divergence of fields, and the likelihood of a requirement to change the display depending on the publication type, I've modified my approach to start with an identical content type per publication type to allow for things to change over time.

Is this going to cause terrible problems for me down the road if they decide that two types of report are now one publication type?  I'm already seeing a little bit of difficulty in the ability to make dynamic templates that cover the entire set of publication types.  It has been quite painful to move any changes made in one content type over to all the others.

Would it be more sensible to try the approach of having all the fields we need in one content type and trying to dynamically hide or show those fields depending on the publication type selected?

Is there some other more sensible way of going about this that I haven't thought of?  It seems like somewhere along the line I'm going to run into pain either changing the fields or with changing publication types, I'm just not sure which kind of pain is likely to be better.


texts:
How do I get just Drupal 8 core using drupal-composer?

This would be very useful for core development and starting a new project without any assumption.


texts: Can a view show all the content of groups to which a user has access?

texts:
This may have been answered before, but I am not sure how to search or ask for it. My Group knowledge is very limited, and I am not seeing a way to do this in Views at a glance.

When a user logs in to the site, and lands on the default user profile page, I want to output a view. I want to show all content that user has access to (from all groups they are in).

I tried adding relationships, but I can't seem to find a way to force the currently logged-in user as a relationship to what they should see.


texts: How do I make a twitter scheduler on drupal 7?

texts:
I basically want to make a twitter scheduler. What it does is ,it fetches the old tweets from my twitter account and queues them so that I can schedule them to be sent at a later time.
So the three main jobs of this would be --

Fetch tweets from my account.
Queue them
Schedule them to be tweeted as per the user.

Could someone please tell me what all modules Id require for the same?

Thanks
Appreciate it.


texts: How to give permission for a role for editing help text for fields of custom types?

texts:
I want role "RoleFoo" to have only the permission to edit the Help Text of all fields of  specific content types (contentypefoo1 and contentypefoo2).

How to do this?


texts: Updating the delta value on a custom field

texts:
I have a content type with an image field and I am trying to update the delta value. I'm assuming the delta value is used to sort the images when they're rendered. (If there is a better way please tell)

I'm not sure if this is the Drupal way of doing it but cannot find any resources on how to do this correctly.

I have a page that allows the user to change the order of the images through the jquery-ui sortable method, this then posts to an admin page where I intend to do the database updates.

Firstly, is this the correct way to update the delta value on a field?

I know direct queries on the db aren't a good idea at all.

If it is, I cannot actually change the value initially as the database delta column is unique, it's also doesn't allow for a null value so I'm stumped on how to achieve this, without running two queries. One to set/clear current values, then one to update with proper values.

Any ideas welcome. I'm using D7.


texts: Artifical part of URL path, not corresponding to node, triggering view attaching

texts:
Hello Drupal enthusiasts,

I have a menu structure, which has its equivalent in url paths. Example:
department/area/project. This path works fine and now I want to attach some View when last part of url is "releases" (department/area/project/releases).

Any ideas? Should I rather take closer look at Views options or some other module (Pages?) or programatically by hook_menu and some wildcards?

=========================================================
EDIT (thanks to lack of ability of answering my own question):
I think I figured out something close to what I need. I create View, type Attachment (thanks to EVA module). I configure contextual filter, and specify validation criteria with PHP code pasted to UI of Views:

$path_arr = drupal_get_destination();
$path_str = $path_arr["destination"];
$path_explode = explode("/", $path_str);
$path_last = end($path_explode);

if( $path_last == "releases" ) {
 return true;
}

And after that the certain view would be shown in case of last part of path equal to releases. Now some ENTITY CONTENT SETTINGS to cover only selected content type.

If function arg would accept -1 this could be done as fast as

if(arg(-1)=="releses") { ... }.

How about performance of such a solution? Is it much slowing down the whole thing?


texts:
This is a very basic question so please check for idiocy as I haven't worked with views that much.

I want to edit the main page of a content type like an article through views. To me it seems views only works with the "listing" of the contents not the content itself. I might be missing an option right in front of me but I can't seem to figure out what it is.

Repeat, I want to edit the main content page not the listing. Please help!

EDIT: This is the screenshot of my content page. I want change this layout through views like reorder the fields or add new ones like it's typically done in views. So is it possible?

Drupal has done this ugly presentation itself and I want to change it.


texts:
How do I enable a button block programmatically?

I've tried:

function openid_connect_block_info() {
  $blocks['openid_connect_login'] = array(
      'info' => t('Login Using PixelPin'),
      'cache' => DRUPAL_CACHE_PER_ROLE | DRUPAL_CACHE_PER_PAGE,
      'visibility' => 1,
      'region' => 'content',
      'pages' => 'user',
  );
  return $blocks;
}


texts: CKEditor and CKFinder not working after recent CKEditor update

texts:
I have Drupal core 7.69 and will install Core 7.71 later today. But I updated CKEditor a month ago and since then it is not working. Cannot upload new images or old images do not show up in the content pages while editing. However the old images show up on the website correctly.

As shown in the screenshot, no way to upload images and tool bar also doesn't have all functionalities. I checked all permissions and they seem to be OK. CKEditor configuration seems to be the same as before. My previous version of the CKEditor (on backed up website) prior to update still looks good.

Do you have any suggestion on how to fix this issue?


texts: How to add {less} files to Omega HTML5 subtheme?

texts:
I would like to use less.js and the less module to work with my Omega-based HTML5 themes.
How to add **.css.less* files to the Omega-based subtheme .info file ?

My current set up is:

/sites/all/themes/omega - the Omega master theme directory
/sites/all/themes/custom-html5 - Omega-based HTML5 subtheme directory
/sites/all/themes/custom-html5/css/custom-html5-alpha-default.css -
my default css file

This question is related to

my previous one: How to use CSS preprocessor LESS.js with Drupal 7?


texts:
I am using WYSIWYG module with TinyMce as Rich Text Editor.
I need to make the rich text editor disabled only for a particular text area in a create content page, i.e., when I click Enable rich-text link, it must get activated. How can this be done?I am using drupal 6


texts: Create new content when an image is uploaded, using rules

texts:
I've been working all day to try and figure this out.

I have a view set up that takes every content type of "Gallery" and creates a nice view of all gallery types. I also have a webform where a user can upload an image. I then set up rules so that when an image is uploaded using that form an entity is created of type "Gallery"....and that's where I've been stuck.

I've been searching online for answers but can't find anything. Is there a way to take the image that was uploaded using the webform, and place it into the new gallery content in the field-images field?

http://imgur.com/hwYBb8H

That's my rules page currently. The php code that I was using was just dsm to check what was actually inside of each entity, along with me trying random code to try and figure out how to do this. None of it worked.

I'm not sure if this is the best way to do this or not, so feel free to let me know if you know a better way to do this (I'm a drupal beginner still).

Any help would be appreciated!


texts: How to overwrite /modules/user/user.module text?

texts:
I am trying to override the text outputted on the user login block:

"A valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail."

I have copied "/modules/user/user.module" to my site's theme folder and overwritten the text in question however I'm not seeing the change.

Any help greatly appreciated :)

Thank you,

Andrew


texts: SimpleTest clicking one of multiple "Add Another Item" buttons

texts:
I'm attempting to test a node's form that has multiple fields that allow arbitrary numbers of entries. As such, there are several "Add Another Item" entries. In the SimpleTest docs (I think, I may have found it somewhere else ... code samples or something) it has examples for how to trigger the click of the Add Another Item button. Something like this:

$this->drupalPost(null, array(), t('Add another item'));

The trouble with this is that is targets the value of the field and the value is not unique across the page. In the docs it also suggests that you can pass in an array as the third parameter to drupalPost:

$this->drupalPost(null, array(), array('path' => '', 'triggering_element' => 'something_add_more');

Unfortunately I don't know what to set the path to. The default doesn't work (/system/ajax I believe) and I don't know what path drupal is using to trigger the ajax request to begin with when you manually click the button (if it's ajax at all).

I have also tried just passing the id or name of the button as the third parameters with no luck.

So here's my question: How can I uniquely select any one of the "Add Another Item" buttons found on the page from within the SimpleTest environment?


texts: How long does it take for Drupal to unblock user after 5 failed attempts?

texts:
I've tried to log in unsuccessfully to Drupal and I get the following error:

There have been more than 5 failed login attempts for this account. It is temporarily blocked.

Does anyone know how long the waiting time is for localhost?


texts: Add an image selection list to a content type

texts:
I'd like to add an image selection to a content type, what would let the user chose
for instance an icon, from a predefined list, to attach to this content type.

Any suggestions on how i could achieve that ?

Thanks,


texts: What does the option "Enable Display field" shown when creating a new file field do/mean?

texts: What does the option Enable Display field shown when creating a new file field do/mean?


texts: How to determine where the CCK fields are stored in database?

texts:
When a content type is created, there is a new table for it. For example, there is a content_type_claim table, for content type claim. Content fields are defined within the table.

However, when a content field is shared (used more than once) in different content types, there will be another table created for this field. For example, there is a content_field_claim_no table for claim no, if claim no is also used in another content type.

My question is, in which table Drupal defines whether a content type field is stored inside the content_type_??? table (when used once), or in its own conten_field_??? table (when used more than once), for a particular content type.


texts: How to index created field in baseFieldDefinition?

texts:
because we have a lot of query on created date field on our custom Entity, we looking for a solution to index 'created' field index in Mysql.

this is our baseFieldDefinition :

public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
    $fields = parent::baseFieldDefinitions($entity_type);

$fields['product_id'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Product Category'))
  ->setDescription(t('Product Category ref'))
  ->setRevisionable(FALSE)
  ->setSetting('target_type', 'taxonomy_term');

$fields['site_id'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Site ID Ref'))
  ->setDescription(t('Site Category ref'))
  ->setRevisionable(FALSE)
  ->setSetting('target_type', 'taxonomy_term');

$fields['price'] = BaseFieldDefinition::create('integer')
  ->setLabel(t('Price'))
  ->setDescription(t('The Price of the Crawl entity entity.'))
  ->setDefaultValue(0);

$fields['created'] = BaseFieldDefinition::create('created')
  ->setLabel(t('Created'))
  ->setDescription(t('The time that the entity was created.'));

return $fields;

}

is there any setting or method in ContentEntityBase to set a field indexable in Mysql?

NOTE: we can index it with a simple migration in our module installer but first of it I'm curious about it, is there any solution to achieve it in BaseFieldDefinition?


texts:
I want to move my multisite to another local. Using MAMP Pro.

PHP version 5.3.2

Copied my site files to new directory. And disk location mysite/sites/multisitename/

Installed exist database and configure. It's OK. But when I go to site link, get this error:

  Forbidden

  You don't have permission to access / on this server.

Checked my files and everything is OK.

How can I fix it?


texts: Using video module with ffmpeg to convert; how do I display converted files?

texts:
All uploaded videos on our Drupal 7 site need to be in a standard web format: MP4-H.264/AAC to assure play back by all user devices.

ffmpeg is working correctly. Video upload field stores all uploaded files into sites/default/files/videos/originals.

ffmpeg saves converted files into sites/default/files/videos/converted/nnnn which is a directory containing the converted file, and nnnn is a number unique for each file.

On the web page, the original uploaded file is displayed. How can I switch to the converted ("transcoded") file?

Video module supports Rules integration. Is that a good solution?

Production and QA sites are hosted on AWS.


texts: Trigger redirect after Webform Remote Post Handler posted successfully

texts:
I've made a webform with a handler. This handler does a Remote Post towards an API. This API is actually a custom module within the Drupal install which (after some logic) passes all of the preprocessed data towards another API. When that is passed successfully I get a redirect URL back from them, but whatever I use (TrustedRedirectResponse or just normal RedirectResponse) it won't redirect. It just reloads the form.

How to solve this?


texts:
I created a node called "Tutorial". When I preview the post before saving it, I received the following error:

  EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7693 of /var/www/clients/client1/web2/web/includes/common.inc).

However, the error when submitting a blog (a node created by drupal) is different. Here it is:

  PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1: SELECT nid FROM {node} WHERE uid = ; Array ( ) in eval() (line 10 of /var/www/clients/client1/web2/web/modules/php/php.module(80) : eval()'d code).

and

  Notice: Trying to get property of non-object in eval() (line 8 of /var/www/clients/client1/web2/web/modules/php/php.module(80) : eval()'d code).

Any help please...


texts:
node_type_example module provides a file that defines form display configuration for a custom node type defined in this module. The file is named core.entity_form_display.node.basic_content_type.default.yml.

The example file clearly sets some field settings but is there a a schema for these config files? How to build my own config file for view mode and form mode?


texts: How to programmatically trigger a click on an AJAX enabled form submit button?

texts:
I'm trying to programmatically (with jQuery) trigger a click on button with AJAX behavior in a Drupal form, but so far jQuery('#edit-submit').click() doesn't do anything.

A real mouse click on that button works as intended. Any ideas how to make it work?


texts: Implementing preprocess function for custom template

texts:
In Drupal 7, I'm creating thank you page for a custom form and have following in my mymodule.module:

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

  $items['mymodule/thank_you/%'] = array(
    'title' => 'My Module Thank You Page',
    'description' => 'my module thank you page',
    'page callback' => 'mymodule_thank_you_page',
    'access arguments' => array( 'access mymodule thank you page' ),
    'type' => MENU_NORMAL_ITEM,
  );

  return $items;
}

function mymodule_theme() {
  return array(
    'mymodule_thank_you' => array(
      'variables' => array(
          'form_id' => NULL,
          'content' => NULL,
          'title' => NULL,
      ),
      'template' => 'thank-you',
      'file' => 'mymodule.theme.inc',
      'path' => drupal_get_path('module', 'mymodule') . '/templates',
    ),
  );
}

function mymodule_thank_you_page() {
  drupal_set_title( t( 'Thank You.' ) );

  $variables = array();

  return theme( 'mymodule_thank_you', $variables );
}

In mymodule.theme.inc, I have:

function template_preprocess_mymodule_thank_you( &$variables ) {
  $variables['title'] = 'test';
}

The problem I'm facing is that while I can access the thank-you template correctly, it doesn't read any of the variables I define in the preprocess function in the theme.inc file. Can anyone advice what I'm doing wrong for this?


texts: How can I update or insert a row with NULL fields using query builder?

texts:
In Drupal 7, I'm being sent an array of values from a user submission that are being mapped directly to a database table.

Some of those are blank and I'd like to set those fields to SQL-style NULL in the database.

To do this, my values array has the empty or blank fields set to PHP's NULL:

array('field1' => 'value1', 'field2' => NULL)

And I'm using db_update() like this:

$result = db_update('table_name')
  ->fields($record)
  ->condition('cmid', $form_state['values']['cmid'])
  ->execute();

However, db_update() doesn't appear to like NULL values in the $record array. I'm not seeing any sort of errors, unfortunately, except that no updates are being made to the database and that $result is returning a falsy value.

How should I be using db_insert() or db_update() if some my values may be blank at times, and I'd like these to equate to setting those respective database fields to NULL?


texts: Remove choice for user delete from Roles which can adminster the Users

texts:
I have a User Role called Supervisor which can create new accounts of role Supervisor.

The Supervisor can also delete other users with supervisor role. While deleting Other users the Supervisor gets the 4 choices that Drupal comes standard with:-

However, I want to present the Supervisor only the first option:-
 Disable the account and keep its content
and other options to be hidden or disabled by default.

I'd be very thankful for any hints how to achieve that... I'm already using Role Delegation module and have been trying different settings, looks like its not possible via that module.


texts: How to learn JQuery coming from a Drupal background but with little to no knowledge of Javascript?

texts:
So here I am in 2012 and although I've been making websites in my spare time for several years, I've managed to get the results I needed by using Drupal and simply cutting and pasting Javascript snippets, etc. when necessary.

Recently, I've got into development more seriously and I have some time to study the right way to do things so I've decided that I'd like to learn jQuery.  Basically, I'd like to make my sites a little more exciting and interactive; in the past, the sites I have built have been praised/criticized as "highly informative but very plain."

That said, I don't know much about Javascript to begin with.  Where should I start?  If it matters all my projects going forward will be in Drupal 7.

I was looking forward to the JQuery and Drupal videos on drupalize.me, but unfortunately I live in Japan and have a slow Internet connection which makes it almost impossible to stream the videos.


texts: Incorrect File Permissions When Images Are Uploaded in the CKEditor WYSIWYG using ElFinder on Windows

texts:
When I upload and image in the WYSIWYG, the image is added to the /sites/default/files/ folder, but cannot be seen on the web becasue IIS_IUSRS does not have the correct file permissions. Also, the permissions are only viewable by an administrator.

I tried the answer given on IMCE image upload and permissions issue, but both the temp and destination folders give IIS_IUSRS and IUSRS read/write/modify. I have even tried temporarily giveing 'Everyone' full control to get this working, but that does not help.

First, I have to click advanced to view the uploaded files permissions. I don't have to do that on the folders or other files in the folder.

Then I have to give Administrator permission. Again, this is not required on the folders or other files in the folder.

Then I can see the file permissions and IIS_IUSRS has List folder/read data, not modify. Also, this is inherited from 'Parent Object' not the parent folder.

If I click Disable inheritence and remove all permissions, then click enable inheritrance and apply, the correct permissions re inherited and the image can be seen on the web.

Has anyone else experienced this? Why doesn't the uploaded file inherit the folder permissiosn correctly in the first place? Why do I have to disable then enable inheritence to get it to work?

I need to fix this because the web editors will be adding a lot of images and it is not practical for me to manually change the permissiosn every time.

I don't know if this is an error with Windows Server 2012, IIS 8.5, CKEditor or ElFinder.

I am using ElFinder, but was only able to tag this with CKfinder. I am using Plupload as well, but can't remember if it integrates with ElFidner or not.

P.S. This site is stil in development. I will remove 'Everyone' before it goes live.


texts: When using the StringTranslationTrait in a service why should you inject the 'string_translation' service aswell?

texts:
I was reading the code comments in the StringTranslationTrait trait and saw the following:

  If the class is capable of injecting services from the container, it
  should inject the 'string_translation' service and assign it to
  $this->stringTranslation.

So I created a simple service, used the StringTranslationTrait, injected the string_translation service and assigned it to $this->stringTranslation. I found that when I don't inject the string_translation service the $this->t() function still works as I expected.

Why should one inject said service into his own service? Is it good practice or are there other benefits such as speed? The comments in the StringTranslationTrait file offer no explanation.

My service for completeness:

<?php

namespace Drupal\wow\Service;

use Drupal\Core\Url;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Symfony\Component\HttpFoundation\RedirectResponse;

/**
 * Class RedirectService.
 *
 * @package Drupal\wow\Service
 */
class RedirectService {

  use StringTranslationTrait;

  /**
   * The redirect object.
   *
   * @var \Symfony\Component\HttpFoundation\RedirectResponse
   */
  private $redirectResponse;

  /**
   * RedirectService constructor.
   *
   * @param \Drupal\Core\StringTranslation\TranslationInterface $stringTranslation
   *   The string translation service.
   */
  public function __construct(TranslationInterface $stringTranslation) {
    $this->stringTranslation = $stringTranslation;
  }

  /**
   * Sets the redirect.
   *
   * @param string $routeName
   *   Drupal route name to redirect to.
   * @param string $message
   *   Message to show after redirecting. If not provided no message will be
   *   shown.
   * @param string $messageType
   *   Message type of message shown after redirecting.
   */
  public function setRedirect($routeName, $message = NULL, $messageType = 'status') {
    $uri = Url::fromRoute($routeName);

    if ($message) {
      drupal_set_message($this->t($message), $messageType);
    }

    $this->redirectResponse = new RedirectResponse($uri->toString());
  }

  /**
   * Gets the redirect object.
   *
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   *   The redirect object.
   */
  public function getRedirect() {
    return $this->redirectResponse;
  }

  /**
   * Returns the response object.
   *
   * @return \Symfony\Component\HttpFoundation\Response
   *   The response object.
   */
  public function send() {
    return $this->redirectResponse->send();
  }

}


texts: Adding webform component in site factory

texts: Hi i am new to Drupal and got stack, I have to add a select list to the webform the select list has product list, I have a content type product. I used Entity reference and webform refernces modules but unable to make it.With using entity reference module i am able to get the product list but how will i add to the webform as a select list field.I am currently working on site factory.


texts: How to list custom navigation menu with submenu?

texts: I have created a custom menu in a drop-down manner. How can I show this custom menu with it's subitems programatically, so that I could customise it's styling?


texts: is it possible for content Entity to have multiple links

texts:
If I have: entity type: car_make and entity content: car_model

by default: car_model will have 5 links:

 *   links = {
 *     "canonical" = "/admin/test/entity/{car_model}",
 *     "add-form" = "/admin/test/entity/{car_make}/add",
 *     "edit-form" = "/admin/test/entity/{car_model}/edit",
 *     "delete-form" = "/admin/test/entity/{car_model}/delete",
 *     "collection" = "/admin/test/entity",
 *   },

the problem with above is: i dont know in that particular links belong to which car_make?

is it possible for an entity to have multiple canonical (or others) links?

something like:

 *   links = {
 *     "canonical" = "/admin/test/{car_make}/{car_model}",
 *     "add-form" = "/admin/test/{car_make}/add",
 *     "edit-form" = "/admin/test/{car_make}/{car_model}/edit",
 *     "delete-form" = "/admin/test/{car_make}/{car_model}/delete",
 *     "collection" = "/admin/test/{car_make}",
 *   },

so I could have multiple routes for car_model canonical links:

/admin/test/Honda/1
/admin/test/Honda/2
/admin/test/Honda/3
/admin/test/Toyota/1
/admin/test/Nissan/1

if it's possible, how to build/implement it?


texts: Defining the relationship between multiple term names in contextual filter

texts:
Content managers are supplying a comma separated list of taxonomy terms (apple,orange,banana) for a contextual filter (using Insert View).

We've got the patch from https://drupal.org/comment/7589873#comment-7589873 applied on views to allow content managers to provide multiple terms and convert them to tids.

We had tested prior to to content being added en masse, but now we are seeing results that are different from what we expected (and most certainly from what the results when we tested in November)

If the manager specifies apple - the view outputs nodes tagged with apple.
If the manager specifies orange - the view outputs nodes tagged with orange.
If the manager specifies apple,orange (or apple+orange) - the view outputs the nodes tagged with apple
If the manager specified orange, apple - the view outputs the nodes tagged with orange.

The query ends up including

WHERE (( (field_data_field_something.field_something_tid = '3903+3904' ) )AND(( (node.status = '1') AND (node.type IN  ('content_type')) )))

What we are expecting to see is:

If the manager specifies apple,orange - the view outputs all nodes that are tagged with apple OR orange.

Has anyone had any luck with this?


texts: Is there an easy way to programmatically add a comment field to a content type?

texts:
I currently have the following code in a D8 module:

$sql = 'CREATE TABLE `comment__field_follow_up_date` (' .
  "`bundle` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance.'," .
  "`deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'A boolean indicating whether this data item has been deleted.'," .
  "`entity_id` int(10) unsigned NOT NULL COMMENT 'The entity id this data is attached to.'," .
  "`revision_id` int(10) unsigned NOT NULL COMMENT 'The entity revision id this data is attached to, which for an unversioned entity type is the same as the entity id.'," .
  "`langcode` varchar(32) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The language code for this data item.'," .
  "`delta` int(10) unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields.'," .
  "`field_follow_up_date_value` longtext NOT NULL COMMENT 'The actual value that is stored in the field.'" .
  ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Data storage for comment field field_follow_up_date.'";

if ($dbConn->query($sql)) {
  echo "'comment__field_follow_up_date' " .
    "table (re)created successfully.\n";
} else {
  echo "Error (re)creating 'comment__field_follow_" .
    "up_date' table: " . $dbConn->error . "\n";
  exit();
}

$sql = 'ALTER TABLE `comment__field_follow_up_date` ' .
  'ADD PRIMARY KEY (`entity_id`,`deleted`,`delta`,`langcode`), ' .
  'ADD KEY `bundle` (`bundle`), ' .
  'ADD KEY `revision_id` (`revision_id`)';
if ($dbConn->query($sql)) {
  echo "Keys successfully added to 'comment__" .
    "field_follow_up_date' table.\n";
} else {
  echo "Error adding keys to 'comment__field_follow_" .
    "up_date' table: " . $dbConn->error . "\n";
  exit();
}

It seems to work, but upon inspecting the DB changes made when doing this through the UI, I have noticed another seven tables that are modified in some way, just by adding a single comment field!

So I am worried that I am not doing this the "proper" way, and that things will fall apart when we eventually upgrade to D9 (currently in the middle of a D6 - D8 upgrade and data migration).

Is there an official way to do this in code? I am not interested in doing it through the UI for each and every field I have to add (23 in total!) and all of my Googling attempts have only come up with articles related to that. MTIA! :D


texts: Facebook for drupal throws errors on install.

texts:
I have Drupal 7.9 installed with Facebook for Drupal module version 7.x-3.x dev.
Here are the errors given after turning on FB API & FBCONNECT:

Warning: include(/src/facebook.php) [function.include]: failed to open stream: No such file or directory in fb_requirements() (line 66 of C:\xampp\htdocs\drupal\phswap\sites\all\modules\fb\fb.install).
Warning: include() [function.include]: Failed opening '/src/facebook.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in fb_requirements() (line 66 of C:\xampp\htdocs\drupal\phswap\sites\all\modules\fb\fb.install).

reverting to a 6.x install for functionality is not an option.  I hope someone can help.


texts: What is best way to integrate external jQuery plugin? can i use it without libraries module?


texts:
I'm in need of an organization system for my JavaScript code Drupal. Currently, I've got it inside a folder in my theme's directory: "sites/all/themes/mytheme/js". I've looked at using Grunt.js, and wondering how I might implement it into my website. How would it help me?

Can it help organize large JavaScript files?

Could it help improve the speed of my website?


texts:
It is good practice when starting a new web project to begin with an alpha version. I like to add a "Keep me informed" e-mail field for the visitors. I may use the contact module and vary, but maybe there is such a module ?

I will need only field e-mail, a checkbox to accept conditions and a first confirmation mail.


texts:
I am working on a drupal commerce site which needs to be multilingual.

The problem I am facing is that I cant translate the title field of product types.
For example if I create a new product type called "Fruits" I want to be able to translate that title to other languages enabled on my site. I did replace the default title with a title field using the Title module but I still cant find my "Fruits" string to translate.
Thanks


texts: Cache page based on cookie value and URL

texts:
I am working on a site that is multi-lingual as well as multi-country. This means that pages will show content differently depending on a country cookie that is set when the user first visits the site. I used taxonomy tid's for the cookie's value, so there was no issue with case sensitivity, etc.

The problem is that Drupal's cache_page table indexes content by URL only, so users with different countries but the same URL all get the same content. I was able to get the effect I wanted just by modifying the mod_rewrite implementation:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{QUERY_STRING} !(cid)
RewriteCond %{HTTP_COOKIE} (?:^|;\s*)country=([^;]*)
RewriteRule ^(.*)$ $1?cid=%1&%{QUERY_STRING} [L,R=302]

RewriteCond %{QUERY_STRING} ^$
RewriteCond %{HTTP_COOKIE} (?:^|;\s*)country=([^;]*)
RewriteRule ^$ /?cid=%1 [L,R=302]

# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

I did have to disable the ExpiresDefault directive, as it was causing the browser to remember old content when the user switches countries.

The resulting cid's in the cache_page table look like this:

http://example.com/pagename?cid=98
http://example.com/pagename?cid=256

This post isn't so much of a "help me I'm stuck" but a "I had this problem, and here's how I solved it. Can you think of a better way to do this?"


texts: Moving Drupal to a new host but same domain

texts:
I am planning to switch web hosting provider for  one based in the UK, as the data centers and offices for my current web hosts are in the US which makes it a lengthy process if I need to contact them etc. I am going to transfer my domain name (so I think that all of my URLs will be the same) and I have downloaded my public_html directory and MySQL database to my computer. If I just upload everything to my new host will everything work?

I have checked and I know that my new hosts have similar spec'd servers with PHP 5, but it just seems a little too simple. The biggest thing I am concerned about is the different timezones and the MySQL database really. If it makes any difference, I will be using shared hosting.


texts: How to get exact value of a field from database?

texts:
I want to get value of a field, but I need the value that is saved in database, not the value that may be changed by hook_node_load. Is there a way to do this?

If there is no function for this purpose, which query should I use to get the field value?


texts: How do I use drupal_mail() without the $to value?

texts:
I'm trying to send same email to several users at once. They should not see each other's email addresses, so I add them as Bcc in the header.

However, the problem is that Drupal seems to require the $to parameter passed to drupal_mail() function. I tried passing both NULL and an empty string but without success. System would return the Unable to send e-mail. message.

I don't want to use some random email address instead and I want to avoid new modules.

How can I send an email just with BCC recipients?


texts: How to solve the "No file was uploaded." when trying to use custom form field?

texts:
I get "No file uploaded" when I try to use a custom form in drupal .Below is the code which I have used to upload a file in drupal custom form.

    function mobiae_custom_purchase_order_form(&$form,&$form_state) {
      // Merge default values into the default array.
        $form = array();
          $form['#attributes']['enctype'] = 'multipart/form-data';

          $form['file'] = array(
            '#type' => 'file',
            '#title' => t('Image'),
            '#description' => t('Upload a file, allowed extensions: jpg, jpeg, png, gif'),
          );

      return $form;
    }

function mobiae_custom_submit_form($payment_method, $pane_values, $checkout_pane, $order) {
  module_load_include('inc', 'mobiae_custom', 'mobiae_custom.purchase_order');
$form = array();
$form_state = array();
  // Default to a known test credit card number. For valid numbers of other card
  // types see: http://www.rimmkaufman.com/blog/credit-card-test-numbers/09112007/
//$form['#submit'][] = 'mobiae_custom_submit_form_validate';
  return mobiae_custom_purchase_order_form(&$form, &$form_state,$order);
}

/**
 * Payment method callback: submit form validation.
 */
function mobiae_custom_submit_form_validate($payment_method, $pane_form, $pane_values, $order, $form_parents = array()) {
  // Validate the credit card fields.file_save
 drupal_set_message('fgh');
 $file = file_save_upload('file', array(
      'file_validate_is_image' => array(),
      'file_validate_extensions' => array('png gif jpg jpeg'),
  ));

  if ($file) {
    if ($file = file_move($file, 'public://')) {
      $pane_values['file'] = $file;
    }
    else {
      form_set_error('file', t('Failed to write the uploaded file the site\'s file folder.'));
    }
  }
  else {
    form_set_error('file', t('No file was uploaded.'));
  }

//  module_load_include('inc', 'commerce_payment', 'includes/commerce_payment.credit_card');
  if (form_get_errors()){
    return false;
  }
}


texts: How can I have a node with the URL /themes

texts:
I've created a node and have given it the URL /themes. In full: http://site-name.com/themes.

Permissions on the Drupal system folder 'themes' mean that the URL /themes gives: 403 forbidden.

Is there anyway to have a node with /themes? I'd prefer if possible to keep my current file structure as I think it would be difficult to change with my current host (Pantheon).


texts:
I have a drupal 8.9.2 installation with many modules.
I ran upgrade_status and applied patches or upgraded modules to dev version like suggested.
fhebert@fhebert-communication:/var/www/domain.com$ composer show drupal/core-recommended

=> package not found
I have drupal core installed
I then ran a :
fhebert@fhebert-communication:/var/www/domain.com$ vendor/bin/composer require 'drupal/core:9.1.0 as 8.9.2' drupal/core-composer-scaffold:^9.0.0 drupal/core-project-message:^9.0.0 --update-with-dependencies --no-update
I've followed the path of aliasing the version like the doc says. But nevertheless i got this error :
 Problem 1
- Conclusion: don't install drupal/core 8.9.2
- Conclusion: don't install drupal/core 8.9.2
- Conclusion: remove drupal/big_pipe_sessionless 1.2.0
- Conclusion: don't install drupal/big_pipe_sessionless 1.2.0
- Installation request for symfony/debug ^3.4 -> satisfiable by symfony/debug[3.4.x-dev, v3.4.0, v3.4.0-BETA1, v3.4.0-BETA2, v3.4.0-BETA3, v3.4.0-BETA4, v3.4.0-RC1, v3.4.0-RC2, v3.4.1, v3.4.10, v3.4.11, v3.4.12, v3.4.13, v3.4.14, v3.4.15, v3.4.16, v3.4.17, v3.4.18, v3.4.19, v3.4.2, v3.4.20, v3.4.21, v3.4.22, v3.4.23, v3.4.24, v3.4.25, v3.4.26, v3.4.27, v3.4.28, v3.4.29, v3.4.3, v3.4.30, v3.4.31, v3.4.32, v3.4.33, v3.4.34, v3.4.35, v3.4.36, v3.4.37, v3.4.38, v3.4.39, v3.4.4, v3.4.40, v3.4.41, v3.4.42, v3.4.43, v3.4.44, v3.4.45, v3.4.46, v3.4.47, v3.4.5, v3.4.6, v3.4.7, v3.4.8, v3.4.9].
- Installation request for drupal/big_pipe_sessionless ^1.2 -> satisfiable by drupal/big_pipe_sessionless[1.x-dev, 1.2.0].
- Conclusion: don't install drupal/core 9.1.0
- drupal/big_pipe_sessionless 1.x-dev requires drupal/core ^8.3.0 -> satisfiable by drupal/core[8.3.x-dev, 8.4.x-dev, 8.5.x-dev, 8.7.x-dev, 8.8.x-dev, 8.9.x-dev, 8.9.2].
- Can only install one of: drupal/core[9.1.0, 8.8.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.9.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.8.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.9.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.3.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.4.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.5.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.7.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.3.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.4.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.5.x-dev].
- Can only install one of: drupal/core[9.1.0, 8.7.x-dev].
- Installation request for drupal/core 9.1.0 as 8.9.2 -> satisfiable by drupal/core[9.1.0].

Any idea ?


texts: How can I avoid wrapping my block into  tags?

texts:
I have created a custom block

/**
 * @Block(
 *   id = "block_text",
 *   admin_label = @Translation("Text"),
 *   category = @Translation("Text"),
 * )
 */

And here is a build() function

/**
 * {@inheritdoc}
 */
public function build() {

  return [
    '#type' => 'markup',
    '#markup' => $render,
    '#cache' => [
      'max-age' => 0
    ],
  ];

}

On the page my block is wrapped into

<div id="block_text"> </div> tags

Could you please tell me, how can I avoid this wrapping?


texts: How to use different theme for same database by using multi site?

texts:
I am working on the drupal8 multi site  . I have setup with different database its working fine. But I want to use with same database and different theme for both the sites  which I have created by multi site

I have created the themes folder inside the sites/site1/art .
but its using the same theme for both multi site

http://localhost/site1
http://localhost/site2

How can i use the different theme for diffenent sites?


texts: Update Drupal Core from 6.26 to 6.36 using update.php gave no errors, but Drupal still reports that it is on version 6.26

texts:
I've followed all of the steps on https://www.drupal.org/upgrade/running-update-php to upgrade my Drupal Core.

I put the site into maintenance mode.
I disabled all modules except the core required modules.
I used FTP to delete all of the folders associated with the upgrade.
I copied the entire directory of contents except .htaccess and robots.txt and part of my sites directory
I navigated to subsite.site.com/update.php
I ran the update
The update indicated that it performed 0 / 0 tasks and said it completed
I navigated to the administration page
I cleared cache
I reenabled modules
I checked the current upgrade status

Result: It still read that I was on 6.26
Expected result: It reads that I'm on 6.36

Quite confused about this. I have successfully upgraded my modules using the update.php script with no problems.  Any thoughts?

Thanks!


texts: How to display the weekly view in manage availability in rooms_availability?

texts:
I installed the Rooms module, and enabled all dependencies. Now when I edit a bookable unit and when I click in "manage availability", I can edit availability per month.

But I do not want a monthly view, I want weekly view. And I want to select the availability per hours/days.

Is that possible? And is there any other way to do this? Or is there another change in the code?


texts: Output node.type in page.html.twig gives "EntityReferenceFieldItemList cannot be printed"

texts:
Not sure if this is a bug, but I wanted to add some debug into an HTML comment in my page.html.twig file. I added <!-- type={{node.type}} --> but I get:

Uncaught PHP Exception Exception: "Object of type Drupal\Core\Field\EntityReferenceFieldItemList cannot be printed." at /www/cn8/core/lib/Drupal/Core/Template/TwigExtension.php line 443

It took me a while to track down since I was sure this would work. Shouldn't EntityReferenceFieldItemList have a toString() function for this purpose?


texts:
I have a list of unpublished nodes, created with the Views module. I would like a task to be run 3 times a day, at specified times. Every time the task  runs, only one of the nodes on the list should be published. How can I do this?
Steps I have tried
Scheduler
The Scheduler module requires you to specify the exact time you want the node to be published. This makes it complicated, as I would have to work out when each node is supposed to be published.
Views Bulk Operations + Rules + Rules Scheduler
With the Views Bulk Operations module, you can create a list of Nodes that are exposed to the Rules module. Rules can then act on the list and publish the node on the list. You can tell Rules to only publish a specific number of nodes.
This works perfectly. Except, it doesn't seem possible to schedule the Rule to run 3 times a day.
You can link the Rule to the main site Cron job, but this doesn't seem very precise as the Cron job could run more than 3 times.
There is a Rules Scheduler module (a sub-module of Rules), but it doesn't look like you can use this a Rules condition. There also doesn't seem to be a way to specify the running time.
Job Scheduler
This lets you set a time, but it doesn't seem to integrate with Rules or Views.


texts: Do we need to call mysql_close(); before switching the database using                db_set_active('sharedb');?


texts: How do I filter the "admin/content" page through it's url?

texts:
As the content overview page ("admin/content") has filtering capabilities, I'm trying to allow my users to access the filtered content through an url.

For example, if I want to see a list of contents of type "Article", I would like to access "admin/content/article" or a similar url, and get the contents page with the filter already applied.

Is there any way to do this?


texts:
I have a field with multiple values and i want to make form element more intuitive to work with.

I thought the easiest way would be to create custom html and include it in form, with the other elements. Is this ok?

Now the problem is, on form submit i can't access any of these values in this fields that are not native form elements. Is there a way to convince drupal to take in into $form_state['values'];

I know the right way is to create custom form element but i am afraid it would took me too much time.


texts: Programmaticaly remove a member from a group

texts: Using the Group module, what is the function to remove a user from a group using its user ID and the group ID?


texts: D7 Image Field Paths - Using a custom Path for Each Image Style

texts:
I am looking to have an image get dynamic name for each style that is generated by the system.

Currently I am using tokens to generate an md5 hash for the file name, but for each style (eg small/med/larg/original) the same name is held accross each image, and a new md5 hash is not generated for each new style.

default/files/styles/medium/public/490137c8f3d68c0a95efa0ed24d8efc0/fd6b143edb9fa9da62707eb7aee3f40eCosta%20Rican%20Frog.jpg

sites/default/files/490137c8f3d68c0a95efa0ed24d8efc0/fd6b143edb9fa9da62707eb7aee3f40eCosta%20Rican%20Frog.jpg

Ultimately I am trying to control access to the original files, though would like them to be public just not guessable, so they are easily shareable, if someone would like to.

I have tried to use File path module, but still no options based on style (that I can tell).

I am open to anyway really, modules or some php customization, ideas?

Thanks!


texts: Is there a way to send an email including a csv of all the entityform submissions?

texts: Is there a way to set Drupal up to send an email with an attachment of all of the entityform submissions for a specific form after each time the form is submitted?


texts:
I have a project where I want to group users. So for example, say we have a role of 'King' and a role of 'Subject'. I will have a view where a King can see a listing of all of their subjects. When a new user registers, they will sign up under the name of a King, so they will self-organize as to who they are a subject of.

Is Organic Groups an appropriate module for this functionality? I've watched a few tutorials, and it seems to be about sharing (or actually hiding and providing special access to) content. Here I'm not really so concerned about content, but rather grouping users.

If not Organic Groups, is there a good module for grouping users? This is for Drupal 7.


texts: Entity Translation - create a translation for all existing nodes

texts: Using Entity Translation, is there a way to create a translation for all existing nodes, instead of translating each one manually? For other languages there is lots of missing content, and would like to create temporary English versions for all languages before they are edited.


texts: How to auto-submit a form using Drupal Form API?

texts:
I need help with making a drupal form. I've made the form and it works perfectly fine, all it does is capture the email, ip, and date and time of a user. The problem is I don't want the user to have to click a button in order to submit the form, I want the form to automatically submit after a second or something.

//form hook, form elements start here

function form_casl_form($form, &$form_state) {
//sometext here
 $form['some_text'] = array(
    '#markup' => '
Simply click the button to subscribe.

'
);

  //submit button
  $form['submit_button'] = array(
    '#type' => 'submit',
    '#value' => t('Subscribe'),

  );
  return $form;
}
    //validate hook

Is there anyway to do this? I'm very close to finishing and this is the only thing I'm stuck on, any ideas would be appreciated!


texts:
I am having an issue with Domain Access in Drupal 7.

The admin user (and seemingly any user I add to the system) is unable to edit content attached to any child domains on the site.  The main domain is fine, but all others on the same site is effected.

When I attempt to edit content on the Admin (or other user) I get:

  You are not authorized to access this page.

I can view all content with no problem.

How do I fix these permissions issues?

The following is the screenshot of the permissions implemented by the module.

The "Bypass content access control" permission is disabled for all roles including the "Administrator" one; no other access module is enabled. Two Domains have been set up, the primary one and a sub-domain, which shares some content and has its own. Two languages are enabled for each domain (English and French) using the i18n module.
The "Edit any content on assigned domains," and "Delete any content on assigned domains" permissions are set, but the users still cannot edit the content.


texts: showing taxonomy (tags) in alphabetical order on nodes

texts: I just noticed that my tags are appearing at the bottom of my posts in the order I entered them, not in alphabetical order. I'm sure this is something simple, but I can't figure out how to get them to display on my nodes in alphabetical order.


texts: Field permission seems not working with multiple registration

texts:
Can I use these two modules together to create a registration form and limit access to certain fields?

Module installed :

field permissions
multiple registration

Wat is working ?

The creation of the specific registration form (multiple registration)
Set permission on field (field permissions)

What is not working ?

When I test the form, everybody (anonymous, role x, role y, ...) can see all fieds, even the restricted one.

I hope to be a little more specific.


texts: How to load an OpenLayers view into the content area with an AJAX link?

texts:
I have a link in the side bar that links to a OL view.

I would like to Ajaxify it so the view is loaded into the content area without a page re-load.

I am using the Ajax link example in the Example module and saving the $output at ajax_link_response() with this code:

<?php
...
function ajax_link_response($type = 'ajax') {
  ...
  $view = views_get_view('view-name');
  $view->set_display('display-name');
  $view->exposed_input['myfilter'] = 'filter-value';
  $view->pre_execute();

  // $output = t("This is some content delivered via AJAX");

  $output = $view->render();
  ...

This solution works fine for non OL views but fails to load a OL view into the wrapper div. What am I missing?

Gist files:

ajax_example.module
ajax_example.misc.inc


texts:
I have two forms on my site. I want to create a Block View for only one of them but as I choose "Webform: Webform form body (Form)" for the Fields in the View, I get both forms showing. I'm trying to only show one of the forms.

I tried adding a css class to a field and then using that as a means of filtering out the fields of just the one form but either I did it wrong or that isn't the way to complete the task.

How can I limit a Block View to show a specific Webform?


texts: Print image backgrounds and colors from views and blocks

texts:
I have a problem printing background images and bgd colors in html in views and custom blocks.
For example, when I add HTML code with CSS classes into a custom block (class has bgd image or bgd color style) it is shown on the html page in browser, but not in print preview (print backgrounds is off). Same thing is with the custom html code defined for view field (I created a link field and rewrite output)

Normally HTML code, defined out of blocks and views is, showing both bgd colors and images in print preview even if print background option is turned off in browser.
All CSS styles are defined in one file.

For some reason browser is not reading CSS styles within blocks and views.