texts: Fresh install with minimal: missing manage display even with field_ui turned on

texts: I just installed a fresh copy of Drupal 7 and chose the minimal install option. I enabled field_ui and I still do not see the manage display tab on content pages. However it does show up when you goto the content type directly. Did i forget to click somewhere?


texts:
I am developing a custom module that will have the functionality to show a particular menu link active on the desired path. For this I have implemented hook_form_FROM_ID_alter() hook for menu_edit_item(). In the edit form of each menu item there I have provided options similar to block modules page visibility options

Active on all pages except listed
Active only on listed pages
Active depending upon given php code

But I need to match the path listed with any existing path. Do I need to implement other hook or create more functions to implement this or this functionality should be implemented in hook_form_FROM_ID_alter(). I have also created a database table for this that stores

menu link ID
Visibility (i.e. flag to the option chosen by the user 0, 1, 2)
Pages (i.e the paths given by the user in the textarea eg: node/4,
etc)

Thanks for your help in advance


texts: Multisite: Share users and user roles for existing set up

texts:
I have made a Drupal 7 multi-site with 3 sites. Each site is running of the same Drupal install and has a separate database.
The database names are myhost_site1, myhost_site2 and myhost_site 3.  (My hosting provider puts in the myhost_ automatically).

I need the 3 sites to share the users and user roles.  I have read various tutorials and these are the steps I have followed:

Created a new database called myhost_users.
Copied the following tables from myhost_site1 TO myhost_users:
users, user_roles, authmap and sessions
Given the database users for each of 3 main databases access to myhost_users.
Open the settings.php for each site and insert the following code (replacing the existing $databse definition):

$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'NAME OF DATABASE',
  'username' => 'DATABASE USER',
  'password' => 'DATABASE PASSWORD',
  'host' => 'localhost',
  'prefix' => array(
    'default'   => 'NAME OF DATABASE',
    'users'     => 'myhost_users',
    'sessions'  => 'myhost_users',
    'role'      => 'myhost_users',
    'authmap'   => 'myhost_users',
  ),
  'collation' => 'utf8_general_ci',

);
When I go to my site, I get the following error message:

  Uncaught exception thrown in session handler. PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table

For the code posted in (4) I have tried using an underscore suffix for the database names (e.g, myhost_users_), but I still get an error message.

What am I doing wrong? Do I need any settings in sites/sites.php?

I would be open to using a module to do this.

Bakery is no good as it doesn't share user roles.

Account Sync shares roles, but it doesn't  seem to work.

CAS requires phpCAS which I do not have access to.


texts: How to check if maintenance mode is enabled in Drupal 8?

texts:
I've been searching for a way to check in PHP if the maintenance mode of my Drupal website is enabled, but I only found some solutions for Drupal 7, which doesn't seem to work on D8.

Have got any ideas?

Thank you.


texts: Page caching with multiple versions of the cache

texts:
My site is very much faster with page caching on. However, I have a custom module that serves 5 different slightly different versions of my content. In other words, people in New York see East Coast stories, but not California stories, but everyone sees national stories. This is mostly done through a custom Views filter that checks for a cookie.

Each node is tagged with an internal taxonomy that determines which areas to show that content in lists generated by views. The actual content isn't hidden or different based on the cookie, just the lists of events, local stories, etc.

Is there a way of serving cache A to people with cookie A, cache B to people with Cookie B, etc?

Code from the custom Views filter-

function query(){

  $this->query->set_distinct(TRUE);
  $invert = $this->options['invert'];
  //Get the taxonomy id corresponding to the user's location from a cookie.
  $office_tid = MCC_location_get_cookie("tid");

  //Get the taxonomy id of the country- code used on 2 sites
  $country_name = variable_get('MCC_location_site')?"U.S.":"Canada";
  $country_tid = taxonomy_get_term_by_name($country_name,'regions');
  $country_tid = current($country_tid)->tid;

  if($office_tid == $country_tid){
    // An area without an office was selected, such as Yukon, filter should act as if no province has been selected
    $case = $this->options['office_not_set'];
  }

  $join = new views_join();

  $join->definition = array(
    'table' => 'taxonomy_index',
    'field' => 'nid',
    'left_table' => 'node',
    'left_field' => 'nid',
  );
  $join->construct();
  $this->query->add_table("taxonomy_index", NULL, $join);
  $this->query->add_table("taxonomy_index", NULL, $join, "taxonomy_index_for_office");

  $this->query->add_where_expression($this->options['group'], "taxonomy_index_for_office.tid = ".$office_tid." AND taxonomy_index_for_office.nid NOT IN (SELECT taxonomy_index_for_office.nid FROM taxonomy_index AS taxonomy_index_for_office WHERE taxonomy_index_for_office.tid = ".$country_tid.")");
}


texts: Where is menu settings for node types stored in database

texts:
I looked in all tables to see where Drupal stores menu settings (including which menus should be available to a content type) for node types, but can't find it anywhere. We have a lot of content types on a multi site instance, and we're trying to enable menu for a content type directly in the database.

Thanks!


texts: Resetting a configuration object to "factory settings"

texts:
My module defines a configuration entity (specifically a BBCode tag macro with a template) that can be created and edited with a web form.

It can also be created by other modules using a config/install/xbbcode.tag.*.yml file - and of course those objects can also be edited and deleted.

Is there a way to access and recreate the original version of a config object that has been edited, without having to reinstall the whole module? I like the flexibility of customizing these templates, but users need to be able to  restore the factory settings somehow.


texts: How can I get more than 10 search results on one page in Drupal 7?

texts: By default search page shows only 10 results. How can I change it to display unlimited number of results?


texts: Select and trigger popup on marker via javascript

texts:
Is it possible using javascript to trigger a select on an openlayers marker?
I have access to the name and coordinates of the marker, at the moment I am using setcenter to adjust the map to show the marker but I can not find an api call for selecting markers? Hopefully I'm just missing something simple!

Cheers,
Paul

update

So the use case is:

Auto complete search that shows place names
select a place name
map scrolls to the correct lat/long

Now I need to trigger the marker popup that is in the centre of the screen.

Note:
I have popups working via mouse clicks.


texts: domain change in a multisite environment

texts:
I have 2 sites in a multisite environment. one is www.mycompany.com installed at public_html/mycompany.com main directory of the drupal core and uses sites/all folder

I have another site www.sub.mycompany.com using the folder public_html/mycompany.com/sites/sub.mycompany.com

I want to change their domain names. I want www.sub.mycompany.com to be in www.mycompany.com and want www.mycompany.com to be in www.sub2.mycompany.com

so www.sub.mycompany.com won't be used anymore

how to do this?


texts:
If I'm not planning on using any JS libraries other than jQuery, is there any reason to need Drupal's call to jQuery.noConflict() which removes $ as an alias for jQuery?

Assuming there is no need for removing the $ alias, is there a way I can get it back universally without always having to wrap my jQuery code in (function($){...})?


texts: Resize modal popup base on content with Modal Forms module in Drupal 7

texts:
I use the Modal Forms module to show the popup for the website and it worked well with fixed data (from we have several sizes for modal forms : small, medium, large) but for the dynamic data (The content will be changed for each time loading the popup) it is displayed outside the popup and i don't know how to fix that.

Does anyone have the same problem and how to fix that?


texts: How to change the text of the "checkout" button in Drupal commerce cart?

texts:
How can I change the text of the "checkout" button in Drupal commerce cart?

I need it to be "continue" instead.

thanks

   function rooms_form_alter(&$form, &$form_state, $form_id) {
      dsm($form_id);  // print form ID to messages
      switch ($form_id){
            case 'views_form_commerce_cart_form_default':
                $action['#value'] = 'continue';
            break;
      }
    }


texts: Front page elements not displayed correctly

texts:
I have recently uploaded my local site to the hosting server
and since then I have had seen front page element displayed
incorrectly. I have a views slideshow assigned to the front page
and that is where elements are missing. When I click on the home
link on the website, everything is displayed correctly.

I occasionally get the error:

Notice: unserialize() [function.unserialize]: Error at offset 83 of 108 bytes in variable_initialize() (line 935 of /home/ebemorgi/kog.church/includes/bootstrap.inc).

I am not sure  whether the above error has got something to do with
the problem. Also, initially I had a problem  with clean urls and then
I have uploaded the .htaccess that ships with drupal.

Any suggestions are appreciated.

Edit: The problem usually happens with firefox.


texts: Why does default.settings.php suggest writing the value of the hash salt in an external file?

texts:
The default.settings.php file contains the following comment:

  For enhanced security, you may set this variable to the contents of a file outside your document root; you should also ensure that this file is not stored with backups of your database.

  Example:

$settings['hash_salt'] = file_get_contents('/home/example/salt.txt');

Assuming the attacker was able to create a PHP file inside my Drupal installation, in which way does writing the hash salt in a file increases the security? In any case, the attacker would be able to read the value for $settings['hash_salt']. Eventually, the attacker could change the value for $settings['hash_salt'], but does doing this make any sense for the attackers to do?


texts:
Just as pictured here, I want to place the superfish menu block under the logo. Didn't manage to find any solution online. Any help?
The site works on Drupal 7, Superfish 1.8, superfish libraries 1.1 installed.


texts: Is EntityFieldQuery as sophisticated as the Database API?

texts:
I was wondering if EntityFieldQuery is just a layer of abstraction on top of the database query builder. For example can I use addExpression and isNotNull in an EntityFieldQuery, for example?

Or, is it separate and not as sophisticated.


texts:
I'm trying to add a button Sharethis to a slideshow "views_slideshow" that shows the whole content to the specific element in the slideshow.
the problem is I can't add this button to the slideshow, and I have it to show inside a block.


texts:
When creating text filter, there are several "type" options (see here). What is the difference between these two?

FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE: Irreversible transformation filters.
FilterInterface::TYPE_TRANSFORM_REVERSIBLE: Reversible transformation filters.

Are there some examples when to use them? For example, when I add a class to a HTML element without any class or specific attribute, is that reversible or irreversible?


texts:
The problem is all in the title. So here is my code (i cut some part to make it more visible) :

Constructor :

public function __construct() {
        $user = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
        $this->sub_forms['user'] = \Drupal::service('entity.form_builder')->getForm($user);
    }

buildForm :

public function buildForm(array $form, FormStateInterface $form_state) {
        $sub_forms_keys = array_keys($this->sub_forms);
        // INC ALL SUBFORM INTO THE MAIN FORM
        foreach ($this->sub_forms as $key => $sub_form) {
            // REMOVE THE PROCESS CALLBACK
            if (!empty($sub_form['#process'])) {
                unset($sub_form['#process']);
            }

            // ALTER THE SUBFORM
            if ($key == $sub_forms_keys[0]) { // user Alter
                foreach ($sub_form as $field_key => $sub_form_field) { // Pour tous les champs
                    if (substr($field_key, 0, 10) != 'field_user') { // Si ce n'est pas un champ personnalisé friterie
                        unset($sub_form[$field_key]); // Cacher le champ
                    } else if (array_key_exists('widget', $sub_form[$field_key])) { // Si c'est un champ friterie et qu'il dispose d'un widget
                        $sub_form_field_widget = $sub_form[$field_key]['widget'][0];
                        $sub_form_field_widget['#states'] = array(
                            'visible' => array(':input[#edit-proprietaire-0]' => array('checked' => true))
                        );
                        dsm($sub_form_field_widget);
                    }
                }
            }

            // ADD THE SUBFORM INTO THE MAIN FORM
            $form[$key] = [
                '#type' => 'container',
                'form' => $sub_form
            ];
        }
        return $form;
    }

Here is a pastern link of a dsm() of a field to show you the structure and that the #states is include : http://pastebin.com/1a8AqVzm

Then here is the HTML code of the entity i want to focus (it's a radio button) :

<input class="clear-panel-field panel-field-inline container-inline form-radio" data-drupal-selector="edit-proprietaire-0" type="radio" id="edit-proprietaire-0" name="proprietaire" value="0">


texts:
I am trying to get a total count of the results using Views.  Looking at this link, Count results in Views using aggregation, I use aggregation, but Views counts each row as 1.  For example, this is what I get:

TITLE         Results
"A title"     1
"A title2"    1
"A title3"    1
etc...

I want it to be

Title
"A title"
"A title2"
"A title3"

Results: 3

Any way to do this in Views?  If not, is there a way I can weak the current Views SQL or its output instead of having to write my own module and SQL query from scratch?


texts: Is there any way to generate url alias instead of this taxonomy/term/%/faq, in views

texts: I have created a page view taxonomy/term/%/faq. It works fine but I need to replace taxonomy/term/% with its url alias.


texts: how to tell which book node is the root node programatically

texts: If I have some nodes that are of type book, how can I go through them in a php script and tell which is the root?  thanks


texts: Hiding referenced term name from node display

texts:
I've stumbled upon a situation where I want to display a link and a custom icon for the link (I'm using paragraphs module) which will be themed correctly later, BUT. After providing a taxonomy term with a image field and making it display ONLY the image by default I'm still getting a h2 of the linked terms name.

I already tried hook_entity_view, but it doesn't have separate values for icon and the randomly displayed term name - only the term id meaning I cannot unset it at this hook.

Any suggestions/experience on how should we work with this?


texts: How to change path of composer manager file directory?

texts:
I have Drupal 7 setup with Composer Manager installed in it. I wanted to set-up the website in dev environment hence took DB backup and files from the production environment, and installed it in dev environment.
Now whenever I am trying to check Status Report (Reports => Status Report) or want to go in Composer manager (Configuration => System => Composer Manager) I am getting following error:
RuntimeException: Error creating directory: /path_to_drupal_root_dir/sites/default/files/composer in composer_manager_file_dir() (line 299 of /path_to_drupal_root_dir/sites/all/modules/composer_manager/composer_manager.module).

Thought this might be the issue with folder permission, but it had proper permissions.
So using drush I checked the composer variables.
drush vget composer

There I came to know that the value of the variable composer_manager_file_dir is holding the path of composer directory from production environment, and it's value/path needs to be changed according to dev environment's composer directory location.
So I tried to change that variable's value using following drush command:
drush vset composer_manager_file_dir 'C:\path_to_drupal_root_dir\sites\default\files\composer'

The command only changed the variable's value for the moment, but somehow the old value gets set back again.
So I tried to changed it with variable_set() method in some custom module as follows,
variable_set('composer_manager_file_dir','C:\path_to_drupal_root_dir\sites\default\files\composer');

but I don't know why it changes for the moment and again rollbacks to the old value.
Any help with on this will be appreciated.
Thanks in advance.


texts: Theming custom block type have multiple paragraph field

texts:
I've created a custom block type includes a paragraph type field and make it multiple. I've configured this block to display it only on the front page. I have a page--front.html.twig template in my custom theme. What I want to do in my front page template is looping through the paragraph field to get each field item and theming it in custom HMTL. So what is the correct way to do this? I've tried block--BLOCKID.html.twig and try this code.

{% for item in content.field_home_page_carousel %}
{{ kint(item.field_home_slide_image) }}
{% endfor %}

but I got nothing.


texts: Date module: detect if an end date was set

texts:
I have a content type with a date field. It is setup to collect an end date (optional). The field type is Date (UNIX timestamp).

The field is to store "experience" as (from) January 2011 - (to) March 2012.

If I don't check the "show end date" when creating content, the end date is the same than the start date. But in my case, I sometimes need to collect an end date that would be the same than the start date (January 2011 - January 2011).

So how do I know if that "show end date" checkbox was checked?

Right now here is what I get when the end date is the same than the start date:

value (String, 10 characters ) 1443650400
value2 (String, 10 characters ) 1443650400

And this is what I get when the "show end date" was not checked:

value (String, 10 characters ) 1443650400
value2 (String, 10 characters ) 1443650400


texts: How can I render a result row using the Views API

texts:
I'm trying to render the rows in a view manually using the Views API. The style plugin is the "Unformatted" plugin. This is my code:

<?php
$view = views_get_view('nearme');
$view->execute('default');
$view->preview();

$renderer = $view->style_plugin->row_plugin;
foreach ($view->result as $row) {
  echo $renderer->render($row);
}
?>

This code almost works - it renders essentially a blank row. My "Global: custom text" field is rendered, as are some generic labels and field HTML, but the actual values from $view->result are not interpolated.

What am I doing wrong?


texts: Apache Solr Search Integtation and the Default Drupal Search Form

texts:
Apache Solr Search Integtation (apachesolr module) is dependent on the core Search module. I set this up at https://www.test.epcsite.com/search/content. I also setup display suite so that I can theme my search results.

I have a couple questions:

The Default Search form uses Drupal core search. If you go to https://www.test.epcsite.com/search it redirects to https://www.test.epcsite.com/search/content, I don't quite know why. I would like it to stay on "/search".
apachesolor setup a url at /search/site, which puts a tab on the search form. Clicking on the tab takes you to another search form, but it won't use Display Suite to theme the results. The tab itself is confusing and it would be nice to get rid of it.
Going to https://www.test.epcsite.com/search/content displays "Your search yielded no results" but I haven't run the search yet. How do I customize this message not to show? How do I customize the message so that it says what I want.


texts: How do I add a view between display fields of a node?

texts:
I have a view that displays a table at the bottom of every node. It's part of the content of the node so I want to have the "comments" section below the view.
However, the comments are a display field, which means they have to be in the same block as the node content. Since the view is a separate block I can't place the view between the node content and the comment section.
Is there a workaround for this?
Note that my content is created by the website community, so I can't use any solution that involves changing the contents of the nodes manually.


texts: How do I create menu links programmatically?

texts: I need to add some links to existing menu (or to new) programmatically in Drupal 8.


texts: Throw entity field value from submission to route path?

texts:
I have created two entities and I want to connect them by route.
my edit route is:

entity.entity_two.edit_form:

  path:
'/property/configuration/communication/{entity_one}/variant/{entity_two}/edit'

  defaults:

    _entity_form: communication_variant.edit
    _title: 'Add/Edit Email Variant'
    entity_one: '%id'
  options:

    parameters:
      entity_one:
        type: 'entity_one'
      communication_variant:
        type: entity:node

but I get an error on edit path as it says: entity one is empty but as i check entity one has value in the table.
so my idea is that on submission of entity two form, I get entity_one id by entity reference and set in my route. so I want to implement that idea any help?


texts: form w #ajax attribute to change content based on keyword input to be called to query Json from youtube

texts:
I am a PHP developer but new to Drupal development, although I am creating a module. Seen here http://vperry.co/drupal-aif-14/
I have created  block that is displaying Json from Youtube, using a query string w the getcontents function (php)
Here are my files on github.
https://github.com/aloysiusbe/aspenyoutube
I need to create a keyword input to work in drupal to pass a variable to send along with the Json query.
Here you can see with the regular php file it works:

Please Help!


texts: Views XML Backend, Render URL as MP3 player

texts:
I have a podcast feed that currently i am manually maintaining. I am planning to automate the xml generation in the near future from one site then have it displaying on another.

I am trying to get the displaying part to work now. I am using Views XML Backend to pull the feed (I don't want to import the content as nodes as there is no need to) which is working for me on the text stuff.

I have an enclosure tag and a guid tag in the xml that has the URL to the MP3 file. I want the url to change from being a link (which I had to use the rewrite to link feature in views) to an Embedded MP3 player that displays in a page or block.

Anyone got any tips or suggestions on how to do that? I've tried a few things and am yet to find anything that works.

Running Drupal 7


texts:
I'm new to Drupal (and SE) and am looking for a way to embed Drupal 7 content in an external website.
D6 had modules for that (web widget and embed widget).
How can I do it in D7?
Thank you!


texts: Cannot apply my custom styles to HTML tags in ckeditor

texts:
I'm using Drupal 8 and am trying to make ckeditor truly wysiwyg.

To that end I've successfully gotten ckeditor to use a custom stylesheet by adding a ckeditor_sylesheets key to my theme's info.yml and my stylesheet's path as the value.

If within my custom stylesheet I create styles and assign them to a class, those styles are reflected within the form if I reference the class.

However, if within my stylesheet I define a style for an HTML element (e.g. h1, p, etc.) ckeditor ignores those styles.

This is the case regardless of how I set or unset "Limit allowed HTML tags and correct faulty HTML" and "Correct faulty and chopped off HTML" at /admin/config/content/formats.

As I mentioned, clearly ckeditor is accessing my stylesheet as styles assigned to classes work.  Also, I can see the stylesheet in Chrome's inspector.  If I inspect a HTML tag for which I've defined a style it shows me that user agent stylesheet is being used.

I don't think it matters but just in case; I'm using Seven for my administrative theme and my default theme is a sub-theme of bootstrap.

If someone could give me a clue I'd appreciate it.


texts: Localization vs Translation from a Drupal perspective

texts: Been wondering what is the difference between the meaning of these two words when it comes to Drupal, and it seems they are used interchangeably. Is that a correct understanding?


texts: How can I do a cascading Entity Reference data entry or is it even possible?

texts:
I am working on a system where we want users to be able to create a Project which will be made up of one or more Project Activities, each Project Activity being constituted of several Sub-Activities.

Each Project Activity can be one of several types, and the Sub-Activities also are typed. This means that when I assign a Project Activity to a Project, I should only assign Sub-Activities of the same corresponding type.

So, I have two fields in the Project content type, one is Project Activity, the other is Sub-Activity (which can have multiple values). Both these fields are Entity References to the corresponding Project Activity and Sub-Activity content types. What I want then, is when I enter the Project and choose Project Activity type A, I should only be able to select Sub-Activities of type A also.

I had thought to do this using the Views selection with a contextual filter, however this only seems to work with a static filter when mine needs to be dynamic.

Does anyone know a way round this, or a different approach which could solve the problem?


texts: import csv to build several nodes all at once

texts:
I'm new to Drupal. What's the easiest way to create multiple nodes on Drupal 7 all at once? I built a special content type and have the fields data in a CSV file.
Thank you


texts:
I 'm working on a sandbox module, which is text_or_user_reference field.

To release the module, I have to create a branch of the module i.e 7.x-1.0

Since beginning of the module development I was not aware with this thing, so I was working on master branch.

Now I have to add the tags to create the branch. To create the tags I followed this guide on drupal.org

These are the commands to push and create the tags:

  git tag 7.x-1.0

  git push --tags

  git push origin tag 7.x-1.0

I have applied all the commands, but I am not able to see whether tags are created or not.

My problems:

How to check whether tags are created or not ?
Do I have to seperately assign to tags to each file like .module file, .install file etc.
When I go to Edit of the project and select the dropdown version to work from it doesn't show the tags/version I created i.e. 7.x-1.0

Consider this command:

  git branch -v

What should I expect as a result after I run it? The list of all the files of current branch?


texts:
I'm using Flexifield to create a repeating series of CCK field groups via a button that says "Add another item" (I.e., setting the number of field values to unlimited). See below:

My client has requested the ability to remove rows from this list once added. Any idea how I'd do that?

Thanks!


texts: how to combine profiles and content types in a view

texts:
I'm trying to filter some content with a view, But view provides access to single entity type. I want to add the fields from profiles and content types. I'm wondering Is it possible to include both contents and profiles in a single view. I have spent lot of hours searching on web to find a solution for this, but didn't helped.

In this image I have selected content and it allows only to access the elements of contents. But I also want to filter the result by matching the contents of a content type and a profile.

Can anyone provide me a better solution to solve this problem....


texts: Pages hit by Boost Crawler are not being cached on Nginx Reverse Proxy

texts:
I am running an Nginx reverse proxy on port 80, with Apache behind on port 81. I do not have nginx set up to serve boost cache files, only static assets.

If I hit port 80 from my browser, or curl on the box itself, it generates a cached file. However the crawler fails to generate a file, despite Apache access log suggesting the crawler is regularly hitting pages (the site is not public, access is only allowed for IP exceptions).

I have setup the cron to hit either Nginx or Apache directly, neither seems to make much difference, both show hits from 127.0.0.1 to cron.php, /boost-crawler and various pages that must be originating from the crawler, but at no point are cache files generated.

After a couple of hours /boost-crawler is still being hit, but no crawling is happening at all now.

I am using Debug 9 but nothing in the dblog seems to point to any error, its simply full of the following messages:

boost   2012-07-17 10:32    Crawler - Thread 2 of 2 Done.   Anonymous
boost   2012-07-17 10:32    Crawler - Thread 1 of 2 started Anonymous
cron    2012-07-17 10:32    Cron run completed. Anonymous
boost   2012-07-17 10:32    Crawler Sleep for 15 seconds    Anonymous
boost   2012-07-17 10:32    Crawler Start ...   Anonymous
boost   2012-07-17 10:32    Expired stale files from static page cache. Anonymous
boost   2012-07-17 10:32    Debug: boost_cache_expire_all_db() Following ...
According to the various buttons on the Boost Settings page there are:

Boost cached data: 0 pages
Boost expired data: 0 pages
Database records: 0
Files: 0

I have also posted this to the Boost Issue Queue: http://drupal.org/node/1688456


texts: Can't get value from cache_page table only cache_default

texts:
I am fiddling a bit with drupal 8 cache. Looking at cache_page table and there is clearly a value with CID i am trying to fetch. I try this.

if ($item = \Drupal::cache()->get($cid)) {
  dsm($item);
}

and keep getting nothing for that CID, when I try some CID from cache_default. I get it without problem. So I am wondering how to get values from other tables?


texts: Is there a bulk method of doing 301 redirects from old nodes to new node pages?

texts: I am updating an old drupal 7 site and many of the old nodes now have newer counter parts with new nodes. Since alot of my old nodes have already been spider-ed, I want to do a 301 redirect to the new nodes. I'm currently doing it manually by deleting the old node and then copying the URL alias into the redirect module and redirect it to the new node path. Is there a easier way to do this if I have 1000 nodes that need redirection?


texts: Centering pager for view using Bootstrap 3

texts:
I am using Drupal 7 and Bootstrap Business, which is a theme that utilizes Bootstrap 3. I have found that my pager in my views pages is not centered.
I know that Bootstrap 3 for non CMS work has a particular css markup that you use to center pagers, but in Drupal 7 there is no UI in the view that allows you to alter the css for the pager that the view uses.

Here is the non changeable html for the pager for a view in Drupal 7

1

2

3

4

5

6

7

8

9

…

next ›

last »


texts: Which of the wysiwyg modules will get in to the core of Drupal 8?

texts:
I heard that there will be a wysiwyg editor in core for Drupal 8. Is there any decision made yet which one will make it?
I heard about:

CKEditor
Aloha Editor
Wysiwyg

I have a decision to make which module I will add to my site and I need some deeper integration of the wysiwyg to the Drupal core. For example, that all external links are programmatically get stored in a link field an so on.
So I am hoping to get some of those features in feature when I choose the right module backported to Drupal /.


texts:
I installed latest version of Drupal 8.1.3 on my site.
Everything went fine and no error message.
But after installation done, my homepage became this.
No layout, menu not working.

How can I fix this?


texts: One exposed filter in separate block for 2 display of one view with Quicktabs

texts:
I have 2 displays for a views (one is clone of other, so the filters are same).

One is a block to show with Quicktabs.
The other is an exposed form with filter on separate block.

The exposed filter works only for 1st display, and if add 2nd exposed form, strange but it works to the 1st display too.


texts: Show dynamic h1 title on taxonomy listing page

texts:
I have a small whisky review blog which contains many tags. For some reason, on these tag listing pages, the page title (for example, Scotch Whisky for http://themashing.com/t/scotch-whisky) is not showing.

Basically, what I want is the title to show right before the list of articles. So if I visited the Japanese Whisky listing page then Japanese Whisky would be the page title.

Why doesn't the title appear? How do I fix this?


texts:
I have a website running on a VPS with centos 6.6 and recently my login with facebook system stopped working with no apparent reason... Every time I try to login with facebook I receive the following error:

  The Facebook login could not be completed due to an error. Please
  create an account or contact us directly. Details about this error
  have already been recorded to the error log.

So I checked the error log and:

Facebook OAuth could not acquire an access token from Facebook. We queried the following URL:

  https://graph.facebook.com/v2.3/oauth/access_token?client_id=....&client_secret=....&redirect_uri=http%3A//portugalcinegetico.pt/fboauth/connect&code=AQAspHBdtFnb9YYjcKtvp-iqozEXiEr8xe5OCD_S4ONyqv2peWwl3wUDN6dzEMq88s2FlPc-y8_7RuCk_R52e4lTuoRjn-rbQ25LqVTeKPFOXqDH36PiD3ecJeOFAgFwK5ocfJHXH7yINER6cRbuOTCf9CVZyyUp0TkDLMOu3YOfFo6GxZh4lWiRp1UB4N9nr18lwfiTYfoNTQKR4eSv7VeH7Ak0dgHWC27dBcs-H8cVUbTRMG92ehvgbdCUR5wbakbYK3Ji5yxIh3hSQ_duZIoEFTcGxBB5fUSzRlMLretSTs-ox7c6314zID-bYRRvBLg

  . Facebook's servers returned an error Connection timed out:

  (no data returned)

Can anyone help me with this. I already checked all configurations in my facebook app and in drupal fboauth...

Thanks in advance!


texts:
I have some node IDs I'm passing to a view; however the sort order is wrong.

Here's my pseudo code:

//query to grab the nids

if (!empty($nodeids)) {
  $view = 'taxo_listing';
  foreach ($nodeids as $nid) {
    print views_embed_view($view, block_1, $nid);
  }
}

What I need to do is pre-build the view then run implement hook_views_query_alter to sort the view before printing out the view.

Been looking at http://views.doc.logrus.com/ for a while now, but it's all a bit confusing, can anyone offer any clues as how to go about this? I know what I want to do but unsure how to go about it, sound familiar guys?

Thanks in advance.


texts:
I have created some extra statuses: Paid and Unpaid.

Now they got the functionality and react on the transaction balance perfectly fine. However, on the user site, it is kind of a dumb thing.

Even if the invoice is unpaid, there is no option to pay the invoice from the user --> orders pages. It looks like you can ONLY pay at checkout; apparently you cannot pay with Paypal later on.

Either way, I am looking for the function that users can pay the amount (or remaining amount) using Paypal WPS. Can any one help me accomplish this?

Secondary, as small addition to this, I would love the user to be able to see transactions that have been done AND the open balance (if any) similar to what the Admin view got.

Can anyone help me accomplish these 2 points? I am not a coder so please keep it simple.


texts: Executing view twice with different filters returns same results

texts:
Here's my simple scenario :

Execute view with exposed filter (min & max dates)
If there are no results, execute again with min date = 0 to get all results

Unfortunately, the query static cache will execute the same query twice.

$view           = views_get_view('my_view');
$view->set_display('default');

$date       = $view->get_item('default', 'filter', 'created');
$date['value']['min']   = date('Y-m-d', $date_from);
$date['value']['max']   = date('Y-m-d', $date_to);
$view->set_item('default', 'filter', 'created', $date);

$view->pre_execute();
$view->execute();
$results = $view->result;

$view->destroy();

// do logic here to determine if view needs to be queried a second time

$view           = views_get_view('my_view');
$view->set_display('default');

$date       = $view->get_item('default', 'filter', 'created');
$date['value']['min']   = date('Y-m-d', 0);
$date['value']['max']   = date('Y-m-d', $date_to);
$view->set_item('default', 'filter', 'created', $date);

$view->pre_execute();
$view->execute();
$results2 = $view->result;

$view->destroy();

// $results and $results2 are identical

If I comment the first part of the code, the second query will work correctly and $results2 contains a lot more results.

I've tried answers from this question [1], but no luck.

The only solution I found is to clear the entire static cache with drupal_static_reset();

How to elegantly solve this problem? I believe clearing only the static cache for the queries will solve this, but I fail to find the good $name argument.

[1] Clear views cache after node inserted in Drupal 7


texts:
I'm managing two D6 (6.29) sites that keep missing their homepage. It has been happening 2 to 3 times in a 24 hour period with regularity. I have contacted the hosting company who has been monitoring the servers. I have implemented a monitoring system myself and now aware of how often they go down. What is happening is anonymous users are seeing a 404 page not found. If I login in, I see the front page. If I save the site information page, without changing anything it comes back. If I run cron, it comes back. If I flush the cache it comes back. Both sites use the default /node for the homepage.

Any idea?


texts: How to wrap Drupal "$messages" in a div?

texts:
How can I wrap $messages in a div using template.php file?

This is my code:

function THEME_status_messages($variables) {
  $display = $variables['display'];
  $output = '';

  $status_heading = array(
    'status' => t('Status message'),
    'error' => t('Error message'),
    'warning' => t('Warning message'),
  );
  foreach (drupal_get_messages($display) as $type => $messages) {
    $output .= "
\n";
    if (!empty($status_heading[$type])) {
      $output .= '
' . $status_heading[$type] . "
\n";
    }
    if (count($messages) > 1) {
      $output .= "
\n";
      foreach ($messages as $message) {
      $output .= '
' . $message . "
\n";
    }
    $output .= "
\n";
    }
    else {
      $output .= reset($messages);
    }
    $output .= "
\n";
    }
    return $output;
}

I need to wrap so the result it's this:

I'm not interested to in doing it in page.tpl.php like this because it will leave an empty div if there's no messages:

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

So far I wasn't able to output the #messages div, every time I try something I break everything or nothing happens.

Thank you.


texts: Adding quantity to a Commerce product's attribute

texts:
I have a D7 Commerce Store. It will be selling to wholesales.

I have a Product that has multiple attributes. An example of the attributes is as follows;

T-Shirt Printing (Product)

Size (S, M, L, XL, etc)
Sides (1 Side, 2 Side)
Service Type (All over, Spot)

How can I allow the customer to add that 1 product with multiple of a particular attribute?

Example; Customer should be able to order, 10 Small, 15 Medium, 20 Large of that one product "Tshirt Printing".

The Image below is an example from jakprints.com. I would like to do something similar. How can I replicate this in commerce? Or instead of using sliders... + or - buttons.

Please provide a few different ideas or POV's towards achieving this.


texts: Error on views page. Any idea what this means?

texts:
Uncaught exception thrown in session handler.

  PDOException: SQLSTATE[08S01]: Communication link failure: 1153 Got a
  packet bigger than 'max_allowed_packet' bytes: UPDATE
  {sessions} SET uid=:db_update_placeholder_0,
  cache=:db_update_placeholder_1, hostname=:db_update_placeholder_2,
  session=:db_update_placeholder_3, timestamp=:db_update_placeholder_4
  WHERE ( (sid = :db_condition_placeholder_0) AND (ssid =
  :db_condition_placeholder_1) ); Array ( [:db_update_placeholder_0]
  => 1 [:db_update_placeholder_1] => 0 [:db_update_placeholder_2] => 173.8.158.117 [:db_update_placeholder_3] => Wpw4khR1syd0trFnNVSUxDsOs_MtPQ

That gibberish at the end beginning with =&gt; goes on for dozens of pages dumped directly onto the page. Any idea what to look into?


texts: how to create image upload of difference dimensions

texts: I am creating a custom gallery. I require images that are the thumb nail and the big image size. I have custom content type. When i add the image field it allows me to enter the dimensions size. Is there a way for drupal to create 2 images. ie thumb and big image


texts:
I have a site which contains many links on the pages.
Now I want to achieve the following:-

User logs in website with credential and visit one of the page in the site.
User right click on link and open the link in new tab.Now there are
two pages of website opens in user's browser in two tabs.
Currently Log Out option is visible on every page of the website.
Authenticated user click on log out option in the page opened in one
of the tab.
Log out redirects user to login page.
So as per these scenario ,there is one more page remains open in another
tab.
Now if the same user click on any of the link in the page then it
should redirect to login page

Please provide your valuable input to achieve this functionality.


texts: How can I use the form control in a drupal form?

texts: In Drupal forms API there is a control type called "form" which, I think, allows nesting forms inside other forms. There is no usage example out there and the search term is a bit tricky so Google couldn't help. Would you please tell me how can I use this control in my forms ?


texts: How can I tell if I'm on a taxonomy page in preprocess_page?

texts:
If I'm on a node, inside preprocess_page(&$variables), I can check

if (isset($variables['node']) && $variables['node']->bundle() == 'my-type')

to see if I'm on a node, and a node of a certain type.

Then I can get field information with

$variables['node']->field_icon->entity->getFileUri()

How can I do the same thing for a taxonomy term page to know that I'm on a taxonomy term page and get the field values?


texts: How can I print render just location city in teaser view

texts:
Drupal 7

I am attempting to print just the city value within the location array.

I have created a content type with location and created a custom node template node--content.tpl.php. Inside of my if ($teaser) statement I have the following code:

hide($content['field_event_location']);
print render($content)

Which effectively hides the full field_event_location and renders all other content listed in the display settings of drupal 7 admin. I am attempting to render the city field with the following line:

print render($content['field_event_location']['und'][0]['city'])

I used

print_r($content);echo

to print the array with the following results:

[field_event_location] => Array
    (
        [und] => Array
            (
                [0] => Array
                    (
                        [lid] => 167
                        [street] => 4501 Main Street
                        [additional] =>
                        [city] => Kansas City
                        [province] =>
                        [postal_code] => 64130
                        [country] => us
                        [source] => 3
                        [is_primary] => 0
                        [province_name] =>
                        [country_name] => United States
                        [email] =>
                        [phone] =>
                    )

            )

    )

I did some basic de-bugging I found from this post (How to print render Location's sub-fields?), and was able to print render($content['body']) as well as get the full location output from print render($content['field_event_location'])


texts:
I want to filter a view that shows nodes sorted by rating. I would like to filter it to only show nodes with at least 5 votes.
I added the relationship for "vote results - number of votes".
When I add the filter it doesn't give me an option for "greater than":

Any ideas how to fix that?
Thanks


texts:
I have a text field that contains multiple values. That field does not always contain any values. The field needs to have a label when displayed.

IOW, the row should look like one rows below

CoAuthor: Person X, Person Y

or

CoAuthor: Person X

Here is my issue: When I use the view UI to add the label I get

CoAuthor: Person X, CoAuthor: Person Y

When I use the template,

print $fields['field_coauthor']->content;

I can not hide the field when empty so I end up with

CoAuthor: (and no value)

Is there a way to add a conditional to the template so that I do not end up with a label and no data? Or configure the view to include the label once... and not add it for every entry?


texts: Autofill texfields based on select option in dynamic fieldset

texts:
In my custom form i am dynamically generating multiple fieldsets.Each field set has select option(dropdownlist) and textfield generated dynamically. The value for textfield is dynamically generated based on user selected value from select option.

My problem is that if i select species from fieldset2 then density texfield1 in fieldset1 is overwritten and density textfield2 in fieldset2 is empty which is wrong. Each time the ajax callback return value is overwriting textfield1 in fieldset1(Field#1)

function fuel_design_tool($form, &$form_state) {
$form = array();
$form['#tree'] = TRUE;

if (empty($form_state[FIELDS_NUM])) {
    $form_state[FIELDS_NUM] = 1;
}

for ($i = 1; $i <= $form_state[FIELDS_NUM]; $i++) {

    $form['field'][$i] = array(
        '#type' => 'fieldset',
        '#title' => t('Field #@num', array('@num' => $i)),
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,

    );

    $form['field'][$i][FORM_FIELD_SPECIES] = array(
        '#type' => 'select',
        '#required' => TRUE,
        '#title' => 'Choose Species',
        '#options' =>  _load_species1(),
        '#default_value' => 0,
        '#ajax' => array(
             'callback' => 'fuel_design_tool_callback',
             'wrapper' => 'fuel_design_tool-wrapper',
             'event' => 'change',
           )

       );

      $profile = isset($form_state['values']['field'][$i]['FORM_FIELD_SPECIES']) ? ($form_state['values']['field'][$i]['FORM_FIELD_SPECIES']) : NULL;
    $form['field'][$i][FORM_FIELD_DENSITY] = array(
        '#type' => 'textfield',
        '#prefix' => '
',
        '#suffix' => '
',
        '#title' => t('Density'),
        '#value' =>$profile,

    );
    $form['add_field'] = array(
    '#type' => 'submit',
    '#value' => t('Add More fieldet'),
    '#submit' => array('fuel_design_tool_add_name')
    ),

     $form['submit_button'] = array(
     '#type' => 'submit',
     '#value' => t('Submit'),
     "#submit" => array("fuel_design_tool_submit"),
    );

     return $form;
 }

 function fuel_design_tool_add_name($form, &$form_state) {

    $form_state[FIELDS_NUM]++;
    $form_state['rebuild'] = TRUE;
   }

function fuel_design_tool_callback($form, &$form_state)
 {
   for ($i = 1; $i <= $form_state[FIELDS_NUM]; $i++)
   {

  $form['values']['field'][$i]['FORM_FIELD_DENSITY'] = $form_state['values']['field'][$i]['FORM_FIELD_SPECIES'];
  return array (
    $form['field'][$i]['FORM_FIELD_DENSITY'],

   );
  }

 }
 }

My callback function returns only one value and that by default filled to fiedset#1 textfield.I guess i need to modify my callback function.

I am looking forward for your kind help.

If my question is not clear please let me know. I am finding bit difficult to explain this problem


texts:
I've noticed that the article images are sized to a width of 220px to be displayed in the teaser on the frontpage in Drupal 8. I'm wondering how to change that to 300px, for example.

I created an image style with the size I want with the image module at admin/config/media/image-styles, but how do I associate that with the teaser that's shown on the home page? I looked in the Frontpage view, but didn't see any way of editing the image style there.

What's the best way to do this?


texts: Is there a way to provide theme name suggestion for form elements?

texts:
I'm trying to look for a way to modify the markup for a form element without touching the default theme/template. Upon checking the source code, Drupal does not seem to recommend any theme suggestions for editing form elements. I have multiple views using the same field on the exposed filter. If I try to edit the form-element-label.html.twig it will affect all of the elements with the same field.

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'form_element_label' -->
<!-- BEGIN OUTPUT from 'themes/iom/templates/layout/form-element-label.html.twig' -->
<label for="edit-field-themes-target-id" class="label">Themes</label>
<!-- END OUTPUT from 'themes/iom/templates/layout/form-element-label.html.twig' -->


texts:
I want to add ajax event to the following code

function dataoption_field_webform_select_options_info() {

  $items = array();

  $items['clienti'] = array(
    'title' => t('Clienti'),
    'options callback' => '_getClienti',
  );

  $items['periferiche'] = array(
    'title' => t('Periferiche'),
    'options callback' => '_getPerif',
  );

  return $items;
}

function _getClienti(){
   $result=db_query("select NomeCliente from ProvaClienti");
   $options = array();
   $count = 0;
     while($row = $result->fetchAssoc()){
        $options[$count]=t($row['NomeCliente']);
        $count++;
     }
   return $options;
 }

 function _getPerif(){
    $result=db_query("select periferica from periferiche where cliente='AAAAAAAA'");
    $options = array();
    $count = 0;
      while($row = $result->fetchAssoc()){
        $options[$count]=t($row['periferica']);
        $count++;
      }
    return $options;
  }

At change of first select option I want to change values of second select option. So I must pass a variable (the value of first select) to function _getPerif and than change value of second select.

I'm working with Webform Module. Anyone can help me?

Thanks


texts: How do I add local tasks menu to a views page display

texts:
I have created a views page display that has the path /node/%node/sessions, contextually filtering by content ID. It also creates a "menu tab" called "Sessions".

Therefore when I got to node/12 I see a local tasks menu: "View / Edit / Sessions" etc.

When I go to /node/12/sessions I see my view, filtered correctly by 12, but WITHOUT any local tasks tabs.

How should I make a local tasks menu appear on the view page node/12/sessions, (with the local tasks the same as the node/12 but with the sessions tab as active)?

Using this entry in my_module.links.task.yml succeeds in adding an entry to the node local tasks (still present if 'no menu' is selected in view UI). But it doesn't add the node local tasks to the views page.

view.event_sessions.page_1:
  title: Sessions
  route_name: view.event_sessions.page_1
  base_route: entity.node.canonical

Using views.view.event_sessions.page1 as the route throws a route not found error (although that is usually the correct route for a views page, so that's weird).


texts: How do I get third party jQuery plugins to work with Drupal?

texts:
I am trying to use the Slider Revolution jQuery plugin (from ThemePunch) on my Drupal site to create a slider on the front page.

I cannot for the life of me figure how to get this working. I have manually built a simple HTML page (outside of Drupal) to check the plugin and it works flawlessly, I just cannot seem to get it working in Drupal.

Drupal version: 7

Slider Revolution version: 4.1.2

Instructions for Slider Revolution: http://pastebin.com/gxNSV4hh

My theme is using jQuery 1.9.0

I have added into mytheme.info:

scripts[] = js/rs-plugin/js/jquery.themepunch.revolution.js
scripts[] = js/rs-plugin/js/jquery.themepunch.plugins.min.js

I have added to my front page:

My Caption

            ...

My Caption

            ...

        ....

Using Tracking Code module I have added (before /body) :

Slider Revolution file jquery.themepunch.revolution.js is structured like:

(function(jQuery,undefined){

    ////////////////////////////////////////
    // THE REVOLUTION PLUGIN STARTS HERE //
    ///////////////////////////////////////

    jQuery.fn.extend({

    // OUR PLUGIN HERE :)
    revolution: function(options) {
    ...........
    ...........
    }})

})(jQuery);

Slider Revolution file jquery.themepunch.plugins.min.js is structured like:

(function(t){"use strict";var e=t.GreenSockGlobals||t;if(!e.TweenLite){
    ..........
    ..........
);

(function(e,t){
    ..........
    ..........
})(jQuery)

How do I go about implementing this in Drupal? I believe Drupal expects jQuery/Javascript to be in a specific format (https://drupal.org/update/modules/6/7#javascript_compatibility) but I really don't know where to start with this. JS/jQuery really isn't my thing so I'm unsure what needs changed/added to make this compatible with Drupal.

Update: it works flawlessly, even with jQuery 1.7 : http://build.kaipee.co.uk/drupaltest/

Looks like it's an issue with my site/theme :(


texts: Proper way of Link generation from string

texts:
How can I generate a link in a proper way in Drupal 8? I have a field where the user can say an internal or external page/website.

Internal:
/node/6
/articles
/articles#Subheading
etc.

External:
www.google.com
//www.google.com
https://www.google.com

How can I transform these into a link with the following condition:
the site root is: www.mydomain.com/mysite/
internal links should have language versions: i.e. en/articles or pt/articles .

I've tried with Link::fromTextAndUrl('My link', Url::fromUri('internal:/articles')), but this requires a URI which is not my goal and it doesn't follow the selected user language.


texts: How to create block with custom embed code in D7?

texts:
I am trying to create a custom block with the following embed code in D7:

<form style="border:1px solid #ccc;padding:3px;text-align:center;"     action="http://tinyletter.com/pumpbeat" method="post" target="popupwindow" onsubmit="window.open('http://tinyletter.com/pumpbeat', 'popupwindow', 'scrollbars=yes,width=800,height=600');return true">

Enter your email address:

<input type="text" style="width:140px" name="emailaddress"/>

  <input type="hidden" value="1" name="embed"/>
  <input type="submit" value="Subscribe" />

A TinyLetter Email Newsletter

</form>

In D7 I go to Structure > Blocks > Add block, then paste the embed code into the Body field, and choose PhP code as the text format (I have also tried plain text and full html, without success).

However, rather than displaying the desired widget the new block displays the embed code above.

Please note that I also have the WYSIWYG module installed (with CK editor).

I would really appreciate any help in solving this problem. Thanks!


texts: How do I get parameters from form redirect?

texts:
I've made a form and I'm trying to get the submit result into a redirect page with URL api:

 public function submitForm(array &$form, FormStateInterface $form_state)
    {

    $metier=$form_state->getValue('metier');
    $position=$form_state->getValue('position');

    //$form_state->setRedirect('recherche.resultat',array('param'=>'test');

    $url = new Url('recherche.resultat');
    $url->setOptions(array('param'=>'test2'));
    $url->setRouteParameters(array('param'=>'test2'));

    $form_state->setRedirectUrl($url);

    drupal_set_message("envoyer");

}

I set two options :

$url->setOptions(array('param'=>'test2'));

and

$url->setRouteParameters(array('param'=>'test2'));

The form redirect me and this is my controller :

public function resultat()
{
    $request = \Drupal::request();
    $url = Url::createFromRequest($request);
    kint($url);
    kint($url->getOptions());
    kint($url->getRouteParameters());
    return array('#markup'=>t('test'));

}

The two methods :

    kint($url->getOptions());
    kint($url->getRouteParameters());

are empty

This is my routing :

 recherche.resultat:
  path: '/resultat'
  defaults:
    _title: 'resultat'
    _controller: '\Drupal\recherche\Controller\ResultatRechercheController::resultat'
  requirements:
     _permission: 'access content'

The parameters are in the URL and I can get them with $_GET but how can I get with the URL API?


texts: How to implement jQuery Accordion for a Menu?

texts:
I'm looking to implement something like the Accordion Menu module, but unfortunately that module has issues with Menu Block and other modules... so what's the best way to implement the jQuery Accordion menu with primary and secondary links, from a theming perspective? Should be a simple question for a themer, but I haven't found any specific tutorials that can take me step by step.

Using Drupal 7, Adaptive Theme.

update: thanks for all the responses. I'll look at all of the suggestions and provide another update :-)

Madam Adam's solution: not working correctly yet

  Only got it to work with this modification; added to js file

(function ($) {
//add drupal 7 code
Drupal.behaviors.myfunction = {
    attach: function(context, settings) {
//end drupal calls

//some jquery goodness here...
$( "#accordion" ).accordion( {
  header: "li",
  collapsible: true
} );

}}})
(jQuery);


texts: Retrieve a field value without loading the entire node?

texts: I have a large number of NIDs and I need one field value from each node. Is there any way to avoid the overhead of loading the entire node to get one field value?


texts: Extracting field values (of certain entity type and bundle) from form/form_state

texts:
I have fields of entity type foo and bundle name bar. These fields get rendered as an HTML input inside a form. There are other fields present on the form, but I'm only interested in foo/bar ones.

The number of foo/bar fields is dynamic (as are the names). I need a way to extract their name/value pairs.

Here's my situation in code:

function submit($form, &$form_state) {
  // Get all the submitted data that is backed by a field of
  // an entity type 'foo' and bundle 'bar'
}

Thanks.


texts:
what would i have to do to change the menu output structure for my theme?

this is the current structure:

                                //menu

Home

    Other Stuff

                            // sub-menu

Sub-Page 1

Sub-Page 1

what i would like to get is something like that:

Home

        Other Stuff  // the 'drop' class is for the styling of a menu item with child-items

            Sub-Page 1
            Sub-Page 2


texts: How to add GitHub repositories in Profile Installation

texts:
How to add Git repositories to install module while installing Drupal 8 Profile. Is any way to add repositories path in .yml or .profile to module installation?
Is this possible?


texts:
I got a problem to toggle the textfield if the ckeckbox with value 1 is checked.

function gkform_nameform() {
 $form['check'] = array
    (
    '#type'            => 'checkboxes',
    '#options'         => array
      (
      1 => 'Sometext',
      2 => 'Sometext2',
      ),
    );
$form['user_name'] = array(
'#type'=>'textfield',
'#states'=>array(
    'visible'=>array(
    ':input[name="check"]'=>array('checked'=> 'options' => '1' == TRUE),
    ),
  ),
 );

$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Download')
);
return $form;
}


texts:
I'm using/experimenting with Zen on my drupal site, and have just inserted a js file named alert.js into my theme's js folder.
The file has the following code:

  (function ($){
Drupal.behaviors.kiwiAlert = {
  attach: function(){
    alert('Hello World');
   }
 };
})(jQuery);

I followed up by making the necessary changes in my .info file, by inserting the following snippet:

 scripts[] = js/alert.js

Since my site is in development mode I've set the cache to be cleared/theme registry to be rebuilt upon each page load, but just in case I cleared my cache again.
And nothing, the alert message doesn't show, why is this not working??

PS: I also tried the following code in the js file, in the same context, but to no avail :C

 alert("Hello World!!");

Any and all answers will be much appreciated :)


texts: Redirect to login page if login fails from a login block?

texts: I have a login form block, when a user fail to login to the site I want to redirect him to the user/login page with the usual error message


texts: How to write session data for another user?

texts:
I need to switch to another user, create session for him, write data into the session(his UID), save the session id, then switch back to original user and work with the session id.

The account switcher is disabling session and I haven' been able to make it work manually with session or session_manager services.


texts:
I'm trying to fetch all nodes who's term reference field has no value or NULL.

$query = \Drupal::entityQuery('node')
    ->condition('type', 'mycontenttype', '=')
    ->condition('field_grade_level.entity.name', '');

    $nids = $query->execute();
    return $nids;

But it doesn't seem to work, giving empty results. Can anyone help what's wrong with the query?


texts: Omega 4 outputting fields into layout template

texts:
What's the easiest way to output a field into an Omega 4 subtheme layout?

I normally use Zen where it would be:

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

But with Omega $content is null. I tried the suggestions at How to render a field above the node title using omega sub-theme but couldn't get any output from that either.

Any ideas?


texts: Set views contextual filter as request_path()

texts:
There are fields in content type called URL and Image.

Suppose, A node has "service" value of "URL" field and I'm trying to show views block where current path (service) and "URL" field path (service) are same. The "URL" value can also be "content/services".

I tried with

adding "Alias" field as contextual filter in views.
adding URL field

Updated:

I also tried with URL field with PHP Code in contextual filter:

if(drupal_is_front_page()) {
    return '<front>';
}else{
    return request_path();
}

It works for only one path argument, like if current requested path is  services/one and views contextual filter only takes first path component as you can see in attached image

However, I need to set contextual filter with whole path no matter how many components are requested.

Theme

I have a content type with image and URL fields, I need to show image on the path where URL field is matched with requested path using views.

How would I do that?


texts:
I want to add a class to a table inserted in CKEditor.

I have tried to add a custom style using the styles dropdown and add this line, table.my-custom-class|Table, but when clicking on the table the styles dropdown is not activated and I'm not able to add the class.

Is this possible to do with the styles dropdown?

I do use the ckeditor_tabletoolstoolbar module, so alternativaly I can add a custom button to the toolbar, but I don't know how to do that either?

I have seen this thread, but it's for CKEditor 3, I'm using CKEditor 4.

I want to be able to toggle the class, so it's removed when clicking the button again.

How can I solve this problem?


texts: How to import a Google calendar so that it can be styled?

texts:
I am wondering if anyone has any ideas regarding solutions for a custom/styled Google Calendar embed on a Drupal Website. I have a client that would like their events updated via Google calendar but is displeased with the look of Google Calendar.

I have tried tons of different modules, but nothing seems to really work well. The FullCalendar module came the closest, but the calendar appeared empty (same for other modules as well - just no events appeared in it).

I did try using the Aggregator module, but it includes some extra fields and the information shows up in Spanish for some reason!

Any help would be greatly appreciated! I'm pulling my hair out trying to figure out a way to just import these freaking Google Calendar events, or embed the calendar in a way that it is styleable.


texts: Get the user uid (uid) from comment id (cid)

texts:
If I have the value of the comment id (cid) ex: 5

how do I get the user id (uid)?


texts: Inherit areas of parent or ancestor page

texts:
I have a website built with Drupal 7. Each page on the site can have an infinite number of child pages. Each page has "areas"; an area can be a thing such as left or right side bars that contain blocks, views or attributes/fields of the page content type (e.g., page.sponsor_ad_1, page.sponsor_ad_2).

I want the child pages inherit the areas of its closest ancestor page by default. A content editor can override it afterwards.

What's the best way to achieve this? What module does, completely or partially, what I need?


texts: Hi is it possible to make/install "a get direction button" which will use the [widget - Geocode from another field] and then show the route?


texts: How to create a bean bundle programatically

texts:
I don't want to use features. ;)

This is my code:

  beanform.info

name = Bean form
description = Configure beans blocks to print forms into it.
core = 7.x
files[] = "plugins/BeanForm.class.php"
package = "Bean"
dependencies[] = "bean"

  beanform.module

<?php
/**
 * @file
 * beanform module file to store the hooks.
 */

/**
 * Implements hook_bean_types_api_info()
 */
function beanform_bean_types_api_info() {
 return array('api' => 4);
}

/**
 * Implements hook_bean_types()
 */
function beanform_bean_types() {
  $plugins = array();
  $plugin_path = drupal_get_path('module', 'beanform') . '/plugins/bean';
  $plugins['bean_form'] = array(
    'name' => 'bean_form',
    'label' => t('Bean form'),
    'description' => t('Choose a form to print into a bean'),
    'handler' => array(
      'class' => 'BeanForm',
      'parent' => 'bean',
      // 'path' => $plugin_path,
      // 'file' => 'BeanForm.inc',
    ),
    'path' => $plugin_path,
    'file' => 'BeanForm.inc',
  );

  kpr ($plugins);

  return $plugins;
}

/**
 * Implements hook_theme()
 */
function beanform_theme(){
  $items = array();
  $items ['theme_bean_form'] = array(
    'arguments' => array(
      'form' => NULL,
    ),
    'template' => 'templates/bean-form',
    'file' => 'beanform.theme.inc',
  );

  return $items;
}

?>

But When I go to /admin/structure/block-types I don't see my bean.

I don't find the problem, and I'm checking bean_examples and bean_twitter_pull to see how it should be done.

Thanks

Oskar


texts: Use a custom install profile for Nightwatch tests?

texts:
How can you set a custom install profile to run a Nightwatch test in? I am not seeing it in the docs. The definition of the .drupalInstall() command has:

commandAsWebserver(
        `php ./scripts/test-site.php install ${setupFile} --install-profile nightwatch_testing --base-url ${process.env.DRUPAL_TEST_BASE_URL} ${dbOption} --json`,
      ),

Which looks like the profile is hardcoded with no way to set.


texts:
Is it possible to attach a view to comment?

My comments can have files uploaded. If the file is an image then I want to display a thumbnail and use image cache to resize it. Any other type of file I want to display in the standard way.


texts:
I have a custom form in a module, similar to this example:

function mymodule_form($form, &$form_state) {
   $radio_options = array(...);
   $form = array();
   $form["wrapper"] = array("#markup" => "

");
   $form['choice'] = array(
       '#title' => '',
       '#type' => 'radios',
       '#options' => $radio_options,
   );
   $form['submit'] = array(
       '#type' => 'submit',
       '#value' => t('Vote'),
       '#ajax' => array(
           'callback' => 'demo_form_ajax_submit',
           'wrapper' => "test-ajax",
           'method' => 'replace',
           'effect' => 'fade',
       ),
   );
   return $form;
}

function demo_form_ajax_submit($form, $form_state) {
   var_dump("something");
}

And I'm printing that form in template like this:

   <?php print render($form['choice']); ?>
   <?php print render($form['form_build_id']); ?>
   <?php print render($form['form_token']); ?>
   <?php print render($form['form_id']); ?>
   <?php print render($form['submit']) ?>

The form is printed correctly and even the button shows the ajax icon when clicked, but it does not work. When I check the logs it shows 2 errors:

Notice: Undefined index: form_build_id in ajax_get_form() (line 325 of...
Invalid form POST data.

It is similar to this issue Ajax not working for themed form but it does not work even adding drupal_render_children($form); at the bottom of the template.

Notes:

I added drupal_add_library('system', 'drupal.ajax'); in the module.
I'm using jQuery 1.7
I also tested drupal_render() instead of render().


texts: Watchdog "404 page not found" entries from spambot guessing urls

texts:
Browsing through the watchdog list I found a lot of page not found entries with urls like:

http://example.com/wp/wp-trackback.php
http://example.com/phpMyAdmin-2.5.5-pl1/index.php
http://example.com/flpurrbiao.html
http://example.com/gxksjgjrwk.html

What's best practice to stop these hits?


texts:
Right out front, I am working with Drupal 8.3.1.

I have a view that uses the table output format.  One of the fields it outputs is a multi-value date field in the content type.  It takes all the dates and puts them into an <ul> element that it then renders in the table cell.

I want to be able to preprocess that date field, to assign classnames to the individual <li> elements in it.  I've tried to use template_preprocess_views_view_field, but by the time that fires, the list has been built and rendered to HTML and is presented as a #markup value.

I've looked at various other preprocess hooks and none of them seem to be able to let me hook in and do this.  Is this a limitation of Views? Or am I missing something.


texts:
After user enter email and password. hook_user_login gets triggered and excute below code. I am placing code in "bootstap_business.theme" file like this

function hook_user_login($account) {

$email = $account->geteMail();

echo "Email: $email";

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://example.com/users" );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, "$email" );
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/plain','Authorization: ff23fdcffdgh5dsdsds'));

$result=curl_exec ($ch);

}

But i am not getting whether this function is excuted or not. How can i debug/solve this problem.
If i do echo also its not printing anything.


texts:
I am rendering the user profile edit form ($form_id = 'user_profile_form') on a custom tpl.php page. All the custom fields are user-defined under configuration > Account Settings > Manage Fields:

Following is the code:

<?php $form = drupal_get_form('user_profile_form');?>

<div class="some_class">
    <?php print(drupal_render($form['field_2'])); ?>
    <?php print(drupal_render($form['field_3'])); ?>
    <?php print(drupal_render($form['field_4'])); ?>
    <?php print(drupal_render($form['actions'])); ?>
</div>

All the fields are being rendered well. Even the submit and cancel buttons under the actions field are rendered BUT they are not working. Nothing happens when I click on them.

Please point out any error.

UPDATE:

I should point out that I don't want all the form elements to be rendered, which is why I am trying to render the elements separately.


texts: How do I programmatically store a file reference in a node?

texts: We have content type Image and it have image_data field for Image reference. So, how we could use static image path for node creation as well as for updating the image reference in the node.


texts:
I am working on a view where I need to show publications (a content type) in which authors (another content type) should be active (have a specific value for one of their fields).

I am using a relationship to add the fields for the node authors, and then add a filter criteria for checking if they are active or not. It is working in a way that is not what I want. It shows all the publications which has at least one active user (and maybe some other inactive users), but I want to have the ones in which all of authors are active.

What am I getting wrong here? could you please help me?


texts: If one allocates additional memory to drush in drushrc.php or drush.ini (am I correct that these are potentially valid options on a shared server?), is there a way to confirm that this amount is actually allocated when running drush?


texts: How to alter the "Request new password" form validation

texts:
I have adapted the login procedure with hook_form_FORM_ID_alter so that another database is also checked for credentials. Now I need to change the forgot password validation as well. It seems the FORM_ID of this form is user_pass, however, the hooks I define for that do not trigger. I also tried with hook_form_alter to see what form was triggered, but that hook also never fires (while it does for login for example).

Is the "Request new password" some kind of special form? Is it possible to change the validation handler of this form?

I'm using Drupal 7.


texts: Can local actions have multiple parents?

texts:
I have a module that I am working on that defines some local tasks and local actions for node pages, eg

$items['node/%node/foo'] = array(
  'title' => 'Foo',
  'page callback' => 'foo',
  'type' => MENU_LOCAL_TASK,
);

$items['node/%node/bar'] = array(
  'title' => 'Bar',
  'page callback' => 'bar',
  'type' => MENU_LOCAL_ACTION,
);

This works mostly great.  'Foo' appears as a new tab on node pages, and 'Bar' shows up as a local action on the 'node/%node' page.

I would like my 'node/%node/bar' local action to also show up on the 'node/%node/foo' page as a local action.  Is this possible?  I have tried playing with the 'tab_parent' and 'tab_root' parameters, but this only seems to work with local tasks and it also doesn't seem to allow multiple parents.


texts: how can I export table content to excel or csv

texts:
I am using drupal 6, I have created a table using

$tableHeader = array (
  array('data' => 'Ebooks','field' => 'etitle'),
  array('data' => 'Volumes','field' => 'Volume' ),
  array('data' => 'Chapter','field' => 'ctitle'),
  array('data' => 'Total Sale'),
);

$TableRows[] = array (
  l($row->etitle,$ebookinfo),
  $row->name,
  str_replace("&amp;", "&" ,$row->ctitle ),
  round($row->totalsale,2).' $',
);

$output .= theme('table', $tableHeader, $TableRows);// get the pager
$output .= theme('pager', NULL, 5, 0);

How can I export it to MS Excel or CSV?


texts:
I am trying to update a node title by database query as

 $num_updated = db_update('node') // Table name no longer needs {}
  ->fields(array(
    'title' => "custom_title",
    'status' => 1,
  ))
  ->condition('nid', $nid, '=')
  ->execute();

The above code is updating the node title in node table, but on node display I am not seeing the updated title.

The reason I am not using node_save() to update node title is to by pass auto entity label functionality for updating node title.


texts: What is the best procedure to upload sites folder from Locahost to live server?

texts:
I've had problems on and off with executing this task, using D7.

I create sites on localhost , then I ftp the files to live server.

FTPing the whole sites folder doesn't work, sometimes causes errors, how should I upload the sites folder properly?

So what I have done is upload the sites/all  and sites/default/files separately, and I take out the .htacess file from the sites/default/files folder and keep the original one in there...

But that's a pain in the ass, shouldn't it simply be delete the complete sites folder on the server and FTP the one from locahost?


texts: I have just create a view with a page as a display. There is a theme option under the advance setting. I change the theme and save the setting. However the theme I saw didn't change at all. Can anyone advise what went wrong? Actually, I look at the them option again, it didn't being saved even I have saved.


texts: Get all available promotions for specific commerce product

texts: How to get all available promotions, which apply to specific product?


texts: How to hide and show data from taxonomy data list?

texts:
I have a page that shows a list of same taxonomy items..
the item name,the author,and "read more" link appears.

How can I show the image of each item as well?


texts:
Drupal 7.14 - Calendar Module 7.x-3.4

Does anyone have an idea how to display the dates alongside the week days on the week views block?


texts: How to initiate node_save() on module install?

texts: If I wanted to create a node programmatically when a module is installed what hook should I use to initiate node_save()? I found guides on how to make the node I just can't seem to figure out how to initiate it.


texts: How to add image to only front page of Drupal 7?

texts:
How to add image to only front page of Drupal 7 website ?

So for now I have this code:

    <?php
    if (!drupal_is_front_page()) {
        echo render($page['content']);
    } else {
        echo render($page['reference']);
    }
    ?>

But this means that on everypage it will show my image.

Any idea how can i fix it ?


texts: Remove number and reference list from mime mail plaintext emails

texts:
Mime mail converts urls from "www.google.com" to "www.google.com [1]" in the plaintext version of email, and adds a reference list to bottom, "[1] www.google.com ". How do i remove this number and the reference list from the bottom of the plaintext email?

Edit: The mail itself has both, html and plaintext-version in itself. I want the users who view the plaintext-version of the email to not see the numbering.


texts: How to load a view via ajax without breaking ajax functionality?

texts:
What ist the correct way to load a View via Ajax and not breaking the view ajax functionality like the pager?

I tried it this way:

In a template:

<a href="/example-module/15?token=ugi2XH02Cumb3lsbSrOutwzRYSMXmn_bRKJI3FQ-hhk" class="btn use-ajax" role="button" rel="nofollow">
  {{- 'Load View' -}}
</a>

In the routing file:

example_module.example:
  path: '/example-module/{node_entity}'
defaults:
  _controller: '\Drupal\example_module\Controller\LoadViewController::render'
  _title: 'Load View'
options:
  parameters:
    node_entity:
      type: entity:node
requirements:
  _permission: 'access content'
  _csrf_token: 'TRUE'

In the Controller:

public function render(NodeInterface $node_entity, Request $request) {
  $node_id = $node_entity->id();
  if ($request->get(MainContentViewSubscriber::WRAPPER_FORMAT) == 'drupal_ajax') {
    $views_block = views_embed_view('load_view', 'block_1', $node_id);

    $response = new AjaxResponse();
    $selector = '#example-id';
    $replace = new ReplaceCommand($selector, \Drupal::service('renderer')->render($views_block));
    $response->addCommand($replace);
    return $response;
  }
  else {
    // For entities that don't have a canonical URL (like paragraphs),
    // redirect to the front page.
    $front = Url::fromUri('internal:/');
    $response = new RedirectResponse($front);
  }
  return $response;
}

This code works well. With two exceptions:

The view is not working with ajax (e.g. Pager). But the option "use AJAX" is checked in the UI
--- I also tried it with the Views::getView() method and add explicit the $view->setAjaxEnabled(TRUE) option. No success.
The Pager of the View has the URL of the controller in it, not the URL from the current rendered page.

So if you click on the Pager of the new loaded Views, the page reloads and show you on a white screen the Ajax command, but no specific error, not in the console and not in the logs.

Is this way not working or what I'm doing wrong?


texts: How do enable panelizer support for a custom entity?

texts:
I've programmatically created an entity. I'd like to panelize it. What plugins do I need to write to accomplish this?

Thanks!


texts: In order to un-install a module I disabled and deleted the folder from the root module folder. Though I have deleted the module yet it's showing in module list page. Why is this? Am I doing wrong?


texts:
Does the Facebook Pull Module not work with views? I am trying to use the contextual filter, but I do not see anything for Facebook Pull.

ALL I am trying to do is pull post from my Facebook page to my drupal site. I was trying Facebook Parser, but I can't figure out open graph with the access token. I would rather use Facebook Pull, but I need to use it in views.

Any suggestions


texts: How can I export node data the same way you do webform data?

texts: We had previously used webform to collect data and our "power users" got used to being able to export the submissions to Excel easily. For various reasons, we've switched from webform to a custom content type. Is there a module out there (or maybe a module isn't even necessary) that would let these users (who do NOT have access to the admin functions of the site) to do the same kind of exporting of nodes?


texts: I want to show the breadcrumb on the forum only. I am using the advanced forum module. How can I do this in Drupal 7?


texts: Drupal 7 sites hogging my shared hosting account

texts:
Two months back I launced 3 new Drupal-7 based sites on my shared hosting account but soon I found that my account was touching maximum process limit of 25 in my account and that my D7 sites were having only 400 or so page views daily. To compare it with D6 site, it could handle 4000 pages views without any problem.

Hostgator support confirmed too many processes of D7 sites. I've also checked it and I find that D7 index.php is running for much more time than D6 counterpart. So instead of it exiting in .5 second, I guess it's taking 3 seconds( rough estimate). I don't think those are eating too much of CPU in that case my sites would have been suspended.

To resolve it I'm moving my D7 sites to VPS so that process limit is increased.

I'm using all Drupal default install settings. No booster etc modules.

Any suggestions?


texts: Why isn't my page--front.tpl.php for my sub-theme used?

texts:
I created a sub theme under Omega, and I created the page--front.tpl.php template in mytheme/templates for the front page, but It's not working.

Can anyone tell me how to create a front page template in Omega?


texts: How to add sidebar to taxonomy page or node page?

texts:
Thought a bit more how people use Drupal CMS to update categories. Categories will be taxonomies in a view so that they can refer nodes to the categories.

Also at the most when click on category, it will be either a full taxonomy page or node page.

Sidebar will have taxonomy categories on left column and right column will explain more information. So if it is on same taxonomy, the menu item will be highlighted to let user know where they are on.

The problem is how to add sidebar to either taxonomy page or node page and set menu item active / highlighted?


texts: Views argument to match single date with date range field

texts:
My content type has a date field with an end date. So an example node has a date range, say from 2011-01-01 to 2011-01-30.

In my view, I want to add an argument/contextual filter that shows any nodes covering a specific day. So if the argument value is 2011-01-15, the node shows (it falls within its range). If the argument value is 2011-02-01, the node doesn't show.

In the Date (node) argument settings, I've played around with selecting both from and to date fields and the OR/AND settings, but can't find a way to do this?


texts: Change title of certain paragraphs in a form

texts:
Please see the attached pictures. In one of my projects I have a taxonomy, which users can edit and add data. It has multiple tabs (see picture one) and each tab has multiple fields in which paragraphs can be added (see picture two).

We have different kinds of paragraphs with each different titles. Our problem is that we want to show each paragraph to the end-user (see the second picture, the button "Meting (decimaal) toevoegen") with a title of "meting" while maintaining the more descriptive titles for the admins and developers.

One option is changing the title for the end-user while maintaining the actual title in the DB. The other one would be changing the actual title in the DB and change it for the admins (setting the system name as the title).

and I've tried all kinds of hooks but can't wrap my head around this problem.

Solution:
Due to the structure of the site, I couldn't get any hook solutions to work. So I wrote my own module, which attaches the javascript below to the form.

(function ($) {
  'use strict';

  Drupal.behaviors.test_form_styles = {
    attach: function (context, settings) {
      var regEx = /(?:meting)/i;
      var paragraphTitles = document.getElementsByClassName("paragraph-type-title");
      Object.keys(paragraphTitles).forEach(function (key) {
        if (regEx.test(paragraphTitles[key].innerHTML)){
          paragraphTitles[key].innerHTML = "Meting";
        }
      });

      var submitButtons = document.getElementsByClassName("field-add-more-submit");
      Object.keys(submitButtons).forEach(function (key) {
        if (regEx.test(submitButtons[key].value)) {
          submitButtons[key].value = "Meting toevoegen";
        }
      });
    }
  }
} (jQuery));


texts: How enable PHPMailer to write complete persistent log?

texts:
I am using the PHPMailer module to send emails to a user group (role) by a poormanscron-job.

I can see errors in my "recent log entry" view in the backend but I cannot get a persistant log with all log entries (I set the phpmailer settings to INFO or DEBUG level in the backend) somewhere.

I would like to check afterwards, who got the email and if there were dropped mails without errors (if that is possible).


texts: Feeds XPath Parser - Update existing content

texts:
I have created a Feed Importer and used XPath Parser for mapping. I have problem with updating a existing content. For example I have this xml structure.

<node>
  <nid>1</nid>
  <title>Title 1</title>
</node>
<node>
  <nid>2</nid>
  <title>Title 2</title>
</node>

I started importer and everything is OK. I set NID as unique and check "Update existing content" in Node Process settings. So when I run importer again whit the same data this nodes have updated again.

Why have been updated ? The source is the same and don't any difference. Should It display, there is no new content to add if I start importer again and again with the same data ?

Thank you!


texts: How can I have the file upload destination private by default?

texts:
Currently Webform file component uses public files as default upload destination. This is probably because private files path is not always available if not configured in Drupal settings correctly.
File upload destination should be made automatically "private files" by default if available.
I found same issue with Drupal7, is there any patch or way for Drupal8?
Or better if we do it by some setting in the local.settings.php or some similar cofniguraions?
https://www.drupal.org/forum/support/upgrading-drupal/2012-10-08/changing-public-file-field-into-private


texts: PHP Errors with Drupal 8 (Shared Hosting)

texts:
Using Bitbucket, I've cloned my Drupal 8 site to my Media Temple server. It is shared hosting. Anyways, I'm getting the following php warning and error:

Warning: require(/nfs/c11/h04/mnt/55555/domains/domain.com/html/../vendor/autoload.php): failed to open stream: No such file or directory in /nfs/c11/h04/mnt/55555/domains/domain.com/html/autoload.php on line 17

Fatal error: require(): Failed opening required '/nfs/c11/h04/mnt/55555/domains/domain.com/html/../vendor/autoload.php' (include_path='.:/usr/local/php-7.0.6/share/pear') in /nfs/c11/h04/mnt/55555/domains/domain.com/html/autoload.php on line 17

This is my first time working with Drupal 8. I've done some research and troubleshooting, but I've not been able to solve the issue.

I'm actually having a similar issue with a separate D8 website on Bluehost (CPanel). Has anything run into this before? If so, what steps were taken to resolve the issue?


texts: How to create a view with a list of items and item clicked?

texts:
I want to create a view which shows a list on the left side and the content of the item in the center. When a user clicks on an item in the list on the left side, the item must be shown in the center region or column. It should be done without page refresh.

Think of a view showing articles. The left side list will show a small image, title and trimmed description, whereas, the middle column will show the actual item clicked.

How to do that?

Note: I can use panels as well.


texts: After registration, store email address and redirect to to another page

texts:
I have this code working:

function custom_form_alter(&$form, &$form_state,$form_id) {
switch ($form_id) {
case 'user_register_form':
      $form['#submit'][] = 'custom_user_register_submit';
  break;
}
}

function custom_user_register_submit($form, &$form_state) {
$form_state['redirect'] = 'content/welcome';
}

This is working great no problems.

The node I'm redirecting to has a typical welcome message.  Part of the message has:  Your verification has been sent to (user's email address).

How do I get the registration email address for the welcome message?

I've created a custom template for the content/welcome node.  Just not sure what to do from here.


texts: How do I re-render form array with Ajax?

texts: In Hook_Form_Alter() there is a $form variable which changes each time the site reloads. I am working on module which does this with ajax on background. How do I re-generate $form array so I can access the newly generated variables?


texts: Is this the proper way to create a recipe page

texts:
Hi I have created a website that need to be able to filter between recipes.

Currently displayed everything I create in content. It is intended that the dishes should be first, and not the recipes.

How is it possible? it is a better system to do this?


texts:
Im using D7 and views 3 and I cant seem to find a solid answer on how to do this or if its possible but I created a page in views and I wanted to no-index the page, I dont see any options in views to do it so im wondering if this is possible and if so how can I go about doing this.

Any help is appreciated it.

EDIT**

Here is a function I managed to come up with however it something is making it not work. Does anyone have any suggestions?

function noindex_taxonomy(&$head_elements) {
  if (arg(0) == 'taxonomy' && arg(2) == 104 || arg(0) == 'taxonomy' && arg(2) == 103 || arg(0) == 'taxonomy' && arg(2) == 108) {
    $head_elements['noindex'] = array(
      '#type' => 'html_tag',
      '#tag' => 'meta',
      '#attributes' => array(
        'name' => 'robots',
        'content' => 'noindex',
      ),
    );
  }
}


texts: How to validate deletion of custom entity?

texts:
I'm making decently complex system, where many entities are referencing each other, and I don't want to allow any broken references. That is why I would like to implement validation at entity deletion, but where should I actually put it?

I know hook_form_validate runs on deletion, but it is hard to know if it has been invoked by deleting operation. I guess I can also do proper check in access callback of entity, however it isn't about access but validation, and I think that would be ugly workaround, as those are two different things. What would be a good place to put, a validation mechanism for deletion that would query the database to know if deletion of entity is possible?


texts: drupal_add_css does now work when in cache mode

texts:
I am trying to add a jquery plugin to a page through drupal_add_css and drupal_add_js as follows:

drupal_add_css($path = 'sites/all/libraries/gips/css/gips.css', $type = 'file', $media = 'all', $preprocess = true);
drupal_add_js('sites/all/libraries/gips/js/gips.js', array('type' => 'file', 'scope' => 'header', 'weight' => 3));
drupal_add_js("jQuery(document).ready(function(){...dosomething...});"), array('type' => 'inline', 'scope' => 'footer', 'weight' => 5));

When I'm not aggregating/caching the CSS files, it works fine.
When I try to aggregate the CSS files, it doesn't. The behavior is as if some css rules get lost in the process.
The same happens even if I change the $preprocess to false.

From Chrome's code inspector, I cannot see any overriding rules getting in the way either.

I am at a loss on how to debug this. Any suggestions?


texts:
When I run
drush --version

I get next output:
count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
 Drush Version   :  7.4.0

For getting rid of the warning, I have been told I to install drush version 8.
So I issued:
composer require drush/drush:8

giving next result:
./composer.json has been updated
Running composer update drush/drush
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Generating autoload files
9 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

So I suppose drush was already at version 8, but issuing the command above, I still have the same result: version 7.4.0. I am probably messing with several versions of drush.
I would like to understand better how to get rid of the old version, and being sure I am using the last one.


texts:
I have a module, and I want to have a page defined in hook_menu, that shows the add form for a specific content type, with some modifications to the form.

So far it's working, and even saving the new node, but only with the default values I'm setting in the code, i.e. it's not picking up anything the user types into the form. I checked and $form_state['input'] contains the inputted values, but $form_state['values'] doesn't, so the new node gets saved wrong.

Here's the relevant code:

function mymodule_menu() {
  return array(
    'admin/content/myadd/%' => array(
      'title' => 'my custom add page',
      'page callback' => 'mymodule_node_add',
      'page arguments' => array(3),
      'access callback' => TRUE,
      'type' => MENU_CALLBACK,
    ),
  );
}

function mymodule_node_add() {
  module_load_include('inc', 'node', 'node.pages');

  //I'm doing a print here instead of returning because I'm calling this page
  //in an AJAX popup, so I don't want the whole page to output, only the form.
  print render(drupal_get_form('mymodule_node_add_form'));
}

function mymodule_node_add_form($form, &$form_state) {
  if (!isset($form_state['node']) {
    global $user;
    $node = (object) array(
      'uid' => $user->uid,
      'type' => 'mycontenttype',
      'language' => LANGUAGE_NONE,
    );

    //this is setting a default value
    $node->myfield = array(LANGUAGE_NONE => array(array('value' => arg(3))));

    $form_state['build_info']['args'] = array($node);

    $form = drupal_build_form('mycontenttype_node_form', $form_state);
    $form['actions']['submit']['#submit'][0] = 'mymodule_node_add_form_submit';
    //there's a lot more customization of the form here, like adding fields, etc.
  }

  return $form;
}

function mymodule_node_add_form_submit($form, &$form_state) {
  //here's where $form_state['input'] is correct but $form_state['values'] isn't.

  $node = node_form_submit_build_node($form, $form_state);
  node_save($node);
  $form_state['values']['nid'] = $node->nid;
  $form_state['nid'] = $node->nid;
  $form_state['redirect'] = 'some/other/page';
}

So, am I doing something wrong here? Should I be concerned about form ids being wrong? (my form's id is mymodule_node_add_form, but the actual form might output mycontenttype_node_form), would this affect me?


texts: Assign file to entity image field (Programmatically)

texts:
//class:Drupal\file\Entity\File
$file=file_save_data($image_data,$save_path,FILE_EXISTS_REPLACE);

//field_someimage = entity 'image' field
//field class:FileFieldItemList
//It contains objects with class FieldType\ImageItem
$field_someimage=$entity->get('field_someimage');

How can i add $file to the field_someimage of $entity? (entity already exists).
Do i need to construct new ImageItem somehow?


texts: I have found an issue on drupal.org that I would like to submit an solution for. How can I create a patch using git so that I can submit it as a possible fix?